Help us shape the future of Go! Take the 2026 Go Developer Survey

llm

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: EUPL-1.2 Imports: 1 Imported by: 0

Documentation

Overview

Package llm defines the provider-neutral types exchanged with LLM backends.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chunk

type Chunk struct {
	Text      string
	ToolCalls []ToolCall
	Done      bool
	Err       error
}

Chunk is one piece of a streamed provider response.

type Jurisdiction

type Jurisdiction string

Jurisdiction is the legal zone in which a provider processes data.

const (
	EU    Jurisdiction = "eu"
	NonEU Jurisdiction = "non-eu"
	Local Jurisdiction = "local"
)

type Message

type Message struct {
	Role       Role       `json:"role"`
	Content    string     `json:"content,omitempty"`
	ToolCalls  []ToolCall `json:"tool_calls,omitempty"`
	ToolCallID string     `json:"tool_call_id,omitempty"`
}

Message is one entry of a conversation.

type ProviderInfo

type ProviderInfo struct {
	ID           string       `json:"id"`
	Name         string       `json:"name"`
	BaseURL      string       `json:"base_url"`
	Model        string       `json:"model"`
	Country      string       `json:"country"`
	Jurisdiction Jurisdiction `json:"jurisdiction"`
}

ProviderInfo describes a configured LLM provider.

type Request

type Request struct {
	Model    string
	Messages []Message
	Tools    []ToolDef
}

Request is a completion request sent to a provider.

type Role

type Role string

Role identifies the author of a message.

const (
	System    Role = "system"
	User      Role = "user"
	Assistant Role = "assistant"
	Tool      Role = "tool"
)

type ToolCall

type ToolCall struct {
	ID   string          `json:"id"`
	Name string          `json:"name"`
	Args json.RawMessage `json:"args"`
}

ToolCall is a model request to run a tool.

type ToolDef

type ToolDef struct {
	Name        string
	Description string
	Schema      json.RawMessage
}

ToolDef describes a tool offered to the model.

Jump to

Keyboard shortcuts

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