aiq.agent.base#

Attributes#

Classes#

AgentDecision

Create a collection of name/value pairs.

BaseAgent

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

Module Contents#

log#
TOOL_NOT_FOUND_ERROR_MESSAGE = 'There is no tool named {tool_name}. Tool must be one of {tools}.'#
INPUT_SCHEMA_MESSAGE = '. Arguments must be provided as a valid JSON object following this format: {schema}'#
NO_INPUT_ERROR_MESSAGE = 'No human input recieved to the agent, Please ask a valid question.'#
AGENT_LOG_PREFIX = '[AGENT]'#
AGENT_RESPONSE_LOG_MESSAGE#
TOOL_RESPONSE_LOG_MESSAGE#
class AgentDecision(*args, **kwds)#

Bases: enum.Enum

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

    >>> Color.RED
    <Color.RED: 1>
    
  • value lookup:

    >>> Color(1)
    <Color.RED: 1>
    
  • name lookup:

    >>> Color['RED']
    <Color.RED: 1>
    

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

TOOL = 'tool'#
END = 'finished'#
class BaseAgent(
llm: langchain_core.language_models.BaseChatModel,
tools: list[langchain_core.tools.BaseTool],
callbacks: list[langchain_core.callbacks.AsyncCallbackHandler] = None,
detailed_logs: bool = False,
)#

Bases: abc.ABC

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

llm#
tools#
callbacks = []#
detailed_logs = False#
graph = None#
abstractmethod _build_graph(state_schema) langgraph.graph.graph.CompiledGraph#
Async: