Agents 0.0.2
Edge AI Agents SDK
|
Context for an agent, containing tools, LLM, and memory. More...
#include <agent_context.h>
Public Member Functions | |
AgentContext () | |
Default constructor for AgentContext. | |
~AgentContext ()=default | |
Default destructor for AgentContext. | |
void | setLLM (std::shared_ptr< LLMInterface > llm) |
Set the LLM to use. | |
std::shared_ptr< LLMInterface > | getLLM () const |
Get the LLM. | |
void | setSystemPrompt (const String &system_prompt) |
Set the system prompt. | |
const String & | getSystemPrompt () const |
Get the system prompt. | |
void | registerTool (std::shared_ptr< Tool > tool) |
Register a tool. | |
std::shared_ptr< Tool > | getTool (const String &name) const |
Get a tool by name. | |
std::vector< std::shared_ptr< Tool > > | getTools () const |
Get all tools. | |
Task< ToolResult > | executeTool (const String &name, const JsonObject ¶ms) |
Execute a tool by name using coroutines. | |
std::shared_ptr< Memory > | getMemory () const |
Get the memory. | |
void | addMessage (const Message &message) |
Add a message to the conversation history. | |
std::vector< Message > | getMessages () const |
Get all messages in the conversation history. | |
Task< LLMResponse > | chat (const String &user_message) |
Run a chat completion with the current context using coroutines. | |
Task< LLMResponse > | chatWithTools (const String &user_message) |
Run a chat completion with tools using coroutines. | |
AsyncGenerator< String > | streamChat (const String &user_message) |
Stream chat results with AsyncGenerator. | |
Task< LLMResponse > | chatMultiModal (const String &user_message, const std::vector< String > &uris_or_data) |
Unified multimodal chat (accepts one or more media URIs or data strings) | |
AsyncGenerator< String > | streamChatMultiModal (const String user_message, const std::vector< String > uris_or_data) |
Unified multimodal streaming chat (accepts one or more media URIs or data strings) | |
Context for an agent, containing tools, LLM, and memory.
void agents::AgentContext::addMessage | ( | const Message & | message | ) |
Add a message to the conversation history.
message | The message to add |
Task< LLMResponse > agents::AgentContext::chat | ( | const String & | user_message | ) |
Run a chat completion with the current context using coroutines.
user_message | The user message to send |
Task< LLMResponse > agents::AgentContext::chatMultiModal | ( | const String & | user_message, |
const std::vector< String > & | uris_or_data ) |
Unified multimodal chat (accepts one or more media URIs or data strings)
user_message | The user message to send to the LLM |
uris_or_data | The URIs or data to use |
Task< LLMResponse > agents::AgentContext::chatWithTools | ( | const String & | user_message | ) |
Run a chat completion with tools using coroutines.
user_message | The user message to send |
Task< ToolResult > agents::AgentContext::executeTool | ( | const String & | name, |
const JsonObject & | params ) |
Execute a tool by name using coroutines.
name | The name of the tool to execute |
params | The parameters to pass to the tool |
std::shared_ptr< LLMInterface > agents::AgentContext::getLLM | ( | ) | const |
Get the LLM.
std::shared_ptr< Memory > agents::AgentContext::getMemory | ( | ) | const |
Get the memory.
std::vector< Message > agents::AgentContext::getMessages | ( | ) | const |
Get all messages in the conversation history.
const String & agents::AgentContext::getSystemPrompt | ( | ) | const |
Get the system prompt.
Get a tool by name.
name | The name of the tool to get |
std::vector< std::shared_ptr< Tool > > agents::AgentContext::getTools | ( | ) | const |
Get all tools.
void agents::AgentContext::registerTool | ( | std::shared_ptr< Tool > | tool | ) |
Register a tool.
tool | The tool to register |
void agents::AgentContext::setLLM | ( | std::shared_ptr< LLMInterface > | llm | ) |
Set the LLM to use.
llm | The LLM to use |
void agents::AgentContext::setSystemPrompt | ( | const String & | system_prompt | ) |
Set the system prompt.
system_prompt | The system prompt to use |
AsyncGenerator< String > agents::AgentContext::streamChat | ( | const String & | user_message | ) |
Stream chat results with AsyncGenerator.
user_message | The user message to send |
AsyncGenerator< String > agents::AgentContext::streamChatMultiModal | ( | const String | user_message, |
const std::vector< String > | uris_or_data ) |
Unified multimodal streaming chat (accepts one or more media URIs or data strings)
user_message | The user message to send to the LLM |
uris_or_data | The URIs or data to use |