models

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package models is the adapter layer between core-agent's configuration and concrete LLM backends. The Provider interface keeps the rest of the codebase free of provider-specific imports so additional backends plug in behind the same contract.

Built-in providers:

  • "gemini" / "vertex" — google.golang.org/adk/model/gemini
  • "anthropic" — Claude via github.com/anthropics/anthropic-sdk-go

Each backend's package init() calls Register so importing the subpackage is enough to make the provider available.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, c Constructor)

Register installs a Constructor under its provider name. Idiomatically called from package init() in each backend implementation.

Types

type Constructor

type Constructor func(*config.Config) (Provider, error)

Constructor builds a Provider from validated config. Tests register alternates via Register so resolution stays decoupled from the imports of any single backend.

type Provider

type Provider interface {
	// Name reports the provider identity ("gemini", "vertex", "anthropic").
	// Used for telemetry and diagnostic messages.
	Name() string

	// Model returns a usable model.LLM for the given model ID. The same
	// Provider may be asked for several models over its lifetime.
	Model(ctx context.Context, modelID string) (model.LLM, error)
}

Provider constructs concrete model.LLM instances on demand. A Provider is bound to one credential source (API key, Vertex project, etc.) at construction time; callers ask for specific models by ID through Model.

func Resolve

func Resolve(cfg *config.Config) (Provider, error)

Resolve picks the right Provider for cfg, honoring (in order): explicit cfg.Model.Provider, then env-based auto-detection. Returns a clear error when no path is viable so the user knows which env var or config field to set.

Directories

Path Synopsis
Package anthropic implements models.Provider for Anthropic / Claude.
Package anthropic implements models.Provider for Anthropic / Claude.
Package gemini implements models.Provider for the Gemini family, covering both the public Gemini API (API-key auth) and Vertex AI (Application Default Credentials + GCP project).
Package gemini implements models.Provider for the Gemini family, covering both the public Gemini API (API-key auth) and Vertex AI (Application Default Credentials + GCP project).
Package mock ships two credential-free LLM providers and a recording wrapper that pair for offline testing of agent flows:
Package mock ships two credential-free LLM providers and a recording wrapper that pair for offline testing of agent flows:

Jump to

Keyboard shortcuts

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