llmclient

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 10 Imported by: 0

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

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) Close

func (r *LLMRouter) Close() error

Close closes all underlying LLM clients.

func (*LLMRouter) Generate

func (r *LLMRouter) Generate(ctx context.Context, req schemas.GenerationRequest) (string, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL