abacusai.api_class.ai_agents — AbacusAI documentation

# abacusai.api_class.ai_agents

## Classes

`FieldDescriptor` | Configs for vector store indexing.
`WorkflowNodeInputSchema` | A react-jsonschema-form conformant schema for workflow node input.
`WorkflowNodeOutputSchema` | A react-jsonschema-form schema for a workflow node output.
`WorkflowNodeInputMapping` | A mapping of input to a workflow node.
`WorkflowNodeOutputMapping` | A mapping of output to a workflow node.
`WorkflowGraphNode` | A node in an Agent workflow graph.
`WorkflowGraphEdge` | An edge in an Agent workflow graph.
`WorkflowGraph` | An Agent workflow graph. The edges define the node invokation order. The workflow must follow linear invokation order.

## Module Contents

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.

  field: str
  description: str
  example_extraction: str | int | bool | float | list | dict
  type: abacusai.api_class.enums.FieldDescriptorType

class abacusai.api_class.ai_agents.WorkflowNodeInputSchema

  Bases: `abacusai.api_class.abstract.ApiClass`

  A react-jsonschema-form conformant schema for workflow node input.

  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 - Checkbox, Radio Button, Dropdown, Textarea, Number, Date, file upload. Not supported - Nested elements, arrays and other complex types.

    - ui_schema (dict) – The ui schema for the input conformant to react-jsonschema-form specification.

  json_schema: dict
  ui_schema: dict
  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_dict(schema)
    Parameters:

      schema (dict)

class abacusai.api_class.ai_agents.WorkflowNodeOutputSchema

  Bases: `abacusai.api_class.abstract.ApiClass`

  A react-jsonschema-form schema for a workflow node output.

  Parameters:

    json_schema (dict) – The json schema for the output conformant to react-jsonschema-form specification.

  json_schema: dict
  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_dict(schema)
    Parameters:

      schema (dict)

class abacusai.api_class.ai_agents.WorkflowNodeInputMapping

  Bases: `abacusai.api_class.abstract.ApiClass`

  A mapping of input 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 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) – Whether the input is required. Defaults to True

  name: str
  variable_type: abacusai.api_class.enums.WorkflowNodeInputType
  variable_source: str
  is_required: bool
  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_dict(mapping)
    Parameters:

      mapping (dict)

class abacusai.api_class.ai_agents.WorkflowNodeOutputMapping

  Bases: `abacusai.api_class.abstract.ApiClass`

  A mapping of output to a workflow node.

  Parameters:

    - name (str) – The name of the output.

    - variable_type (WorkflowNodeOutputType) – The type of the output.

  name: str
  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.

  classmethod from_dict(mapping)
    Parameters:

      mapping (dict)

class abacusai.api_class.ai_agents.WorkflowGraphNode(name, input_mappings, output_mappings, function=None, function_name=None, source_code=None, input_schema=None, output_schema=None, package_requirements=None)

  Bases: `abacusai.api_class.abstract.ApiClass`

  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.

    - package_requirements (list) – List of package requirements for the node.

    - function_name (str)

    - source_code (str)

  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_dict(node)
    Parameters:

      node (dict)

class abacusai.api_class.ai_agents.WorkflowGraphEdge

  Bases: `abacusai.api_class.abstract.ApiClass`

  An edge in an Agent workflow graph. To make an edge conditional, provide ‘EXECUTION_CONDITION’: <condition> key-value in details. The condition should be a pythonic expression that evaluates to a boolean value and only depends on outputs of the source node.

  Parameters:

    - source (str) – The name of the source node of the edge.

    - target (str) – The name of the target node of the edge.

    - details (dict) – Additional details about the edge.

  source: str
  target: str
  details: dict
  to_nx_edge()

class abacusai.api_class.ai_agents.WorkflowGraph

  Bases: `abacusai.api_class.abstract.ApiClass`

  An Agent workflow graph. The edges define the node invokation order. The workflow must follow linear invokation 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 (str) – The primary node to start the workflow from.

  nodes: List[WorkflowGraphNode]
  edges: List[WorkflowGraphEdge]
  primary_start_node: str
  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_dict(graph)
    Parameters:

      graph (dict)