Agents 0.0.2
Edge AI Agents SDK
Loading...
Searching...
No Matches
agents::llms::GoogleLLM Class Reference

Implementation of LLMInterface for Google Gemini models. More...

#include <google_llm.h>

Inheritance diagram for agents::llms::GoogleLLM:
agents::LLMInterface

Public Member Functions

 GoogleLLM (const String &api_key="", const String &model="gemini-1.5-pro")
 Constructor.
 
 ~GoogleLLM () override=default
 Destructor.
 
std::vector< StringgetAvailableModels () override
 Get available models from Google.
 
void setModel (const String &model) override
 Set the model to use.
 
String getModel () const override
 Get current model.
 
void setApiKey (const String &api_key) override
 Set API key.
 
void setApiBase (const String &api_base) override
 Set API base URL (for self-hosted or proxied endpoints)
 
void setOptions (const LLMOptions &options) override
 Set options for API calls.
 
LLMOptions getOptions () const override
 Get current options.
 
LLMResponse complete (const String &prompt) override
 Generate completion from a prompt.
 
LLMResponse chat (const std::vector< Message > &messages) override
 Generate completion from a list of messages.
 
LLMResponse chatWithTools (const std::vector< Message > &messages, const std::vector< std::shared_ptr< Tool > > &tools) override
 Generate completion with available tools.
 
void streamChat (const std::vector< Message > &messages, std::function< void(const String &, bool)> callback) override
 Stream results with callback.
 
virtual LLMResponse complete (const std::vector< Message > &messages)
 Generate completion from a list of messages.
 
virtual LLMResponse completeWithTools (const std::vector< Message > &messages, const std::vector< JsonObject > &tools_schema)
 Generate completion with available tools.
 
virtual Task< LLMResponsecompleteAsync (const String &prompt)
 Async complete from a prompt.
 
virtual Task< LLMResponsecompleteAsync (const std::vector< Message > &messages)
 Async complete from a list of messages.
 
virtual Task< LLMResponsechatAsync (const std::vector< Message > &messages)
 Async chat from a list of messages.
 
virtual Task< LLMResponsechatWithToolsAsync (const std::vector< Message > &messages, const std::vector< std::shared_ptr< Tool > > &tools)
 Async chat with tools.
 
virtual AsyncGenerator< StringstreamChatAsync (const std::vector< Message > &messages)
 Stream chat with AsyncGenerator.
 

Detailed Description

Implementation of LLMInterface for Google Gemini models.

Constructor & Destructor Documentation

◆ GoogleLLM()

agents::llms::GoogleLLM::GoogleLLM ( const String & api_key = "",
const String & model = "gemini-1.5-pro" )

Constructor.

Parameters
api_keyThe API key
modelThe model to use

Member Function Documentation

◆ chat()

LLMResponse agents::llms::GoogleLLM::chat ( const std::vector< Message > & messages)
overridevirtual

Generate completion from a list of messages.

Parameters
messagesThe messages
Returns
The completion

Implements agents::LLMInterface.

◆ chatAsync()

virtual Task< LLMResponse > agents::LLMInterface::chatAsync ( const std::vector< Message > & messages)
virtualinherited

Async chat from a list of messages.

Parameters
messagesThe messages to generate completion from
Returns
The LLM response

◆ chatWithTools()

LLMResponse agents::llms::GoogleLLM::chatWithTools ( const std::vector< Message > & messages,
const std::vector< std::shared_ptr< Tool > > & tools )
overridevirtual

Generate completion with available tools.

Parameters
messagesThe messages
toolsThe tools
Returns
The completion

Implements agents::LLMInterface.

◆ chatWithToolsAsync()

virtual Task< LLMResponse > agents::LLMInterface::chatWithToolsAsync ( const std::vector< Message > & messages,
const std::vector< std::shared_ptr< Tool > > & tools )
virtualinherited

Async chat with tools.

Parameters
messagesThe messages to generate completion from
toolsThe tools to use
Returns
The LLM response

◆ complete() [1/2]

virtual LLMResponse agents::LLMInterface::complete ( const std::vector< Message > & messages)
virtualinherited

Generate completion from a list of messages.

Parameters
messagesThe messages to generate completion from
Returns
The LLM response

◆ complete() [2/2]

LLMResponse agents::llms::GoogleLLM::complete ( const String & prompt)
overridevirtual

Generate completion from a prompt.

Parameters
promptThe prompt
Returns
The completion

Reimplemented from agents::LLMInterface.

◆ completeAsync() [1/2]

virtual Task< LLMResponse > agents::LLMInterface::completeAsync ( const std::vector< Message > & messages)
virtualinherited

Async complete from a list of messages.

Parameters
messagesThe messages to generate completion from
Returns
The LLM response

◆ completeAsync() [2/2]

virtual Task< LLMResponse > agents::LLMInterface::completeAsync ( const String & prompt)
virtualinherited

Async complete from a prompt.

Parameters
promptThe prompt to generate completion from
Returns
The LLM response

◆ completeWithTools()

virtual LLMResponse agents::LLMInterface::completeWithTools ( const std::vector< Message > & messages,
const std::vector< JsonObject > & tools_schema )
virtualinherited

Generate completion with available tools.

Parameters
messagesThe messages to generate completion from
tools_schemaThe tools schema to use
Returns
The LLM response

◆ getAvailableModels()

std::vector< String > agents::llms::GoogleLLM::getAvailableModels ( )
overridevirtual

Get available models from Google.

Returns
The available models

Implements agents::LLMInterface.

◆ getModel()

String agents::llms::GoogleLLM::getModel ( ) const
overridevirtual

Get current model.

Returns
The current model

Implements agents::LLMInterface.

◆ getOptions()

LLMOptions agents::llms::GoogleLLM::getOptions ( ) const
overridevirtual

Get current options.

Returns
The current options

Implements agents::LLMInterface.

◆ setApiBase()

void agents::llms::GoogleLLM::setApiBase ( const String & api_base)
overridevirtual

Set API base URL (for self-hosted or proxied endpoints)

Parameters
api_baseThe API base URL

Implements agents::LLMInterface.

◆ setApiKey()

void agents::llms::GoogleLLM::setApiKey ( const String & api_key)
overridevirtual

Set API key.

Parameters
api_keyThe API key

Implements agents::LLMInterface.

◆ setModel()

void agents::llms::GoogleLLM::setModel ( const String & model)
overridevirtual

Set the model to use.

Parameters
modelThe model to use

Implements agents::LLMInterface.

◆ setOptions()

void agents::llms::GoogleLLM::setOptions ( const LLMOptions & options)
overridevirtual

Set options for API calls.

Parameters
optionsThe options

Implements agents::LLMInterface.

◆ streamChat()

void agents::llms::GoogleLLM::streamChat ( const std::vector< Message > & messages,
std::function< void(const String &, bool)> callback )
overridevirtual

Stream results with callback.

Parameters
messagesThe messages
callbackThe callback

Implements agents::LLMInterface.

◆ streamChatAsync()

virtual AsyncGenerator< String > agents::LLMInterface::streamChatAsync ( const std::vector< Message > & messages)
virtualinherited

Stream chat with AsyncGenerator.

Parameters
messagesThe messages to generate completion from
Returns
The AsyncGenerator