factory

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package factory constructs llm.Model instances for the supported providers. main.go uses this package; all other packages depend only on llm.Model.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, provider, modelName, apiKey, baseURL string) (llm.Model, error)

New constructs a Model for the given provider, model name, and API key. baseURL overrides the provider's default API endpoint; pass an empty string to use the official endpoint. This is only honoured by the OpenAI provider, allowing callers to target OpenAI-compatible services (e.g. Ollama). The returned model automatically retries transient errors with exponential back-off using llm.DefaultRetryAttempts and llm.DefaultRetryBaseDelay.

Types

type Provider

type Provider string

Provider identifies a supported LLM provider.

const (
	ProviderAnthropic Provider = "anthropic"
	ProviderGoogle    Provider = "google"
	ProviderOpenAI    Provider = "openai"
)

Jump to

Keyboard shortcuts

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