llm

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 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
	// Heartbeat : chunk vide (ni texte, ni appels, Done faux) émis par le
	// fournisseur à la première activité du flux qui ne produit pas de
	// texte (deltas d'appels d'outils, événement sans contenu). Il prouve
	// que le flux vit : il arrête le délai du premier chunk du moteur, sans
	// compter comme une sortie (un repli reste possible). Le moteur l'ignore
	// pour l'affichage et l'historique.
	Heartbeat bool
	// Usage : consommation réelle de l'appel, portée par le chunk Done quand
	// le flux l'a fournie (nil sinon : le moteur estime).
	Usage *Usage
}

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"`
	// Remote : message d'assistant (ou résumé de compaction) produit par un
	// fournisseur non local. Jamais envoyé ni sérialisé ; le contrôle sortant
	// des marquages l'ignore (le fournisseur distant a déjà ce texte).
	Remote bool `json:"-"`
}

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"`
	// Qualifications déclarées (ex. "secnumcloud") ; jamais déduites.
	Qualifications []string `json:"qualifications,omitempty"`
	// NoStreamUsage : n'envoie pas stream_options.include_usage
	// (stream_usage = false). Jamais sérialisé.
	NoStreamUsage bool `json:"-"`
}

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.

type Usage added in v0.8.0

type Usage struct {
	Input, Output, Cached int
}

Usage : jetons réellement comptés par le fournisseur pour un appel. Cached est inclus dans Input.

Jump to

Keyboard shortcuts

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