abacusai.api_class.ai_agents
============================

.. py:module:: abacusai.api_class.ai_agents


Classes
-------

.. autoapisummary::

   abacusai.api_class.ai_agents.FieldDescriptor
   abacusai.api_class.ai_agents.WorkflowNodeInputSchema
   abacusai.api_class.ai_agents.WorkflowNodeOutputSchema
   abacusai.api_class.ai_agents.WorkflowNodeInputMapping
   abacusai.api_class.ai_agents.WorkflowNodeOutputMapping
   abacusai.api_class.ai_agents.WorkflowGraphNode
   abacusai.api_class.ai_agents.WorkflowGraphEdge
   abacusai.api_class.ai_agents.WorkflowGraph


Module Contents
---------------

.. py:class:: FieldDescriptor

   Bases: :py:obj:`abacusai.api_class.abstract.ApiClass`


   Configs for vector store indexing.

   :param field: The field to be extracted. This will be used as the key in the response.
   :type field: str
   :param description: The description of this field. If not included, the response_field will be used.
   :type description: str
   :param example_extraction: An example of this extracted field.
   :type example_extraction: Union[str, int, bool, float]
   :param type: The type of this field. If not provided, the default type is STRING.
   :type type: FieldDescriptorType


   .. py:attribute:: field
      :type:  str


   .. py:attribute:: description
      :type:  str


   .. py:attribute:: example_extraction
      :type:  Union[str, int, bool, float, list, dict]


   .. py:attribute:: type
      :type:  abacusai.api_class.enums.FieldDescriptorType


.. py:class:: WorkflowNodeInputSchema

   Bases: :py:obj:`abacusai.api_class.abstract.ApiClass`


   A react-jsonschema-form conformant schema for workflow node input. To initialize a WorkflowNodeInputSchema dependent on another node's output, use from_workflow_node method.

   :param json_schema: 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.
   :type json_schema: dict
   :param ui_schema: The ui schema for the input conformant to react-jsonschema-form specification.
   :type ui_schema: dict


   .. py:attribute:: json_schema
      :type:  dict


   .. py:attribute:: ui_schema
      :type:  dict


   .. py:attribute:: schema_source
      :type:  str


   .. py:attribute:: schema_prop
      :type:  str


   .. py:attribute:: runtime_schema
      :type:  bool


   .. py:method:: 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.



   .. py:method:: from_dict(schema)
      :classmethod:



   .. py:method:: from_workflow_node(schema_source, schema_prop)
      :classmethod:


      Creates a WorkflowNodeInputSchema instance which references the schema generated by a WorkflowGraphNode.

      :param schema_source: The name of the source WorkflowGraphNode.
      :type schema_source: str
      :param schema_prop: The name of the input schema parameter which source node outputs.
      :type schema_prop: str



.. py:class:: WorkflowNodeOutputSchema

   Bases: :py:obj:`abacusai.api_class.abstract.ApiClass`


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

   :param json_schema: The json schema for the output conformant to react-jsonschema-form specification.
   :type json_schema: dict


   .. py:attribute:: json_schema
      :type:  dict


   .. py:method:: 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.



   .. py:method:: from_dict(schema)
      :classmethod:



.. py:class:: WorkflowNodeInputMapping

   Bases: :py:obj:`abacusai.api_class.abstract.ApiClass`


   A mapping of input to a workflow node.

   :param name: The name of the input variable of the node function.
   :type name: str
   :param variable_type: The type of the input.
   :type variable_type: WorkflowNodeInputType
   :param variable_source: 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.
   :type variable_source: str
   :param is_required: Whether the input is required. Defaults to True
   :type is_required: bool


   .. py:attribute:: name
      :type:  str


   .. py:attribute:: variable_type
      :type:  abacusai.api_class.enums.WorkflowNodeInputType


   .. py:attribute:: variable_source
      :type:  str


   .. py:attribute:: is_required
      :type:  bool


   .. py:method:: 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.



   .. py:method:: from_dict(mapping)
      :classmethod:



.. py:class:: WorkflowNodeOutputMapping

   Bases: :py:obj:`abacusai.api_class.abstract.ApiClass`


   A mapping of output to a workflow node.

   :param name: The name of the output.
   :type name: str
   :param variable_type: The type of the output.
   :type variable_type: WorkflowNodeOutputType


   .. py:attribute:: name
      :type:  str


   .. py:attribute:: variable_type
      :type:  abacusai.api_class.enums.WorkflowNodeOutputType


   .. py:method:: 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.



   .. py:method:: from_dict(mapping)
      :classmethod:



.. py:class:: WorkflowGraphNode(name, input_mappings, output_mappings, function = None, function_name = None, source_code = None, input_schema = None, output_schema = None)

   Bases: :py:obj:`abacusai.api_class.abstract.ApiClass`


   A node in an Agent workflow graph.

   :param name: A unique name for the workflow node.
   :type name: str
   :param input_mappings: List of input mappings for the node. Each arg/kwarg of the node function should have a corresponding input mapping.
   :type input_mappings: List[WorkflowNodeInputMapping]
   :param output_mappings: List of output mappings for the node. Each field in the returned dict/AgentResponse must have a corresponding output mapping.
   :type output_mappings: List[WorkflowNodeOutputMapping]
   :param function: The callable node function reference.
   :type function: callable
   :param input_schema: The react json schema for the user input variables.
   :type input_schema: WorkflowNodeInputSchema
   :param output_schema: The react json schema for the output to be shown on UI.
   :type output_schema: WorkflowNodeOutputSchema


   .. py:method:: 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.



   .. py:method:: from_dict(node)
      :classmethod:



.. py:class:: WorkflowGraphEdge

   Bases: :py:obj:`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.

   :param source: The name of the source node of the edge.
   :type source: str
   :param target: The name of the target node of the edge.
   :type target: str
   :param details: Additional details about the edge.
   :type details: dict


   .. py:attribute:: source
      :type:  str


   .. py:attribute:: target
      :type:  str


   .. py:attribute:: details
      :type:  dict


   .. py:method:: to_nx_edge()


.. py:class:: WorkflowGraph

   Bases: :py:obj:`abacusai.api_class.abstract.ApiClass`


   An Agent workflow graph. The edges define the node invokation order. The workflow must follow linear invokation order.

   :param nodes: A list of nodes in the workflow graph.
   :type nodes: List[WorkflowGraphNode]
   :param edges: A list of edges in the workflow graph, where each edge is a tuple of source, target and details.
   :type edges: List[WorkflowGraphEdge]
   :param primary_start_node: The primary node to start the workflow from.
   :type primary_start_node: str


   .. py:attribute:: nodes
      :type:  List[WorkflowGraphNode]


   .. py:attribute:: edges
      :type:  List[WorkflowGraphEdge]


   .. py:attribute:: primary_start_node
      :type:  str


   .. py:method:: 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.



   .. py:method:: from_dict(graph)
      :classmethod:



