Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient(ctx context.Context, cfg config.AgentConfig, logger *zap.Logger) (schemas.LLMClient, error)
NewClient is the main factory function. It initializes the LLM Router and its underlying clients based on the configuration. It requires a context, typically the application's startup context.
Types ¶
type GoogleClient ¶
type GoogleClient struct {
// contains filtered or unexported fields
}
GoogleClient implements the schemas.LLMClient interface for Google Gemini APIs using the unified SDK (google.golang.org/genai).
func NewGoogleClient ¶
func NewGoogleClient(ctx context.Context, cfg config.LLMModelConfig, logger *zap.Logger) (*GoogleClient, error)
NewGoogleClient initializes the client for the Gemini API using the new unified Go SDK.
func (*GoogleClient) Close ¶
func (c *GoogleClient) Close() error
Close cleans up the underlying client resources.
func (*GoogleClient) Generate ¶
func (c *GoogleClient) Generate(ctx context.Context, req schemas.GenerationRequest) (string, error)
Generate sends a structured request to the Gemini API using the SDK and returns the generated content.
type LLMRouter ¶
type LLMRouter struct {
// contains filtered or unexported fields
}
LLMRouter implements the LLMClient interface and routes requests.
func NewLLMRouter ¶
func NewLLMRouter(logger *zap.Logger, fastClient, powerfulClient schemas.LLMClient) (*LLMRouter, error)
NewLLMRouter creates a new router with the specified clients for each tier.
func (*LLMRouter) Generate ¶
Generate is now the public-facing method that satisfies the LLMClient interface.
func (*LLMRouter) GenerateResponse ¶
func (r *LLMRouter) GenerateResponse(ctx context.Context, req schemas.GenerationRequest) (string, error)
GenerateResponse selects the appropriate client based on the request's Tier.