llmprovider

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package llmprovider exposes a single Provider interface that every LLM backend in the project must satisfy. It ships a factory (New) that picks the right Eino model implementation for each supported provider type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatModelProvider

type ChatModelProvider interface {
	Provider
	// ChatModel returns the underlying Eino BaseChatModel.
	ChatModel() model.BaseChatModel
}

ChatModelProvider extends Provider with access to the underlying Eino ChatModel for use with ChatModelAgent.

func New

func New(cfg Config) (ChatModelProvider, error)

New builds the appropriate Provider for cfg.ProviderType.

type Config

type Config struct {
	ProviderType string
	ProviderName string // name of the provider config entry; used by openai-codex to find its pool
	ModelName    string
	BaseURL      string  // required for llamacpp / ollama; ignored for cloud providers
	APIKey       string  // optional for local providers
	Temperature  float64 // 0 means the backend default
	MaxTokens    int     // 0 means the backend default
	MaxRetries   int
	Timeout      time.Duration
	CodexManager *codexauth.Manager // required for openai-codex provider type
}

Config groups every knob the callers need to set.

type Provider

type Provider interface {
	// Generate sends prompt to the model and returns the raw text response.
	Generate(ctx context.Context, prompt string) (string, error)
}

Provider is the minimal interface every LLM backend must satisfy.

Jump to

Keyboard shortcuts

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