aiq.agent.base#

Attributes#

log

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#
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 agent_node(state: pydantic.BaseModel) pydantic.BaseModel#
Async:

abstractmethod tool_node(state: pydantic.BaseModel) pydantic.BaseModel#
Async:

abstractmethod conditional_edge(state: pydantic.BaseModel) str#
Async:

async _build_graph(state) langgraph.graph.graph.CompiledGraph#