provider

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package provider defines Alaska's LLM provider abstraction. Concrete providers (Anthropic, OpenAI, OpenAI-compatible) live in subpackages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatRequest

type ChatRequest struct {
	Model       string
	System      string
	Messages    []Message
	MaxTokens   int
	Temperature float64
	// ReasoningEffort maps to OpenAI's `reasoning_effort` ("minimal"/"low"/
	// "medium"/"high") for o-series, gpt-5 and proxies that honour it.
	// Empty string means "don't send the field".
	ReasoningEffort string
}

type Message

type Message struct {
	Role    Role
	Content string
}

type ModelInfo

type ModelInfo struct {
	ID          string
	DisplayName string
	Note        string
}

ModelCatalog is a curated list of models known to work with each provider type. Used by `/model` (interactive picker) and `alaska provider models`. Custom providers of type "openai" with a base_url get no default catalog — users list models via `alaska provider models <name>` which hits the remote /models endpoint.

func KnownModels

func KnownModels(providerType string) []ModelInfo

KnownModels returns a static catalog for a provider type. Empty slice means "no known catalog — discover at runtime or let the user type the id".

type Provider

type Provider interface {
	Name() string
	Stream(ctx context.Context, req ChatRequest) (<-chan StreamChunk, error)
}

type Role

type Role string
const (
	RoleUser      Role = "user"
	RoleAssistant Role = "assistant"
)

type StreamChunk

type StreamChunk struct {
	Delta string
	Err   error
}

StreamChunk carries one piece of the provider's streaming response. Exactly one of Delta or Err is populated per chunk.

Directories

Path Synopsis
Package anthropic implements the provider.Provider interface on top of the official anthropics/anthropic-sdk-go client.
Package anthropic implements the provider.Provider interface on top of the official anthropics/anthropic-sdk-go client.
Package factory constructs a provider.Provider from a config entry + OS keyring.
Package factory constructs a provider.Provider from a config entry + OS keyring.
Package openai implements the provider.Provider interface on top of the official openai/openai-go client.
Package openai implements the provider.Provider interface on top of the official openai/openai-go client.

Jump to

Keyboard shortcuts

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