abacusai.api_class.ai_agents
Classes
Configs for vector store indexing. |
|
Represents a mapping of inputs to a workflow node. |
|
A schema conformant to react-jsonschema-form for workflow node input. |
|
Represents a mapping of output from a workflow node. |
|
A schema conformant to react-jsonschema-form for a workflow node output. |
|
Represents a node in an Agent workflow graph. |
|
Represents an edge in an Agent workflow graph. |
|
Represents an Agent workflow graph. |
|
Message format for agent conversation |
|
Represents a WorkflowNode template config. |
|
Represents an input to the workflow node generated using template. |
|
Represents an output returned by the workflow node generated using template. |
Functions
|
Module Contents
- abacusai.api_class.ai_agents.validate_input_dict_param(dict_object, friendly_class_name, must_contain=[])
- class abacusai.api_class.ai_agents.FieldDescriptor
Bases:
abacusai.api_class.abstract.ApiClass
Configs for vector store indexing.
- Parameters:
field (str) – The field to be extracted. This will be used as the key in the response.
description (str) – The description of this field. If not included, the response_field will be used.
example_extraction (Union[str, int, bool, float]) – An example of this extracted field.
type (FieldDescriptorType) – The type of this field. If not provided, the default type is STRING.
- class abacusai.api_class.ai_agents.JSONSchema
- class abacusai.api_class.ai_agents.WorkflowNodeInputMapping
Bases:
abacusai.api_class.abstract.ApiClass
Represents a mapping of inputs to a workflow node.
- Parameters:
name (str) – The name of the input variable of the node function.
variable_type (WorkflowNodeInputType) – The type of the input.
variable_source (str) – The name of the node this variable is sourced from. If the type is WORKFLOW_VARIABLE, the value given by the source node will be directly used. If the type is USER_INPUT, the value given by the source node will be used as the default initial value before the user edits it. Set to None if the type is USER_INPUT and the variable doesn’t need a pre-filled initial value.
is_required (bool) – Indicates whether the input is required. Defaults to True.
- variable_type: abacusai.api_class.enums.WorkflowNodeInputType
- default_value: Any
- to_dict()
Standardizes converting an ApiClass to dictionary. Keys of response dictionary are converted to camel case. This also validates the fields ( type, value, etc ) received in the dictionary.
- class abacusai.api_class.ai_agents.WorkflowNodeInputSchema
Bases:
abacusai.api_class.abstract.ApiClass
,JSONSchema
A schema conformant to react-jsonschema-form for workflow node input.
To initialize a WorkflowNodeInputSchema dependent on another node’s output, use the from_workflow_node method.
- Parameters:
json_schema (dict) – The JSON schema for the input, conformant to react-jsonschema-form specification. Must define keys like “title”, “type”, and “properties”. Supported elements include Checkbox, Radio Button, Dropdown, Textarea, Number, Date, and file upload. Nested elements, arrays, and other complex types are not supported.
ui_schema (dict) – The UI schema for the input, conformant to react-jsonschema-form specification.
- to_dict()
Standardizes converting an ApiClass to dictionary. Keys of response dictionary are converted to camel case. This also validates the fields ( type, value, etc ) received in the dictionary.
- classmethod from_workflow_node(schema_source, schema_prop)
Creates a WorkflowNodeInputSchema instance which references the schema generated by a WorkflowGraphNode.
- class abacusai.api_class.ai_agents.WorkflowNodeOutputMapping
Bases:
abacusai.api_class.abstract.ApiClass
Represents a mapping of output from a workflow node.
- Parameters:
name (str) – The name of the output.
variable_type (Union[WorkflowNodeOutputType, str]) – The type of the output in the form of an enum or a string.
- variable_type: abacusai.api_class.enums.WorkflowNodeOutputType | str
- __post_init__()
- to_dict()
Standardizes converting an ApiClass to dictionary. Keys of response dictionary are converted to camel case. This also validates the fields ( type, value, etc ) received in the dictionary.
- class abacusai.api_class.ai_agents.WorkflowNodeOutputSchema
Bases:
abacusai.api_class.abstract.ApiClass
,JSONSchema
A schema conformant to react-jsonschema-form for a workflow node output.
- Parameters:
json_schema (dict) – The JSON schema for the output, conformant to react-jsonschema-form specification.
- to_dict()
Standardizes converting an ApiClass to dictionary. Keys of response dictionary are converted to camel case. This also validates the fields ( type, value, etc ) received in the dictionary.
- class abacusai.api_class.ai_agents.WorkflowGraphNode(name, input_mappings=None, output_mappings=None, function=None, function_name=None, source_code=None, input_schema=None, output_schema=None, template_metadata=None)
Bases:
abacusai.api_class.abstract.ApiClass
Represents a node in an Agent workflow graph.
- Parameters:
name (str) – A unique name for the workflow node.
input_mappings (List[WorkflowNodeInputMapping]) – List of input mappings for the node. Each arg/kwarg of the node function should have a corresponding input mapping.
output_mappings (List[WorkflowNodeOutputMapping]) – List of output mappings for the node. Each field in the returned dict/AgentResponse must have a corresponding output mapping.
function (callable) – The callable node function reference.
input_schema (WorkflowNodeInputSchema) – The react json schema for the user input variables.
output_schema (WorkflowNodeOutputSchema) – The react json schema for the output to be shown on UI.
function_name (str)
source_code (str)
template_metadata (dict)
- Additional Attributes:
function_name (str): The name of the function. source_code (str): The source code of the function.
- template_metadata
- classmethod _raw_init(name, input_mappings=None, output_mappings=None, function=None, function_name=None, source_code=None, input_schema=None, output_schema=None, template_metadata=None)
- Parameters:
name (str)
input_mappings (List[WorkflowNodeInputMapping])
output_mappings (List[WorkflowNodeOutputMapping])
function (callable)
function_name (str)
source_code (str)
input_schema (WorkflowNodeInputSchema)
output_schema (WorkflowNodeOutputSchema)
template_metadata (dict)
- classmethod from_template(template_name, name, configs=None, input_mappings=None, input_schema=None, output_schema=None, sleep_time=None)
- Parameters:
template_name (str)
name (str)
configs (dict)
input_mappings (Union[Dict[str, WorkflowNodeInputMapping], List[WorkflowNodeInputMapping]])
input_schema (Union[List[str], WorkflowNodeInputSchema])
output_schema (Union[List[str], WorkflowNodeOutputSchema])
sleep_time (int)
- to_dict()
Standardizes converting an ApiClass to dictionary. Keys of response dictionary are converted to camel case. This also validates the fields ( type, value, etc ) received in the dictionary.
- __setattr__(name, value)
- __getattribute__(name)
- class Outputs(node)
- Parameters:
node (WorkflowGraphNode)
- node
- __getattr__(name)
- property outputs
- class abacusai.api_class.ai_agents.WorkflowGraphEdge(source, target, details=None)
Bases:
abacusai.api_class.abstract.ApiClass
Represents an edge in an Agent workflow graph.
To make an edge conditional, provide {‘EXECUTION_CONDITION’: ‘<condition>’} key-value in the details dictionary. The condition should be a Pythonic expression string that evaluates to a boolean value and only depends on the outputs of the source node of the edge.
- Parameters:
- source: str | WorkflowGraphNode
- target: str | WorkflowGraphNode
- to_nx_edge()
- class abacusai.api_class.ai_agents.WorkflowGraph
Bases:
abacusai.api_class.abstract.ApiClass
Represents an Agent workflow graph.
The edges define the node invocation order.
- Parameters:
nodes (List[WorkflowGraphNode]) – A list of nodes in the workflow graph.
edges (List[WorkflowGraphEdge]) – A list of edges in the workflow graph, where each edge is a tuple of source, target, and details.
primary_start_node (Union[str, WorkflowGraphNode]) – The primary node to start the workflow from.
- nodes: List[WorkflowGraphNode]
- edges: List[WorkflowGraphEdge]
- primary_start_node: str | WorkflowGraphNode
- to_dict()
Standardizes converting an ApiClass to dictionary. Keys of response dictionary are converted to camel case. This also validates the fields ( type, value, etc ) received in the dictionary.
- class abacusai.api_class.ai_agents.AgentConversationMessage
Bases:
abacusai.api_class.abstract.ApiClass
Message format for agent conversation
- Parameters:
- to_dict()
Standardizes converting an ApiClass to dictionary. Keys of response dictionary are converted to camel case. This also validates the fields ( type, value, etc ) received in the dictionary.
- class abacusai.api_class.ai_agents.WorkflowNodeTemplateConfig
Bases:
abacusai.api_class.abstract.ApiClass
Represents a WorkflowNode template config.
- Parameters:
- to_dict()
Standardizes converting an ApiClass to dictionary. Keys of response dictionary are converted to camel case. This also validates the fields ( type, value, etc ) received in the dictionary.
- class abacusai.api_class.ai_agents.WorkflowNodeTemplateInput
Bases:
abacusai.api_class.abstract.ApiClass
Represents an input to the workflow node generated using template.
- Parameters:
- to_dict()
Standardizes converting an ApiClass to dictionary. Keys of response dictionary are converted to camel case. This also validates the fields ( type, value, etc ) received in the dictionary.
- class abacusai.api_class.ai_agents.WorkflowNodeTemplateOutput
Bases:
abacusai.api_class.abstract.ApiClass
Represents an output returned by the workflow node generated using template.
- Parameters:
name (str) – The name of the output.
variable_type (WorkflowNodeOutputType) – The type of the output.
description (str) – The description of this output.
- variable_type: abacusai.api_class.enums.WorkflowNodeOutputType
- to_dict()
Standardizes converting an ApiClass to dictionary. Keys of response dictionary are converted to camel case. This also validates the fields ( type, value, etc ) received in the dictionary.