Flow
Flow exporter.
FlowExporter ¶
FlowExporter(
waldiez: Waldiez,
output_dir: Path | None,
for_notebook: bool,
context: Optional[ExporterContext] = None,
**kwargs: Any
)
Bases: Exporter[FlowExtras]
Flow exporter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
waldiez | Waldiez | The Waldiez instance containing the flow data. | required |
output_dir | Path | The directory where the exported flow will be saved. | required |
for_notebook | bool | Whether the export is intended for a notebook environment. | required |
context | Optional[ExporterContext] | Exporter context with dependencies, by default None | None |
**kwargs | Any | Additional keyword arguments for the exporter. | {} |
Source code in waldiez/exporting/flow/exporter.py
extras property
¶
extras: FlowExtras
generate_main_content ¶
generate_main_content() -> str
Generate the main content of the export.
Returns:
Type | Description |
---|---|
str | The final executable script or notebook content. |
Source code in waldiez/exporting/flow/exporter.py
create_flow_exporter ¶
create_flow_exporter(
waldiez: Waldiez,
output_dir: Path | None,
for_notebook: bool,
context: Optional[ExporterContext] = None,
**kwargs: Any
) -> FlowExporter
Create a flow exporter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
waldiez | Waldiez | The Waldiez instance containing the flow data. | required |
output_dir | Path | The directory where the exported flow will be saved. | required |
for_notebook | bool | Whether the export is intended for a notebook environment. | required |
context | Optional[ExporterContext] | Exporter context with dependencies, by default None | None |
**kwargs | Any | Additional keyword arguments for the exporter. | {} |
Returns:
Type | Description |
---|---|
ChatsExporter | The created chats exporter. |
Source code in waldiez/exporting/flow/factory.py
merger ¶
Content merger for combining multiple export results.
MergeStatistics dataclass
¶
MergeStatistics(
total_results: int = 0,
total_imports: int = 0,
deduplicated_imports: int = 0,
total_content_items: int = 0,
total_env_vars: int = 0,
deduplicated_env_vars: int = 0,
conflicts_found: list[str] = list[str](),
)
Statistics about the merge operation.
ContentMerger ¶
ContentMerger(context: Optional[ExporterContext] = None)
Intelligently merges multiple ExportResult objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context | Optional[ExporterContext] | The exporter context, by default None | None |
Source code in waldiez/exporting/flow/merger.py
merge_results ¶
merge_results(results: list[ExportResult]) -> ExportResult
Merge multiple export results into one.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
results | list[ExportResult] | The export results to merge | required |
Returns:
Type | Description |
---|---|
ExportResult | The merged export result |
Source code in waldiez/exporting/flow/merger.py
get_merge_statistics ¶
get_merge_statistics() -> MergeStatistics
Get statistics about the last merge operation.
Returns:
Type | Description |
---|---|
MergeStatistics | Statistics about the merge operation |
factory ¶
Factory function for creating a FlowExporter instance.
create_flow_exporter ¶
create_flow_exporter(
waldiez: Waldiez,
output_dir: Path | None,
for_notebook: bool,
context: Optional[ExporterContext] = None,
**kwargs: Any
) -> FlowExporter
Create a flow exporter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
waldiez | Waldiez | The Waldiez instance containing the flow data. | required |
output_dir | Path | The directory where the exported flow will be saved. | required |
for_notebook | bool | Whether the export is intended for a notebook environment. | required |
context | Optional[ExporterContext] | Exporter context with dependencies, by default None | None |
**kwargs | Any | Additional keyword arguments for the exporter. | {} |
Returns:
Type | Description |
---|---|
ChatsExporter | The created chats exporter. |
Source code in waldiez/exporting/flow/factory.py
execution_generator ¶
Generates the main() and call_main() functions.
ExecutionGenerator ¶
Generate the main function and its calling block for flow exporter.
generate staticmethod
¶
generate(
content: str,
is_async: bool,
for_notebook: bool,
cache_seed: int | None,
after_run: str,
) -> str
Generate the complete flow script content.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
content | str | The content of the chats to be included in the main function. | required |
is_async | bool | Whether to generate async content. | required |
for_notebook | bool | Whether the export is intended for a notebook environment. | required |
cache_seed | str | int | None | The cache seed to use for flow chat if any. | required |
after_run | str | Additional content to add after the main chat execution, by default "" | required |
Returns:
Type | Description |
---|---|
str | The complete flow script content. |
Source code in waldiez/exporting/flow/execution_generator.py
generate_main_function staticmethod
¶
generate_main_function(
content: str,
is_async: bool,
cache_seed: int | None,
after_run: str,
for_notebook: bool,
) -> str
Generate the main function for the flow script.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
content | str | The content of the chats to be included in the main function. | required |
is_async | bool | Whether to generate async content | required |
cache_seed | str | int | None | The cache seed to use for flow chat if any | required |
after_run | str | Additional content to add after the main chat execution. | required |
for_notebook | bool | Whether the export is intended for a notebook environment. | required |
Returns:
Type | Description |
---|---|
str | The complete main function content. |
Source code in waldiez/exporting/flow/execution_generator.py
generate_call_main_function staticmethod
¶
Generate the call_main function for the flow script.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
is_async | bool | Whether to generate async content | required |
for_notebook | bool | Whether the export is intended for a notebook environment. | required |
Returns:
Type | Description |
---|---|
str | The complete call_main function content. |
Source code in waldiez/exporting/flow/execution_generator.py
generate_execution_block staticmethod
¶
Generate the execution block for the main function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
is_async | bool | Whether to generate async content | required |
Returns:
Type | Description |
---|---|
str | The complete if name == "main": block content |
Source code in waldiez/exporting/flow/execution_generator.py
file_generator ¶
Generate the whole folw content.
FileGenerator ¶
FileGenerator(context: ExporterContext)
Bases: ContentGenerator
Generate the complete flow notebook content.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context | ExporterContext | The exporter context containing dependencies. | required |
Source code in waldiez/exporting/flow/file_generator.py
generate ¶
generate(
merged_result: ExportResult,
is_async: bool,
after_run: str,
**kwargs: Any
) -> str
Generate the complete flow notebook content.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
merged_result | ExportResult | The merged export result containing all content. | required |
is_async | bool | Whether to generate async conten | required |
after_run | str | Additional content to add after the main flow execution. | required |
**kwargs | Any | Additional keyword arguments for the generator. | {} |
Returns:
Type | Description |
---|---|
str | The complete flow notebook content. |
Raises:
Type | Description |
---|---|
ExporterContentError | If there is no content to export. |
Source code in waldiez/exporting/flow/file_generator.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
get_header ¶
get_header(merged_result: ExportResult) -> str
Get or generate the header for the script.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
merged_result | ExportResult | The merged export result containing all content. | required |
Returns:
Type | Description |
---|---|
str | The header content. |
Source code in waldiez/exporting/flow/file_generator.py
orchestrator ¶
Flow export orchestrator.
ExportOrchestrator ¶
ExportOrchestrator(
waldiez: Waldiez, context: ExporterContext
)
Coordinates the export process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
waldiez | Waldiez | The Waldiez instance containing the flow to export. | required |
context | ExporterContext | The exporter context containing dependencies and configuration. | required |
Source code in waldiez/exporting/flow/orchestrator.py
orchestrate ¶
orchestrate() -> ExportResult
Orchestrate the export process.
Returns:
Type | Description |
---|---|
ExportResult | The result of the export process, containing the generated script and any additional metadata. |
Source code in waldiez/exporting/flow/orchestrator.py
exporter ¶
Flow exporter.
FlowExporter ¶
FlowExporter(
waldiez: Waldiez,
output_dir: Path | None,
for_notebook: bool,
context: Optional[ExporterContext] = None,
**kwargs: Any
)
Bases: Exporter[FlowExtras]
Flow exporter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
waldiez | Waldiez | The Waldiez instance containing the flow data. | required |
output_dir | Path | The directory where the exported flow will be saved. | required |
for_notebook | bool | Whether the export is intended for a notebook environment. | required |
context | Optional[ExporterContext] | Exporter context with dependencies, by default None | None |
**kwargs | Any | Additional keyword arguments for the exporter. | {} |
Source code in waldiez/exporting/flow/exporter.py
extras property
¶
extras: FlowExtras
generate_main_content ¶
generate_main_content() -> str
Generate the main content of the export.
Returns:
Type | Description |
---|---|
str | The final executable script or notebook content. |
Source code in waldiez/exporting/flow/exporter.py
utils ¶
Flow exporter utils.
generate_header ¶
generate_header(
name: str,
description: str,
requirements: list[str],
tags: list[str],
for_notebook: bool,
) -> str
Generate the header for the script or notebook.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name | str | The name of the flow. | required |
description | str | A brief description of the flow. | required |
requirements | list[str] | A list of requirements for the flow. | required |
tags | list[str] | A list of tags associated with the flow. | required |
for_notebook | bool | Whether the header is for a notebook or a script. | required |
Returns:
Type | Description |
---|---|
str | The header content. |
Source code in waldiez/exporting/flow/utils/common.py
get_after_run_content ¶
Get content to add after the flow is run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
waldiez | Waldiez | The waldiez object. | required |
agent_names | dict[str, str] | The dictionary of agent names and their corresponding ids | required |
tabs | int | The number of tabs to add before the content. | required |
Returns:
Type | Description |
---|---|
str | The content to add after the flow is run. |
Source code in waldiez/exporting/flow/utils/common.py
get_np_no_nep50_handle ¶
get_np_no_nep50_handle() -> str
Handle the "module numpy has no attribute _no_pep50_warning" error.
Returns:
Type | Description |
---|---|
str | The content to handle the error. |
Source code in waldiez/exporting/flow/utils/common.py
get_sorted_imports ¶
Get the sorted imports.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collected_imports | list[str] | The collected imports. | required |
Returns:
Type | Description |
---|---|
list[str] | The sorted imports. |
Source code in waldiez/exporting/flow/utils/importing.py
get_the_imports_string ¶
Get the final imports string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
all_imports | list[tuple[str, ImportPosition]] | All the imports. | required |
is_async | bool | If the flow is async. | required |
Returns:
Type | Description |
---|---|
str | The final imports string. |
Source code in waldiez/exporting/flow/utils/importing.py
get_sqlite_out ¶
Get the sqlite to csv and json conversion code string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
is_async | bool | Whether to use async mode. | required |
Returns:
Type | Description |
---|---|
str | The sqlite to csv and json conversion code string. |
Source code in waldiez/exporting/flow/utils/logging.py
get_start_logging ¶
Get the logging start call string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
is_async | bool | Whether to use async mode. | required |
for_notebook | bool | Whether the logging is for a notebook or a script. | required |
Returns:
Type | Description |
---|---|
str | The logging start string. |
Example
```python
get_start_logging() def start_logging() -> None: \"\"\"Start logging.\"\"\" runtime_logging.start( logger_type="sqlite", config={"dbname": "flow.db"}, )
Source code in waldiez/exporting/flow/utils/logging.py
get_stop_logging ¶
Get the function to stop logging and gather logs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
is_async | bool | Whether to use async mode | required |
tabs | int | The number of tabs to use for indentation, by default 0 | 0 |
Returns:
Type | Description |
---|---|
str | The logging stop string. |
Example
```python
get_logging_stop_string() def stop_logging() -> None: \"\"\"Stop logging.\"\"\" runtime_logging.stop() for table in [ "chat_completions", "agents", "oai_wrappers", "oai_clients", "version", "events", "function_calls", ]: dest = os.path.join("logs", f"{table}.csv") get_sqlite_out("flow.db", table, dest)
Source code in waldiez/exporting/flow/utils/logging.py
common ¶
Common utils for the final generatio.
generate_header ¶
generate_header(
name: str,
description: str,
requirements: list[str],
tags: list[str],
for_notebook: bool,
) -> str
Generate the header for the script or notebook.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name | str | The name of the flow. | required |
description | str | A brief description of the flow. | required |
requirements | list[str] | A list of requirements for the flow. | required |
tags | list[str] | A list of tags associated with the flow. | required |
for_notebook | bool | Whether the header is for a notebook or a script. | required |
Returns:
Type | Description |
---|---|
str | The header content. |
Source code in waldiez/exporting/flow/utils/common.py
main_doc_string ¶
main_doc_string() -> str
Generate the docstring for the main function.
Returns:
Type | Description |
---|---|
str | The docstring for the main function. |
Source code in waldiez/exporting/flow/utils/common.py
get_after_run_content ¶
Get content to add after the flow is run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
waldiez | Waldiez | The waldiez object. | required |
agent_names | dict[str, str] | The dictionary of agent names and their corresponding ids | required |
tabs | int | The number of tabs to add before the content. | required |
Returns:
Type | Description |
---|---|
str | The content to add after the flow is run. |
Source code in waldiez/exporting/flow/utils/common.py
get_np_no_nep50_handle ¶
get_np_no_nep50_handle() -> str
Handle the "module numpy has no attribute _no_pep50_warning" error.
Returns:
Type | Description |
---|---|
str | The content to handle the error. |
Source code in waldiez/exporting/flow/utils/common.py
importing ¶
Get the standard imports for the flow exporter.
get_sorted_imports ¶
Get the sorted imports.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collected_imports | list[str] | The collected imports. | required |
Returns:
Type | Description |
---|---|
list[str] | The sorted imports. |
Source code in waldiez/exporting/flow/utils/importing.py
sort_imports ¶
sort_imports(
all_imports: list[tuple[str, ImportPosition]],
) -> tuple[
list[str], list[str], list[str], list[str], bool
]
Sort the imports.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
all_imports | list[tuple[str, ImportPosition]] | All the imports. | required |
Returns:
Type | Description |
---|---|
tuple[list[str], list[str], list[str], list[str], bool] | The sorted imports and a flag if we got |
Source code in waldiez/exporting/flow/utils/importing.py
clean_and_group_autogen_imports ¶
Cleanup and group autogen imports.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
autogen_imports | list[str] | List of autogen import statements | required |
Returns:
Type | Description |
---|---|
list[str] | Cleaned and grouped autogen imports |
Source code in waldiez/exporting/flow/utils/importing.py
get_the_imports_string ¶
Get the final imports string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
all_imports | list[tuple[str, ImportPosition]] | All the imports. | required |
is_async | bool | If the flow is async. | required |
Returns:
Type | Description |
---|---|
str | The final imports string. |
Source code in waldiez/exporting/flow/utils/importing.py
ensure_np_import ¶
Ensure numpy is imported.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
third_party_imports | list[str] | The third party imports. | required |
Returns:
Type | Description |
---|---|
list[str] | The third party imports with numpy. |
Source code in waldiez/exporting/flow/utils/importing.py
gather_imports ¶
gather_imports(
model_imports: Optional[
list[tuple[str, ImportPosition]]
] = None,
tool_imports: Optional[
list[tuple[str, ImportPosition]]
] = None,
chat_imports: Optional[
list[tuple[str, ImportPosition]]
] = None,
agent_imports: Optional[
list[tuple[str, ImportPosition]]
] = None,
) -> list[tuple[str, ImportPosition]]
Gather all the imports.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_imports | tuple[str, ImportPosition] | The model imports. | None |
tool_imports | tuple[str, ImportPosition] | The tool imports. | None |
chat_imports | tuple[str, ImportPosition] | The chat imports. | None |
agent_imports | tuple[str, ImportPosition] | The agent imports. | None |
Returns:
Type | Description |
---|---|
tuple[str, ImportPosition] | The gathered imports. |
Source code in waldiez/exporting/flow/utils/importing.py
get_the_typing_imports ¶
get_the_typing_imports(
one_line_typing_imports: list[
tuple[str, ImportPosition]
],
) -> str
Get the typing imports as a single line.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
one_line_typing_imports | list[tuple[str, ImportPosition]] | The one line typing imports. | required |
Returns:
Type | Description |
---|---|
str | The final typing imports string. |
Source code in waldiez/exporting/flow/utils/importing.py
deduplicate_imports ¶
deduplicate_imports(
imports: list[tuple[str, ImportPosition]],
) -> list[tuple[str, ImportPosition]]
Deduplicate imports while preserving order.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
imports | list[tuple[str, ImportPosition]] | The imports to deduplicate. | required |
Returns:
Type | Description |
---|---|
list[tuple[str, ImportPosition]] | The deduplicated imports. |
Source code in waldiez/exporting/flow/utils/importing.py
linting ¶
Linting comments to include in the generated code.
split_linter_comment ¶
Split linter comment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prefix | str | The prefix for the comment, e.g., "# pylint: disable=" or "# pyright: ". | required |
rules | list[str] | The list of linter rules to include in the comment. | required |
max_lines | int | The maximum number of lines to split the comment into, by default 3. | 3 |
Returns:
Type | Description |
---|---|
str | The formatted comment string with the rules split into lines. |
Source code in waldiez/exporting/flow/utils/linting.py
get_flake8_ignore_comment ¶
Get the flake8 ignore comment string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rules | Optional[list[str]] | The flake8 rules to ignore, by default None. | None |
Returns:
Type | Description |
---|---|
str | The flake8 ignore comment string. |
Source code in waldiez/exporting/flow/utils/linting.py
get_pylint_ignore_comment ¶
Get the pylint ignore comment string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rules | Optional[list[str]] | The pylint rules to ignore, by default None. | None |
Returns:
Type | Description |
---|---|
str | The pylint ignore comment string. |
Example
Source code in waldiez/exporting/flow/utils/linting.py
get_pyright_ignore_comment ¶
Get the pyright ignore comment string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rules | Optional[list[str]] | The pyright rules to ignore, by default None. | None |
Returns:
Type | Description |
---|---|
str | The pyright ignore comment string. |
Example
Source code in waldiez/exporting/flow/utils/linting.py
get_mypy_ignore_comment ¶
Get the mypy ignore comment string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rules | Optional[list[str]] | The mypy rules to ignore, by default None. | None |
Returns:
Type | Description |
---|---|
str | The mypy ignore comment string. |
Example
Source code in waldiez/exporting/flow/utils/linting.py
logging ¶
Logging related string generation functions.
Functions:
Name | Description |
---|---|
get_logging_start_string | Get the string to start logging. |
get_logging_stop_string | Get the string to stop logging. |
get_sqlite_to_csv_string | Get the sqlite to csv conversion code string. |
get_sqlite_to_csv_call_string | Get the string to call the sqlite to csv conversion. |
get_start_logging ¶
Get the logging start call string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
is_async | bool | Whether to use async mode. | required |
for_notebook | bool | Whether the logging is for a notebook or a script. | required |
Returns:
Type | Description |
---|---|
str | The logging start string. |
Example
```python
get_start_logging() def start_logging() -> None: \"\"\"Start logging.\"\"\" runtime_logging.start( logger_type="sqlite", config={"dbname": "flow.db"}, )
Source code in waldiez/exporting/flow/utils/logging.py
get_sync_sqlite_out ¶
get_sync_sqlite_out() -> str
Get the sqlite to csv and json conversion code string.
Returns:
Type | Description |
---|---|
str | The sqlite to csv and json conversion code string. |
Example
>>> get_sqlite_outputs()
def get_sqlite_out(dbname: str, table: str, csv_file: str) -> None:
\"\"\"Convert a sqlite table to csv and json files.
Parameters
----------
dbname : str
The sqlite database name.
table : str
The table name.
csv_file : str
The csv file name.
\"\"\"
conn = sqlite3.connect(dbname)
query = f"SELECT * FROM {table}" # nosec
cursor = conn.execute(query)
rows = cursor.fetchall()
column_names = [description[0] for description in cursor.description]
data = [dict(zip(column_names, row)) for row in rows]
conn.close()
with open(csv_file, "w", newline="", encoding="utf-8") as file:
csv_writer = csv.DictWriter(file, fieldnames=column_names)
csv_writer.writeheader()
csv_writer.writerows(data)
json_file = csv_file.replace(".csv", ".json")
with open(json_file, "w", encoding="utf-8") as file:
json.dump(data, file, indent=4, ensure_ascii=False)
Source code in waldiez/exporting/flow/utils/logging.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
get_async_sqlite_out ¶
get_async_sqlite_out() -> str
Get the sqlite to csv and json conversion code string.
Returns:
Type | Description |
---|---|
str | The sqlite to csv and json conversion code string. |
Example
>>> get_sqlite_outputs()
async def get_sqlite_out(dbname: str, table: str, csv_file: str) -> None:
\"\"\"Convert a sqlite table to csv and json files.
Parameters
----------
dbname : str
The sqlite database name.
table : str
The table name.
csv_file : str
The csv file name.
\"\"\"
conn = await aiosqlite.connect(dbname)
query = f"SELECT * FROM {table}" # nosec
try:
cursor = await conn.execute(query)
except BaseException: # pylint: disable=broad-except
await conn.close()
return
rows = await cursor.fetchall()
column_names = [description[0] for description in cursor.description]
data = [dict(zip(column_names, row)) for row in rows]
await cursor.close()
await conn.close()
async with aiofiles.open(csv_file, "w", newline="", encoding="utf-8") as file:
csv_writer = csv.DictWriter(file, fieldnames=column_names)
csv_writer.writeheader()
csv_writer.writerows(data)
json_file = csv_file.replace(".csv", ".json")
async with aiofiles.open(json_file, "w", encoding="utf-8") as file:
await file.write(json.dumps(data, indent=4, ensure_ascii=False)
Source code in waldiez/exporting/flow/utils/logging.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
|
get_sqlite_out ¶
Get the sqlite to csv and json conversion code string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
is_async | bool | Whether to use async mode. | required |
Returns:
Type | Description |
---|---|
str | The sqlite to csv and json conversion code string. |
Source code in waldiez/exporting/flow/utils/logging.py
get_sqlite_out_call ¶
Get the sqlite to csv and json conversion call string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tabs | int | The number of tabs to use for indentation | required |
is_async | bool | Whether to use async mode | required |
Returns:
Type | Description |
---|---|
str | The sqlite to csv conversion call string. |
Example
Source code in waldiez/exporting/flow/utils/logging.py
get_stop_logging ¶
Get the function to stop logging and gather logs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
is_async | bool | Whether to use async mode | required |
tabs | int | The number of tabs to use for indentation, by default 0 | 0 |
Returns:
Type | Description |
---|---|
str | The logging stop string. |
Example
```python
get_logging_stop_string() def stop_logging() -> None: \"\"\"Stop logging.\"\"\" runtime_logging.stop() for table in [ "chat_completions", "agents", "oai_wrappers", "oai_clients", "version", "events", "function_calls", ]: dest = os.path.join("logs", f"{table}.csv") get_sqlite_out("flow.db", table, dest)