abacusai.api_class.segments

Attributes

Segment

Classes

ResponseSection

A response section that an agent can return to render specific UI elements.

AgentFlowButtonResponseSection

A response section that an AI Agent can return to render a button.

ImageUrlResponseSection

A response section that an agent can return to render an image.

TextResponseSection

A response section that an agent can return to render text.

RuntimeSchemaResponseSection

A segment that an agent can return to render json and ui schema in react-jsonschema-form format for workflow nodes.

CodeResponseSection

A response section that an agent can return to render code.

Base64ImageResponseSection

A response section that an agent can return to render a base64 image.

CollapseResponseSection

A response section that an agent can return to render a collapsible component.

ListResponseSection

A response section that an agent can return to render a list.

ChartResponseSection

A response section that an agent can return to render a chart.

DataframeResponseSection

A response section that an agent can return to render a pandas dataframe.

Module Contents

class abacusai.api_class.segments.ResponseSection

Bases: abacusai.api_class.abstract.ApiClass

A response section that an agent can return to render specific UI elements.

Parameters:
type: abacusai.api_class.enums.ResponseSectionType
id: 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.

abacusai.api_class.segments.Segment
class abacusai.api_class.segments.AgentFlowButtonResponseSection(label, agent_workflow_node_name, section_key=None)

Bases: ResponseSection

A response section that an AI Agent can return to render a button.

Parameters:
  • label (str) – The label of the button.

  • agent_workflow_node_name (str) – The workflow start node to be executed when the button is clicked.

  • section_key (str)

label: str
agent_workflow_node_name: str
class abacusai.api_class.segments.ImageUrlResponseSection(url, height, width, section_key=None)

Bases: ResponseSection

A response section that an agent can return to render an image.

Parameters:
  • url (str) – The url of the image to be displayed.

  • height (int) – The height of the image.

  • width (int) – The width of the image.

  • section_key (str)

url: str
height: int
width: int
class abacusai.api_class.segments.TextResponseSection(text, section_key=None)

Bases: ResponseSection

A response section that an agent can return to render text.

Parameters:
  • segment (str) – The text to be displayed.

  • text (str)

  • section_key (str)

segment: str
class abacusai.api_class.segments.RuntimeSchemaResponseSection(json_schema, ui_schema=None, schema_prop=None)

Bases: ResponseSection

A segment that an agent can return to render json and ui schema in react-jsonschema-form format for workflow nodes. This is primarily used to generate dynamic forms at runtime. If a node returns a runtime schema variable, the UI will render the form upon node execution.

Parameters:
  • json_schema (dict) – json schema in RJSF format.

  • ui_schema (dict) – ui schema in RJSF format.

  • schema_prop (str)

json_schema: dict
ui_schema: dict
class abacusai.api_class.segments.CodeResponseSection(code, language, section_key=None)

Bases: ResponseSection

A response section that an agent can return to render code.

Parameters:
  • code (str) – The code to be displayed.

  • language (CodeLanguage) – The language of the code.

  • section_key (str)

code: str
language: abacusai.api_class.enums.CodeLanguage
class abacusai.api_class.segments.Base64ImageResponseSection(b64_image, section_key=None)

Bases: ResponseSection

A response section that an agent can return to render a base64 image.

Parameters:
  • b64_image (str) – The base64 image to be displayed.

  • section_key (str)

b64_image: str
class abacusai.api_class.segments.CollapseResponseSection(title, content, section_key=None)

Bases: ResponseSection

A response section that an agent can return to render a collapsible component.

Parameters:
  • title (str) – The title of the collapsible component.

  • content (ResponseSection) – The response section constituting the content of collapsible component

  • section_key (str)

title: str
content: ResponseSection
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.segments.ListResponseSection(items, section_key=None)

Bases: ResponseSection

A response section that an agent can return to render a list.

Parameters:
  • items (List[str]) – The list items to be displayed.

  • section_key (str)

items: List[str]
class abacusai.api_class.segments.ChartResponseSection(chart, section_key=None)

Bases: ResponseSection

A response section that an agent can return to render a chart.

Parameters:
  • chart (dict) – The chart to be displayed.

  • section_key (str)

chart: dict
class abacusai.api_class.segments.DataframeResponseSection(df, header=None, section_key=None)

Bases: ResponseSection

A response section that an agent can return to render a pandas dataframe. :param df: The dataframe to be displayed. :type df: pandas.DataFrame :param header: Heading of the table to be displayed. :type header: str

Parameters:
  • df (Any)

  • header (str)

  • section_key (str)

df: Any
header: str