Agents
Agent exporter.
AgentExporter ¶
AgentExporter(
agent: WaldiezAgent,
agent_names: dict[str, str],
models: tuple[list[WaldiezModel], dict[str, str]],
chats: tuple[list[WaldiezChat], dict[str, str]],
tool_names: dict[str, str],
is_async: bool = False,
for_notebook: bool = False,
cache_seed: Optional[int] = None,
initial_chats: Optional[
list[WaldiezAgentConnection]
] = None,
group_chat_members: Optional[list[WaldiezAgent]] = None,
arguments_resolver: Optional[
Callable[[WaldiezAgent], list[str]]
] = None,
output_dir: Optional[Union[str, Path]] = None,
context: Optional[ExporterContext] = None,
**kwargs: Any
)
Bases: Exporter[StandardExtras]
Agent exporter with standard extras.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent | WaldiezAgent | The agent to export. | required |
agent_names | dict[str, str] | Mapping of agent IDs to names. | required |
models | tuple[list[WaldiezModel], dict[str, str]] | All models and model names mapping. | required |
chats | tuple[list[WaldiezChat], dict[str, str]] | All chats and chat names mapping. | required |
tool_names | dict[str, str] | Mapping of tool IDs to names. | required |
is_async | bool | Whether the flow is async, by default False | False |
for_notebook | bool | Whether exporting for notebook, by default False | False |
cache_seed | Optional[int] | Cache seed if any, by default None | None |
initial_chats | Optional[list[WaldiezAgentConnection]] | Initial chats for group managers, by default None | None |
group_chat_members | Optional[list[WaldiezAgent]] | Group chat members if group manager, by default None | None |
arguments_resolver | Optional[Callable] | Function to resolve additional arguments, by default None | None |
output_dir | Optional[Union[str, Path]] | Output directory for generated files, by default None | None |
context | Optional[ExporterContext] | Exporter context with dependencies, by default None | None |
**kwargs | Any | Additional keyword arguments. | {} |
Source code in waldiez/exporting/agent/exporter.py
create_reasoning_extras ¶
create_reasoning_extras() -> StandardExtras
Create reasoning-specific extras for the agent.
Returns:
Type | Description |
---|---|
StandardExtras | The reasoning-specific extras. |
Source code in waldiez/exporting/agent/exporter.py
generate_main_content ¶
Generate the main agent definition.
Returns:
Type | Description |
---|---|
Optional[str] | The main agent definition content, or None if not applicable. |
Source code in waldiez/exporting/agent/exporter.py
code_execution ¶
Code execution processor for Waldiez agents.
CodeExecutionProcessor ¶
CodeExecutionProcessor(
agent: WaldiezAgent,
agent_name: str,
tool_names: dict[str, str],
)
Processor for code execution configuration.
process ¶
process() -> CodeExecutionConfig
Process code execution configuration.
Returns:
Type | Description |
---|---|
CodeExecutionConfig | The processed code execution configuration. |
Source code in waldiez/exporting/agent/code_execution.py
create_agent_exporter ¶
create_agent_exporter(
agent: WaldiezAgent,
agent_names: dict[str, str],
models: tuple[list[WaldiezModel], dict[str, str]],
chats: tuple[list[WaldiezChat], dict[str, str]],
tool_names: dict[str, str],
initial_chats: list[WaldiezAgentConnection],
is_async: bool = False,
for_notebook: bool = False,
cache_seed: Optional[int] = None,
group_chat_members: Optional[list[WaldiezAgent]] = None,
arguments_resolver: Optional[
Callable[[WaldiezAgent], list[str]]
] = None,
output_dir: Optional[Union[str, Path]] = None,
context: Optional[ExporterContext] = None,
**kwargs: Any
) -> AgentExporter
Create an agent exporter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent | WaldiezAgent | The agent to export. | required |
agent_names | dict[str, str] | Mapping of agent IDs to names. | required |
models | tuple[list[WaldiezModel], dict[str, str]] | All models and model names mapping. | required |
chats | tuple[list[WaldiezChat], dict[str, str]] | All chats and chat names mapping. | required |
tool_names | dict[str, str] | Mapping of tool IDs to names. | required |
is_async | bool | Whether the flow is async, by default False | False |
for_notebook | bool | Whether exporting for notebook, by default False | False |
cache_seed | Optional[int] | Cache seed if any, by default None | None |
initial_chats | Optional[list[WaldiezAgentConnection]] | Initial chats for group managers, by default None | required |
group_chat_members | Optional[list[WaldiezAgent]] | Group chat members if group manager, by default None | None |
arguments_resolver | Optional[Callable] | Function to resolve additional arguments, by default None | None |
output_dir | Optional[Union[str, Path]] | Output directory for generated files, by default None | None |
context | Optional[ExporterContext] | Exporter context with dependencies, by default None | None |
**kwargs | Any | Additional keyword arguments. | {} |
Returns:
Type | Description |
---|---|
AgentExporter | The created agent exporter. |
Source code in waldiez/exporting/agent/factory.py
exporter ¶
Export agents.
AgentExporter ¶
AgentExporter(
agent: WaldiezAgent,
agent_names: dict[str, str],
models: tuple[list[WaldiezModel], dict[str, str]],
chats: tuple[list[WaldiezChat], dict[str, str]],
tool_names: dict[str, str],
is_async: bool = False,
for_notebook: bool = False,
cache_seed: Optional[int] = None,
initial_chats: Optional[
list[WaldiezAgentConnection]
] = None,
group_chat_members: Optional[list[WaldiezAgent]] = None,
arguments_resolver: Optional[
Callable[[WaldiezAgent], list[str]]
] = None,
output_dir: Optional[Union[str, Path]] = None,
context: Optional[ExporterContext] = None,
**kwargs: Any
)
Bases: Exporter[StandardExtras]
Agent exporter with standard extras.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent | WaldiezAgent | The agent to export. | required |
agent_names | dict[str, str] | Mapping of agent IDs to names. | required |
models | tuple[list[WaldiezModel], dict[str, str]] | All models and model names mapping. | required |
chats | tuple[list[WaldiezChat], dict[str, str]] | All chats and chat names mapping. | required |
tool_names | dict[str, str] | Mapping of tool IDs to names. | required |
is_async | bool | Whether the flow is async, by default False | False |
for_notebook | bool | Whether exporting for notebook, by default False | False |
cache_seed | Optional[int] | Cache seed if any, by default None | None |
initial_chats | Optional[list[WaldiezAgentConnection]] | Initial chats for group managers, by default None | None |
group_chat_members | Optional[list[WaldiezAgent]] | Group chat members if group manager, by default None | None |
arguments_resolver | Optional[Callable] | Function to resolve additional arguments, by default None | None |
output_dir | Optional[Union[str, Path]] | Output directory for generated files, by default None | None |
context | Optional[ExporterContext] | Exporter context with dependencies, by default None | None |
**kwargs | Any | Additional keyword arguments. | {} |
Source code in waldiez/exporting/agent/exporter.py
create_reasoning_extras ¶
create_reasoning_extras() -> StandardExtras
Create reasoning-specific extras for the agent.
Returns:
Type | Description |
---|---|
StandardExtras | The reasoning-specific extras. |
Source code in waldiez/exporting/agent/exporter.py
generate_main_content ¶
Generate the main agent definition.
Returns:
Type | Description |
---|---|
Optional[str] | The main agent definition content, or None if not applicable. |
Source code in waldiez/exporting/agent/exporter.py
fallback_args_resolver ¶
fallback_args_resolver(agent: WaldiezAgent) -> list[str]
Fallback resolver for agent arguments.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent | WaldiezAgent | The agent for which to resolve arguments. | required |
Returns:
Type | Description |
---|---|
list[str] | An empty list (no extra args). |
Source code in waldiez/exporting/agent/exporter.py
extras ¶
Agents exporter extras.
CaptainAgentProcessor ¶
CaptainAgentProcessor(
agent: WaldiezAgent,
agent_names: dict[str, str],
all_models: list[WaldiezModel],
serializer: Optional[Serializer] = None,
output_dir: Optional[Path] = None,
)
Processor for captain agent configuration.Source code in
waldiez/exporting/agent/extras/captain_agent_extras.py
process ¶
process(
code_execution_config: Optional[
CodeExecutionConfig
] = None,
termination_config: Optional[TerminationConfig] = None,
system_message_config: Optional[
SystemMessageConfig
] = None,
) -> CaptainExtras
Process group manager and return extras.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
code_execution_config | CodeExecutionConfig | Configuration for code execution, by default None. | None |
termination_config | TerminationConfig | Configuration for termination, by default None. | None |
system_message_config | SystemMessageConfig | Configuration for system messages, by default None. | None |
Returns:
Type | Description |
---|---|
CaptainExtras | The processed result containing extra arguments, before content, imports, and environment variables. |
Source code in waldiez/exporting/agent/extras/captain_agent_extras.py
GroupManagerProcessor ¶
GroupManagerProcessor(
agent: WaldiezAgent,
initial_chats: list[WaldiezAgentConnection],
group_chat_members: list[WaldiezAgent],
agent_names: dict[str, str],
model_names: dict[str, str],
all_models: list[WaldiezModel],
serializer: Callable[..., str],
cache_seed: Optional[int] = None,
)
Processes group manager configurations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent | WaldiezAgent | The group manager agent to process. | required |
initial_chats | list[WaldiezAgentConnection] | The initial chats to process for the group manager. | required |
group_chat_members | list[WaldiezAgent] | The members of the group chat. | required |
agent_names | dict[str, str] | Mapping of agent IDs to their names. | required |
model_names | dict[str, str] | Mapping of model IDs to their names. | required |
all_models | list[WaldiezModel] | List of all models available for the agent. | required |
serializer | Callable[..., str] | Function to serialize data into a string format. | required |
cache_seed | Optional[int] | Seed for caching purposes, by default None. | None |
Source code in waldiez/exporting/agent/extras/group_manager_agent_extas.py
is_pattern_strategy staticmethod
¶
Check if the group manager should use pattern strategy.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
initial_chats | list[WaldiezAgentConnection] | The initial chats to determine the strategy. | required |
Returns:
Type | Description |
---|---|
bool | True if pattern strategy should be used, False otherwise. |
Source code in waldiez/exporting/agent/extras/group_manager_agent_extas.py
process ¶
process(
code_execution_config: Optional[
CodeExecutionConfig
] = None,
termination_config: Optional[TerminationConfig] = None,
system_message_config: Optional[
SystemMessageConfig
] = None,
) -> GroupManagerExtras
Process group manager and return extras.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
code_execution_config | CodeExecutionConfig | Configuration for code execution, by default None. | None |
termination_config | TerminationConfig | Configuration for termination, by default None. | None |
system_message_config | SystemMessageConfig | Configuration for system messages, by default None. | None |
Returns:
Type | Description |
---|---|
GroupManagerExtras | The processed group manager extras containing configuration. |
Source code in waldiez/exporting/agent/extras/group_manager_agent_extas.py
GroupMemberAgentProcessor ¶
GroupMemberAgentProcessor(
agent: WaldiezAgent,
agent_names: dict[str, str],
tool_names: dict[str, str],
all_chats: list[WaldiezChat],
chat_names: dict[str, str],
serializer: Callable[..., str],
)
Processor for group member agent configuration.Source code in
waldiez/exporting/agent/extras/group_member_extras.py
process ¶
process() -> GroupMemberProcessorResult
Process group member agent configuration.
Returns:
Type | Description |
---|---|
GroupMemberProcessorResult | The processed result containing before_agent code, after_agent code, and extra imports. |
Source code in waldiez/exporting/agent/extras/group_member_extras.py
ReasoningAgentProcessor ¶
ReasoningAgentProcessor(
agent: WaldiezAgent, serializer: Serializer | None
)
Processor for reasoning agent configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent | WaldiezAgent | The Waldiez agent to process. | required |
serializer | Serializer | None | Optional serializer for the reasoning configuration. Defaults to DefaultSerializer if not provided. | required |
Source code in waldiez/exporting/agent/extras/reasoning_agent_extras.py
process ¶
process(
code_execution_config: Optional[
CodeExecutionConfig
] = None,
termination_config: Optional[TerminationConfig] = None,
system_message_config: Optional[
SystemMessageConfig
] = None,
) -> ReasoningExtras
Process reasoning agent configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
code_execution_config | CodeExecutionConfig | Configuration for code execution, if applicable. | None |
termination_config | TerminationConfig | Configuration for termination, if applicable. | None |
system_message_config | SystemMessageConfig | Configuration for system messages, if applicable. | None |
Returns:
Type | Description |
---|---|
ReasoningExtras | The processed result containing extra arguments, before content, imports, and environment variables. |
Source code in waldiez/exporting/agent/extras/reasoning_agent_extras.py
captain_agent_extras ¶
Captain agent configuration processor.
CaptainAgentProcessor ¶
CaptainAgentProcessor(
agent: WaldiezAgent,
agent_names: dict[str, str],
all_models: list[WaldiezModel],
serializer: Optional[Serializer] = None,
output_dir: Optional[Path] = None,
)
Processor for captain agent configuration.Source code in
waldiez/exporting/agent/extras/captain_agent_extras.py
process ¶
process(
code_execution_config: Optional[
CodeExecutionConfig
] = None,
termination_config: Optional[TerminationConfig] = None,
system_message_config: Optional[
SystemMessageConfig
] = None,
) -> CaptainExtras
Process group manager and return extras.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
code_execution_config | CodeExecutionConfig | Configuration for code execution, by default None. | None |
termination_config | TerminationConfig | Configuration for termination, by default None. | None |
system_message_config | SystemMessageConfig | Configuration for system messages, by default None. | None |
Returns:
Type | Description |
---|---|
CaptainExtras | The processed result containing extra arguments, before content, imports, and environment variables. |
Source code in waldiez/exporting/agent/extras/captain_agent_extras.py
group_manager_agent_extas ¶
Group manager agent configuration processor.
GroupManagerProcessor ¶
GroupManagerProcessor(
agent: WaldiezAgent,
initial_chats: list[WaldiezAgentConnection],
group_chat_members: list[WaldiezAgent],
agent_names: dict[str, str],
model_names: dict[str, str],
all_models: list[WaldiezModel],
serializer: Callable[..., str],
cache_seed: Optional[int] = None,
)
Processes group manager configurations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent | WaldiezAgent | The group manager agent to process. | required |
initial_chats | list[WaldiezAgentConnection] | The initial chats to process for the group manager. | required |
group_chat_members | list[WaldiezAgent] | The members of the group chat. | required |
agent_names | dict[str, str] | Mapping of agent IDs to their names. | required |
model_names | dict[str, str] | Mapping of model IDs to their names. | required |
all_models | list[WaldiezModel] | List of all models available for the agent. | required |
serializer | Callable[..., str] | Function to serialize data into a string format. | required |
cache_seed | Optional[int] | Seed for caching purposes, by default None. | None |
Source code in waldiez/exporting/agent/extras/group_manager_agent_extas.py
is_pattern_strategy staticmethod
¶
Check if the group manager should use pattern strategy.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
initial_chats | list[WaldiezAgentConnection] | The initial chats to determine the strategy. | required |
Returns:
Type | Description |
---|---|
bool | True if pattern strategy should be used, False otherwise. |
Source code in waldiez/exporting/agent/extras/group_manager_agent_extas.py
process ¶
process(
code_execution_config: Optional[
CodeExecutionConfig
] = None,
termination_config: Optional[TerminationConfig] = None,
system_message_config: Optional[
SystemMessageConfig
] = None,
) -> GroupManagerExtras
Process group manager and return extras.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
code_execution_config | CodeExecutionConfig | Configuration for code execution, by default None. | None |
termination_config | TerminationConfig | Configuration for termination, by default None. | None |
system_message_config | SystemMessageConfig | Configuration for system messages, by default None. | None |
Returns:
Type | Description |
---|---|
GroupManagerExtras | The processed group manager extras containing configuration. |
Source code in waldiez/exporting/agent/extras/group_manager_agent_extas.py
group_member_extras ¶
Group member agent configuration processor.
GroupMemberAgentProcessor ¶
GroupMemberAgentProcessor(
agent: WaldiezAgent,
agent_names: dict[str, str],
tool_names: dict[str, str],
all_chats: list[WaldiezChat],
chat_names: dict[str, str],
serializer: Callable[..., str],
)
Processor for group member agent configuration.Source code in
waldiez/exporting/agent/extras/group_member_extras.py
process ¶
process() -> GroupMemberProcessorResult
Process group member agent configuration.
Returns:
Type | Description |
---|---|
GroupMemberProcessorResult | The processed result containing before_agent code, after_agent code, and extra imports. |
Source code in waldiez/exporting/agent/extras/group_member_extras.py
GroupMemberProcessorResult dataclass
¶
GroupMemberProcessorResult(
before_agent: str = "",
after_agent: str = "",
extra_arguments: list[InstanceArgument] = list[
InstanceArgument
](),
extra_imports: set[ImportStatement] = set[
ImportStatement
](),
)
Result from processing group member agent configuration.
handoffs ¶
Utility functions for generating agent related strings.
AfterWorkProcessor ¶
AfterWorkProcessor(
agent: WaldiezAgent,
agent_names: dict[str, str],
chat_names: dict[str, str],
all_chats: list[WaldiezChat],
serializer: Callable[..., str],
)
Processor for after-work configurations.Source code in
waldiez/exporting/agent/extras/handoffs/after_work.py
process ¶
process(
after_work: WaldiezTransitionTarget,
) -> AfterWorkResult
Process after-work configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
after_work | WaldiezTransitionTarget | The after-work transition target to process. | required |
Returns:
Type | Description |
---|---|
AfterWorkResult | The processed result containing the registration string, before_content code, and extra imports. |
Source code in waldiez/exporting/agent/extras/handoffs/after_work.py
AfterWorkResult dataclass
¶
HandoffProcessor ¶
HandoffProcessor(
agent: WaldiezAgent,
agent_names: dict[str, str],
chat_names: dict[str, str],
all_chats: list[WaldiezChat],
serializer: Callable[..., str],
)
Processor for agent handoffs.Source code in
waldiez/exporting/agent/extras/handoffs/handoff.py
process ¶
process() -> HandoffResult
Process all handoff configurations.
Returns:
Type | Description |
---|---|
HandoffResult | The processed handoff result containing after_agent code, and extra imports. |
Source code in waldiez/exporting/agent/extras/handoffs/handoff.py
HandoffResult dataclass
¶
TargetResult dataclass
¶
TransitionTargetProcessor ¶
TransitionTargetProcessor(
agent: WaldiezAgent,
agent_names: dict[str, str],
chat_names: dict[str, str],
all_chats: list[WaldiezChat],
serializer: Callable[..., str],
)
Processor for transition targets.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent_names | dict[str, str] | Mapping of agent IDs to their names. | required |
Source code in waldiez/exporting/agent/extras/handoffs/target.py
process ¶
process(target: WaldiezTransitionTarget) -> TargetResult
Process transition target based on its type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target | WaldiezTransitionTarget | The transition target to process. | required |
Returns:
Type | Description |
---|---|
TargetResult | The processed result containing the target string, before_content code, and extra imports. |
Raises:
Type | Description |
---|---|
ValueError | If the target type is unknown. |
Source code in waldiez/exporting/agent/extras/handoffs/target.py
after_work ¶
After-work processor for Waldiez agents.
AfterWorkProcessor ¶
AfterWorkProcessor(
agent: WaldiezAgent,
agent_names: dict[str, str],
chat_names: dict[str, str],
all_chats: list[WaldiezChat],
serializer: Callable[..., str],
)
Processor for after-work configurations.Source code in
waldiez/exporting/agent/extras/handoffs/after_work.py
process ¶
process(
after_work: WaldiezTransitionTarget,
) -> AfterWorkResult
Process after-work configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
after_work | WaldiezTransitionTarget | The after-work transition target to process. | required |
Returns:
Type | Description |
---|---|
AfterWorkResult | The processed result containing the registration string, before_content code, and extra imports. |
Source code in waldiez/exporting/agent/extras/handoffs/after_work.py
available ¶
Transition availability processor for Waldiez agents.
TransitionAvailableProcessor ¶
Processor for transition availability.
process ¶
process(
available: WaldiezTransitionAvailability,
) -> TransitionAvailableResult
Process the transition availability.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
available | WaldiezTransitionAvailability | The transition availability to process. | required |
Returns:
Type | Description |
---|---|
TransitionAvailableResult | The result of processing the transition availability. |
Raises:
Type | Description |
---|---|
ValueError | If the transition type is unsupported. |
Source code in waldiez/exporting/agent/extras/handoffs/available.py
condition ¶
Handoff condition processing for Waldiez agents.
ConditionProcessor ¶
ConditionProcessor(
agent: WaldiezAgent,
agent_names: dict[str, str],
chat_names: dict[str, str],
all_chats: list[WaldiezChat],
serializer: Callable[..., str],
)
Processor for handoff conditions.Source code in
waldiez/exporting/agent/extras/handoffs/condition.py
process ¶
process(
condition: WaldiezHandoffCondition,
) -> ConditionResult
Process handoff conditions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
condition | WaldiezHandoffCondition | The handoff condition to process. | required |
Returns:
Type | Description |
---|---|
ConditionResult | The processed result containing the relevant code and extra imports. |
Raises:
Type | Description |
---|---|
ValueError | If the condition type is unsupported. |
Source code in waldiez/exporting/agent/extras/handoffs/condition.py
handoff ¶
Handoff processor for Waldiez agents.
HandoffProcessor ¶
HandoffProcessor(
agent: WaldiezAgent,
agent_names: dict[str, str],
chat_names: dict[str, str],
all_chats: list[WaldiezChat],
serializer: Callable[..., str],
)
Processor for agent handoffs.Source code in
waldiez/exporting/agent/extras/handoffs/handoff.py
process ¶
process() -> HandoffResult
Process all handoff configurations.
Returns:
Type | Description |
---|---|
HandoffResult | The processed handoff result containing after_agent code, and extra imports. |
Source code in waldiez/exporting/agent/extras/handoffs/handoff.py
HandoffResult dataclass
¶
target ¶
Transition target processor for Waldiez agents.
TargetResult dataclass
¶
TransitionTargetProcessor ¶
TransitionTargetProcessor(
agent: WaldiezAgent,
agent_names: dict[str, str],
chat_names: dict[str, str],
all_chats: list[WaldiezChat],
serializer: Callable[..., str],
)
Processor for transition targets.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent_names | dict[str, str] | Mapping of agent IDs to their names. | required |
Source code in waldiez/exporting/agent/extras/handoffs/target.py
process ¶
process(target: WaldiezTransitionTarget) -> TargetResult
Process transition target based on its type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target | WaldiezTransitionTarget | The transition target to process. | required |
Returns:
Type | Description |
---|---|
TargetResult | The processed result containing the target string, before_content code, and extra imports. |
Raises:
Type | Description |
---|---|
ValueError | If the target type is unknown. |
Source code in waldiez/exporting/agent/extras/handoffs/target.py
rag ¶
Agent exporter rag extras.
VectorDBExtras dataclass
¶
Vector DB exporting extras for RAG user agents.
chroma_extras ¶
Get chroma db related imports and content.
get_chroma_db_args ¶
Get the 'kwargs to use for ChromaVectorDB.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent | WaldiezRagUserProxy | The agent. | required |
agent_name | str | The agent's name. | required |
Returns:
Type | Description |
---|---|
tuple[str, Set[str], str] |
|
Source code in waldiez/exporting/agent/extras/rag/chroma_extras.py
get_vector_db_extras ¶
get_vector_db_extras(
agent: WaldiezRagUserProxy, agent_name: str
) -> VectorDBExtras
Get the RAG user vector db string.
The vector db can be one of the following: "vector_db": ChromaVectorDB(....) "vector_db": QdrantVectorDB(....) "vector_db": MongoDBAtlasVectorDB(....) "vector_db": PGVectorDB(....)
If a custom embedding function is to be used, it's name will be in the arg and its definition will be before the arg.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent | WaldiezRagUserProxy | The agent. | required |
agent_name | str | The agent's name. | required |
Returns:
Type | Description |
---|---|
tuple[str, str, Set[str]] | The content before the arg if any, the arg and the related imports. |
Source code in waldiez/exporting/agent/extras/rag/vector_db_extras.py
mongo_extras ¶
Get mongodb related content and imports.
get_mongodb_db_args ¶
Get the kwargs to use for MongoDBAtlasVectorDB.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent | WaldiezRagUserProxy | The agent. | required |
agent_name | str | The agent's name. | required |
Returns:
Type | Description |
---|---|
tuple[str, Set[str], str] | The kwargs to use, what to import and the custom_embedding_function. |
Source code in waldiez/exporting/agent/extras/rag/mongo_extras.py
pgvector_extras ¶
Get pgvector related content and imports.
get_pgvector_db_args ¶
Get the kwargs to use for PGVectorDB.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent | WaldiezRagUserProxy | The agent. | required |
agent_name | str | The agent's name. | required |
Returns:
Type | Description |
---|---|
tuple[tuple[str, str], Set[str], str] | The kwargs to use, what to import and the custom_embedding_function. |
Source code in waldiez/exporting/agent/extras/rag/pgvector_extras.py
qdrant_extras ¶
Get qdrant db related imports and content.
get_qdrant_db_args ¶
Get the kwargs to use for QdrantVectorDB.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent | WaldiezRagUserProxy | The agent. | required |
agent_name | str | The agent's name. | required |
Returns:
Type | Description |
---|---|
tuple[str, Set[str], str] | The kwargs to use, the imports and the embedding function body if used. |
Source code in waldiez/exporting/agent/extras/rag/qdrant_extras.py
vector_db_extras ¶
Vector DB exporting utils for RAG user agents.
VectorDBExtras dataclass
¶
Vector DB exporting extras for RAG user agents.
get_vector_db_extras ¶
get_vector_db_extras(
agent: WaldiezRagUserProxy, agent_name: str
) -> VectorDBExtras
Get the RAG user vector db string.
The vector db can be one of the following: "vector_db": ChromaVectorDB(....) "vector_db": QdrantVectorDB(....) "vector_db": MongoDBAtlasVectorDB(....) "vector_db": PGVectorDB(....)
If a custom embedding function is to be used, it's name will be in the arg and its definition will be before the arg.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent | WaldiezRagUserProxy | The agent. | required |
agent_name | str | The agent's name. | required |
Returns:
Type | Description |
---|---|
tuple[str, str, Set[str]] | The content before the arg if any, the arg and the related imports. |
Source code in waldiez/exporting/agent/extras/rag/vector_db_extras.py
rag_user_proxy_agent_extras ¶
RAG user proxy agent configuration processor.
RagUserProxyAgentProcessor ¶
RagUserProxyAgentProcessor(
agent: WaldiezAgent,
agent_name: str,
model_names: dict[str, str],
path_resolver: PathResolver | None = None,
serializer: Serializer | None = None,
)
Processor for RAG user proxy agent configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent | WaldiezAgent | The Waldiez RAG user proxy agent to process. | required |
model_names | dict[str, str] | A mapping from model id to model name. | required |
path_resolver | PathResolver | None | Optional path resolver for resolving paths. Defaults to DefaultPathResolver if not provided. | None |
serializer | Serializer | None | Optional serializer for the RAG configuration. Defaults to DefaultSerializer if not provided. | None |
Source code in waldiez/exporting/agent/extras/rag_user_proxy_agent_extras.py
process ¶
process() -> RAGUserExtras
Process RAG user proxy agent configuration.
Returns:
Type | Description |
---|---|
RAGConfig | The processed result containing extra arguments, before content, imports, and environment variables. |
Source code in waldiez/exporting/agent/extras/rag_user_proxy_agent_extras.py
reasoning_agent_extras ¶
Reasoning agent configuration processor.
ReasoningAgentProcessor ¶
ReasoningAgentProcessor(
agent: WaldiezAgent, serializer: Serializer | None
)
Processor for reasoning agent configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent | WaldiezAgent | The Waldiez agent to process. | required |
serializer | Serializer | None | Optional serializer for the reasoning configuration. Defaults to DefaultSerializer if not provided. | required |
Source code in waldiez/exporting/agent/extras/reasoning_agent_extras.py
process ¶
process(
code_execution_config: Optional[
CodeExecutionConfig
] = None,
termination_config: Optional[TerminationConfig] = None,
system_message_config: Optional[
SystemMessageConfig
] = None,
) -> ReasoningExtras
Process reasoning agent configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
code_execution_config | CodeExecutionConfig | Configuration for code execution, if applicable. | None |
termination_config | TerminationConfig | Configuration for termination, if applicable. | None |
system_message_config | SystemMessageConfig | Configuration for system messages, if applicable. | None |
Returns:
Type | Description |
---|---|
ReasoningExtras | The processed result containing extra arguments, before content, imports, and environment variables. |
Source code in waldiez/exporting/agent/extras/reasoning_agent_extras.py
factory ¶
Factory for creating agent exporter.
create_agent_exporter ¶
create_agent_exporter(
agent: WaldiezAgent,
agent_names: dict[str, str],
models: tuple[list[WaldiezModel], dict[str, str]],
chats: tuple[list[WaldiezChat], dict[str, str]],
tool_names: dict[str, str],
initial_chats: list[WaldiezAgentConnection],
is_async: bool = False,
for_notebook: bool = False,
cache_seed: Optional[int] = None,
group_chat_members: Optional[list[WaldiezAgent]] = None,
arguments_resolver: Optional[
Callable[[WaldiezAgent], list[str]]
] = None,
output_dir: Optional[Union[str, Path]] = None,
context: Optional[ExporterContext] = None,
**kwargs: Any
) -> AgentExporter
Create an agent exporter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent | WaldiezAgent | The agent to export. | required |
agent_names | dict[str, str] | Mapping of agent IDs to names. | required |
models | tuple[list[WaldiezModel], dict[str, str]] | All models and model names mapping. | required |
chats | tuple[list[WaldiezChat], dict[str, str]] | All chats and chat names mapping. | required |
tool_names | dict[str, str] | Mapping of tool IDs to names. | required |
is_async | bool | Whether the flow is async, by default False | False |
for_notebook | bool | Whether exporting for notebook, by default False | False |
cache_seed | Optional[int] | Cache seed if any, by default None | None |
initial_chats | Optional[list[WaldiezAgentConnection]] | Initial chats for group managers, by default None | required |
group_chat_members | Optional[list[WaldiezAgent]] | Group chat members if group manager, by default None | None |
arguments_resolver | Optional[Callable] | Function to resolve additional arguments, by default None | None |
output_dir | Optional[Union[str, Path]] | Output directory for generated files, by default None | None |
context | Optional[ExporterContext] | Exporter context with dependencies, by default None | None |
**kwargs | Any | Additional keyword arguments. | {} |
Returns:
Type | Description |
---|---|
AgentExporter | The created agent exporter. |
Source code in waldiez/exporting/agent/factory.py
processor ¶
Processor for generating Waldiez agent definitions.
AgentProcessingResult dataclass
¶
AgentProcessingResult(content: str = '')
Result from processing an agent.
AgentProcessor ¶
AgentProcessor(
agent: WaldiezAgent,
agent_names: dict[str, str],
arguments_resolver: Callable[[WaldiezAgent], list[str]],
extras: StandardExtras,
)
Processor for main agent definition generation.Source code in
waldiez/exporting/agent/processor.py
get_auto_reply_arg ¶
get_auto_reply_arg() -> str
Get the default auto reply argument.
Returns:
Type | Description |
---|---|
str | The default auto reply argument. |
Source code in waldiez/exporting/agent/processor.py
get_description_arg ¶
get_description_arg() -> str
Get the agent description.
Returns:
Type | Description |
---|---|
str | The agent description. |
Source code in waldiez/exporting/agent/processor.py
get_human_input_mode_arg ¶
get_human_input_mode_arg() -> str
get_max_consecutive_auto_reply_arg ¶
get_max_consecutive_auto_reply_arg() -> str
Get the maximum consecutive auto reply argument.
Returns:
Type | Description |
---|---|
str | The maximum consecutive auto reply argument. |
Source code in waldiez/exporting/agent/processor.py
get_name_arg ¶
get_name_arg() -> str
process ¶
process() -> AgentProcessingResult
Process the agent and generate its definition.
Returns:
Type | Description |
---|---|
str | The generated agent definition string. |
Source code in waldiez/exporting/agent/processor.py
system_message ¶
Termination message configuration for Waldiez agents.
SystemMessageProcessor ¶
SystemMessageProcessor(agent: WaldiezAgent)
Processor for system message configuration.
process ¶
process() -> SystemMessageConfig
Process system message configuration.
Returns:
Type | Description |
---|---|
SystemMessageConfig | The processed system message configuration. |
Source code in waldiez/exporting/agent/system_message.py
termination ¶
Termination message configuration for Waldiez agents.
TerminationProcessor ¶
TerminationProcessor(agent: WaldiezAgent, agent_name: str)
Processor for termination message configuration.
process ¶
process() -> TerminationConfig
Process termination configuration.
Returns:
Type | Description |
---|---|
TerminationConfig | The processed termination configuration. |