Models
Export models (llm_configs).
ModelsExporter(flow_name: str, agents: List[WaldiezAgent], agent_names: Dict[str, str], models: List[WaldiezModel], model_names: Dict[str, str], for_notebook: bool, cache_seed: Optional[int], output_dir: Optional[Union[str, Path]] = None)
¶
Bases: BaseExporter
, ExporterMixin
Models exporter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agents | List[WaldiezAgent] | The agents. | required |
agent_names | Dict[str, str] | The agent names. | required |
models | List[WaldiezModel] | The models. | required |
model_names | Dict[str, str] | The model names. | required |
for_notebook | bool | Whether the export is for a notebook or not. | required |
cache_seed | Optional[int] | The cache seed if any, by default None | required |
output_dir | Optional[Union[str, Path]] | The output directory if any, by default None | None |
Source code in waldiez/exporting/models/models_exporter.py
export() -> ExporterReturnType
¶
Export the models.
Returns:
Type | Description |
---|---|
ExporterReturnType | The exported models, the imports, the before export strings, the after export strings, and the environment variables. |
Source code in waldiez/exporting/models/models_exporter.py
generate() -> str
¶
Export the models.
Returns:
Type | Description |
---|---|
str | The exported models. |
Source code in waldiez/exporting/models/models_exporter.py
get_after_export() -> Optional[List[Tuple[str, Union[ExportPosition, AgentPosition]]]]
¶
Generate the after export strings.
The arguments for the agent's initialization. example generated args:
agent1 = ConversableAgent( ... llm_config=False, ... )
agent2 = ConversableAgent( ... llm_config={ "config_list": [ model1_llm_config, model2_llm_config, ], }, ... )
where model1_llm_config
and model2_llm_config
are the exported models using self.generate()
Returns:
Type | Description |
---|---|
Optional[List[Tuple[str, Union[ExportPosition, AgentPosition]]]] | The exported after export strings and their positions. |
Source code in waldiez/exporting/models/models_exporter.py
get_environment_variables() -> Optional[List[Tuple[str, str]]]
¶
Get the environment variables to set.
Returns:
Type | Description |
---|---|
Optional[List[Tuple[str, str]] | The environment variables to set. |
Source code in waldiez/exporting/models/models_exporter.py
get_imports() -> Optional[List[Tuple[str, ImportPosition]]]
¶
Generate the imports string.
Returns:
Type | Description |
---|---|
Optional[Tuple[str, ImportPosition]] | The exported imports and the position of the imports. |