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

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


Classes
-------

.. autoapisummary::

   abacusai.api_class.ai_agents.ApiClass
   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


Functions
---------

.. autoapisummary::

   abacusai.api_class.ai_agents.get_clean_function_source_code


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

.. py:class:: ApiClass

   Bases: :py:obj:`abc.ABC`


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


   .. py:attribute:: _upper_snake_case_keys
      :type:  bool


   .. py:attribute:: _support_kwargs
      :type:  bool


   .. py:method:: __post_init__()


   .. py:method:: _get_builder()
      :classmethod:



   .. py:method:: __str__()

      Return str(self).



   .. py:method:: _repr_html_()


   .. py:method:: __getitem__(item)


   .. py:method:: __setitem__(item, value)


   .. py:method:: _unset_item(item)


   .. py:method:: get(item, default = None)


   .. py:method:: pop(item, default = NotImplemented)


   .. 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(input_dict)
      :classmethod:



.. py:function:: get_clean_function_source_code(func)

.. 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.

   :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: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:: 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, package_requirements = 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
   :param package_requirements: List of package requirements for the node.
   :type package_requirements: list


   .. 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.

   :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]


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


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


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



