aiq.builder.workflow_builder#

Attributes#

Classes#

ConfiguredExporter

ConfiguredFunction

ConfiguredLLM

ConfiguredEmbedder

ConfiguredMemory

ConfiguredRetriever

WorkflowBuilder

Helper class that provides a standard way to create an ABC using

ChildBuilder

Helper class that provides a standard way to create an ABC using

Module Contents#

logger#
class ConfiguredExporter#
config: aiq.data_models.telemetry_exporter.TelemetryExporterBaseConfig#
instance: opentelemetry.sdk.trace.export.SpanExporter#
class ConfiguredFunction#
config: aiq.data_models.function.FunctionBaseConfig#
instance: aiq.builder.function.Function#
class ConfiguredLLM#
config: aiq.data_models.llm.LLMBaseConfig#
instance: aiq.builder.llm.LLMProviderInfo#
class ConfiguredEmbedder#
config: aiq.data_models.embedder.EmbedderBaseConfig#
instance: aiq.builder.embedder.EmbedderProviderInfo#
class ConfiguredMemory#
config: aiq.data_models.memory.MemoryBaseConfig#
instance: aiq.memory.interfaces.MemoryEditor#
class ConfiguredRetriever#
config: aiq.data_models.retriever.RetrieverBaseConfig#
instance: aiq.builder.retriever.RetrieverProviderInfo#
class WorkflowBuilder(
*,
general_config: aiq.data_models.config.GeneralConfig | None = None,
registry: aiq.cli.type_registry.TypeRegistry | None = None,
)#

Bases: aiq.builder.builder.Builder, contextlib.AbstractAsyncContextManager

Helper class that provides a standard way to create an ABC using inheritance.

general_config = None#
_registry = None#
_logging_handlers: dict[str, logging.Handler]#
_exporters: dict[str, ConfiguredExporter]#
_functions: dict[str, ConfiguredFunction]#
_workflow: ConfiguredFunction | None = None#
_llms: dict[str, ConfiguredLLM]#
_embedders: dict[str, ConfiguredEmbedder]#
_memory_clients: dict[str, ConfiguredMemory]#
_retrievers: dict[str, ConfiguredRetriever]#
_context_state#
_exit_stack: contextlib.AsyncExitStack | None = None#
function_dependencies: dict[str, aiq.data_models.function_dependencies.FunctionDependencies]#
current_function_building: str | None = None#
build(
entry_function: str | None = None,
) aiq.builder.workflow.Workflow#

Creates an instance of a workflow object using the added components and the desired entry function.

Parameters#

entry_functionstr | None, optional

The function name to use as the entry point for the created workflow. If None, the entry point will be the specified workflow function. By default None

Returns#

Workflow

A created workflow.

Raises#

ValueError

If the workflow has not been set before building.

_get_exit_stack() contextlib.AsyncExitStack#
async _build_function(
name: str,
config: aiq.data_models.function.FunctionBaseConfig,
) ConfiguredFunction#
async add_function(
name: str | aiq.data_models.component_ref.FunctionRef,
config: aiq.data_models.function.FunctionBaseConfig,
) aiq.builder.function.Function#
get_function(
name: str | aiq.data_models.component_ref.FunctionRef,
) aiq.builder.function.Function#
get_function_config(
name: str | aiq.data_models.component_ref.FunctionRef,
) aiq.data_models.function.FunctionBaseConfig#
async set_workflow(
config: aiq.data_models.function.FunctionBaseConfig,
) aiq.builder.function.Function#
get_workflow() aiq.builder.function.Function#
get_workflow_config() aiq.data_models.function.FunctionBaseConfig#
get_function_dependencies(
fn_name: str | aiq.data_models.component_ref.FunctionRef,
) aiq.data_models.function_dependencies.FunctionDependencies#
get_tool(
fn_name: str | aiq.data_models.component_ref.FunctionRef,
wrapper_type: aiq.builder.framework_enum.LLMFrameworkEnum | str,
)#
async add_llm(
name: str | aiq.data_models.component_ref.LLMRef,
config: aiq.data_models.llm.LLMBaseConfig,
)#
async get_llm(
llm_name: str | aiq.data_models.component_ref.LLMRef,
wrapper_type: aiq.builder.framework_enum.LLMFrameworkEnum | str,
)#
get_llm_config(
llm_name: str | aiq.data_models.component_ref.LLMRef,
) aiq.data_models.llm.LLMBaseConfig#
async add_embedder(
name: str | aiq.data_models.component_ref.EmbedderRef,
config: aiq.data_models.embedder.EmbedderBaseConfig,
)#
async get_embedder(
embedder_name: str | aiq.data_models.component_ref.EmbedderRef,
wrapper_type: aiq.builder.framework_enum.LLMFrameworkEnum | str,
)#
get_embedder_config(
embedder_name: str | aiq.data_models.component_ref.EmbedderRef,
) aiq.data_models.embedder.EmbedderBaseConfig#
async add_memory_client(
name: str | aiq.data_models.component_ref.MemoryRef,
config: aiq.data_models.memory.MemoryBaseConfig,
) aiq.memory.interfaces.MemoryEditor#
get_memory_client(
memory_name: str | aiq.data_models.component_ref.MemoryRef,
) aiq.memory.interfaces.MemoryEditor#

Return the instantiated memory client for the given name.

get_memory_client_config(
memory_name: str | aiq.data_models.component_ref.MemoryRef,
) aiq.data_models.memory.MemoryBaseConfig#
async add_retriever(
name: str | aiq.data_models.component_ref.RetrieverRef,
config: aiq.data_models.retriever.RetrieverBaseConfig,
)#
async get_retriever(
retriever_name: str | aiq.data_models.component_ref.RetrieverRef,
wrapper_type: aiq.builder.framework_enum.LLMFrameworkEnum | str | None = None,
)#
async get_retriever_config(
retriever_name: str | aiq.data_models.component_ref.RetrieverRef,
) aiq.data_models.retriever.RetrieverBaseConfig#
get_user_manager()#
async populate_builder(config: aiq.data_models.config.AIQConfig)#
classmethod from_config(config: aiq.data_models.config.AIQConfig)#
Async:

class ChildBuilder(workflow_builder: WorkflowBuilder)#

Bases: aiq.builder.builder.Builder

Helper class that provides a standard way to create an ABC using inheritance.

_workflow_builder#
_dependencies#
property dependencies: aiq.data_models.function_dependencies.FunctionDependencies#
async add_function(
name: str,
config: aiq.data_models.function.FunctionBaseConfig,
) aiq.builder.function.Function#
get_function(name: str) aiq.builder.function.Function#
get_function_config(
name: str,
) aiq.data_models.function.FunctionBaseConfig#
async set_workflow(
config: aiq.data_models.function.FunctionBaseConfig,
) aiq.builder.function.Function#
get_workflow() aiq.builder.function.Function#
get_workflow_config() aiq.data_models.function.FunctionBaseConfig#
get_tool(
fn_name: str,
wrapper_type: aiq.builder.framework_enum.LLMFrameworkEnum | str,
)#
async add_llm(name: str, config: aiq.data_models.llm.LLMBaseConfig)#
async get_llm(
llm_name: str,
wrapper_type: aiq.builder.framework_enum.LLMFrameworkEnum | str,
)#
get_llm_config(llm_name: str) aiq.data_models.llm.LLMBaseConfig#
async add_embedder(
name: str,
config: aiq.data_models.embedder.EmbedderBaseConfig,
)#
async get_embedder(
embedder_name: str,
wrapper_type: aiq.builder.framework_enum.LLMFrameworkEnum | str,
)#
get_embedder_config(
embedder_name: str,
) aiq.data_models.embedder.EmbedderBaseConfig#
async add_memory_client(
name: str,
config: aiq.data_models.memory.MemoryBaseConfig,
) aiq.memory.interfaces.MemoryEditor#
get_memory_client(
memory_name: str,
) aiq.memory.interfaces.MemoryEditor#

Return the instantiated memory client for the given name.

get_memory_client_config(
memory_name: str,
) aiq.data_models.memory.MemoryBaseConfig#
async add_retriever(
name: str,
config: aiq.data_models.retriever.RetrieverBaseConfig,
)#
async get_retriever(
retriever_name: str,
wrapper_type: aiq.builder.framework_enum.LLMFrameworkEnum | str | None = None,
)#
async get_retriever_config(
retriever_name: str,
) aiq.data_models.retriever.RetrieverBaseConfig#
get_user_manager() aiq.builder.builder.UserManagerHolder#
get_function_dependencies(
fn_name: str,
) aiq.data_models.function_dependencies.FunctionDependencies#