Framework Reference ​
Enumerations ​
Enumeration | Description |
---|---|
MessageRole | Role of a message |
ModelType | Available model types |
Classes ​
Class | Description |
---|---|
BaseAgent | BaseAgent is the base class for all agents. It implements the basic agent lifecycle and convenience functions. It also implements thread management. This class is not directly usable and will throw unimplemented. To implement a custom agent, extend this class (see initialize , finalize and step methods). |
Client | OpenAI Client wrapper |
ClientMux | ClientMux is a multiplexer for clients of multiple OpenAI models. |
FunctionTool | Tool is a spicy function that can describe itself with OpenAI compatible JSON schema. |
Interaction | Interaction is a single interaction in a conversation. An interaction is a pair of messages, one from us to OpenAI and one from OpenAI to us. The messages can be either text or tool calls or responses to tool calls. Interactions are chained together to form a thread in a form of linked list. An Interaction can be complete or incomplete. An interaction is complete if we have received a response from OpenAI completing the interaction. This means that if the last message in the interaction is from us, the interaction is not complete. |
Ledger | Ledger tracks LLM invocations and associated token counts and costs |
OneShotAgent | BaseAgent is the base class for all agents. It implements the basic agent lifecycle and convenience functions. It also implements thread management. This class is not directly usable and will throw unimplemented. To implement a custom agent, extend this class (see initialize , finalize and step methods). |
PCT | PCT stands for prompt, completion and total quantities |
ReactiveAgent | ReactiveAgent is a base class for agents that are defined in terms of reactions to structured messages. |
Session | Session is the main bus for information exchange between threads and agents. It also tallies the costs and manages the LLM invocations using supplied clients. |
Thread | Thread is a single thread of conversation. In practice Thread just points to the last interaction in the thread. Threads are only partially mutable, meaning that appending messages to a thread creates a new thread if the last interaction tn the thread is complete. |
Timing | Timing holds start and end time. |
Interfaces ​
Interface | Description |
---|---|
AgentEvents | Agent events |
AgentOptions | Basic options for an agent |
ChildOf | - |
Conclusible | Conclusible must be implemented by classes that can be concluded |
Identified | Identified must be implemented by classes containing Metadata |
ImageContentPart | - |
ImageEmbed | - |
ImageUserContent | - |
LedgerEntry | LedgerEntry represents a single LLM invocation |
LedgerEvents | Events emitted by the Ledger |
LoggerProvider | - |
Message | Message sent in a conversation |
Metadata | Metadata is used to identify an object in the system and keep track of object hierarchy. It is useful for logging, debugging and building object hierarchies. |
ModelPricing | Describes model pricing and limits |
ParentOf | - |
Reaction | - |
SessionEvents | Session events |
SessionOptions | SessionOptions is used to create a new session |
SessionReport | SessionReport is a report of the costs of the session and the performance of the models used. |
TextAssistantContent | - |
TextContentPart | - |
TextUserContent | - |
Tool | - |
ToolAssistantContent | - |
ToolCall | ToolCall is a call to a tool |
ToolResult | ToolResult is a result of a tool call |
ToolUserContent | - |
Toolable | Toolable is a mixin for agent classes that can be used as tools. |
Type Aliases ​
Type alias | Description |
---|---|
Agent | Agent is the interface for all agents |
AssistantContent | - |
Constructor | - |
ContentPart | - |
ID | Used to identify objects |
LogID | - |
LoggerFunction | - |
ModelInvocationOptions | - |
ToolLike | - |
ToolSpec | - |
UserContent | - |
Variables ​
Variable | Description |
---|---|
availableModels | List of available models |
pricing | Pricing and limits for each model |
Functions ​
Function | Description |
---|---|
assert | Asserts that a condition is true, otherwise throws an AssertionError. |
countTokens | Counts the number of tokens in a string |
delay | Waits for given number of milliseconds |
getToolInterface | Get the tool interface of a toolable. |
isTool | Decorator for agent classes that can be used as tools. |
jsonSchema | - |
meta | Constructs new Metadata and starts its timing. |
otherwise | Decorator for defining the default reaction to unstructured messages. |
parseDuration | Use to parse time durations coming in from OpenAI in headers |
parseMultipleObjects | - |
text | - |
toTool | Convert a toolable to a tool. |
uniqueID | Generates a unique ID with a prefix |
when | Decorator for defining reactions to structured messages. |