llm

package
v1.3.1 Latest Latest
Warning

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

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

Documentation

Overview

Package llm is the public SDK facade over Harbor's internal/llm package — the provider-corrected LLM client, the chat message vocabulary, and the artifact-stub content contract (RFC §3.6, §6.5; D-204). Alias-based re-exports only: no behavior lives here. Driver factories, wrapper-hook registration, posture surfaces, chunk publishing, and event payload structs are deliberately private.

Index

Constants

View Source
const (
	// PartText — a text part.
	PartText = internal.PartText
	// PartImage — an image part.
	PartImage = internal.PartImage
	// PartAudio — an audio part.
	PartAudio = internal.PartAudio
	// PartFile — a file part.
	PartFile = internal.PartFile
)

PartType values.

View Source
const (
	// RoleSystem — the system prompt role.
	RoleSystem = internal.RoleSystem
	// RoleUser — the user role.
	RoleUser = internal.RoleUser
	// RoleAssistant — the assistant role.
	RoleAssistant = internal.RoleAssistant
	// RoleTool — the tool-result role.
	RoleTool = internal.RoleTool
)

Role values.

View Source
const (
	// FormatText — plain text output.
	FormatText = internal.FormatText
	// FormatJSONObject — any-JSON-object output.
	FormatJSONObject = internal.FormatJSONObject
	// FormatJSONSchema — schema-constrained output.
	FormatJSONSchema = internal.FormatJSONSchema
)

ResponseFormatKind values.

View Source
const (
	// OutputModeUnset — resolve per model profile.
	OutputModeUnset = internal.OutputModeUnset
	// OutputModeNative — provider-native structured output.
	OutputModeNative = internal.OutputModeNative
	// OutputModeTools — structured output via a forced tool call.
	OutputModeTools = internal.OutputModeTools
	// OutputModePrompted — structured output via prompting.
	OutputModePrompted = internal.OutputModePrompted
)

OutputMode values.

View Source
const DefaultDriver = internal.DefaultDriver

DefaultDriver is the production LLM driver name.

Variables

View Source
var (
	// ErrUnknownDriver — the named LLM driver is not registered.
	ErrUnknownDriver = internal.ErrUnknownDriver
	// ErrClientClosed — the client has been closed.
	ErrClientClosed = internal.ErrClientClosed
	// ErrIdentityMissing — the call context carries no identity.
	ErrIdentityMissing = internal.ErrIdentityMissing
	// ErrInvalidContent — the message content is malformed.
	ErrInvalidContent = internal.ErrInvalidContent
	// ErrContextLeak — raw heavy content reached the LLM edge (D-026).
	ErrContextLeak = internal.ErrContextLeak
	// ErrContextWindowExceeded — the estimate breaches the window reserve.
	ErrContextWindowExceeded = internal.ErrContextWindowExceeded
	// ErrInvalidConfig — the LLM configuration is invalid.
	ErrInvalidConfig = internal.ErrInvalidConfig
	// ErrUnsupportedModel — the model has no configured ModelProfile.
	ErrUnsupportedModel = internal.ErrUnsupportedModel
	// ErrInvalidJSONSchema — the response failed schema validation.
	ErrInvalidJSONSchema = internal.ErrInvalidJSONSchema
	// ErrDowngradeExhausted — the structured-output downgrade chain ran out.
	ErrDowngradeExhausted = internal.ErrDowngradeExhausted
	// ErrRetryExhausted — the retry-with-feedback budget ran out.
	ErrRetryExhausted = internal.ErrRetryExhausted
	// ErrValidationFailed — the response validator rejected the output.
	ErrValidationFailed = internal.ErrValidationFailed
)

Re-exported sentinel errors callers compare via errors.Is.

Open resolves the configured driver and composes the production wrapper chain (corrections, downgrade, retry, governance) around it.

View Source
var RegisteredDrivers = internal.RegisteredDrivers

RegisteredDrivers lists the seated LLM driver names (blank-import sdk/drivers/prod to seat the production set).

View Source
var SnapshotFromConfig = internal.SnapshotFromConfig

SnapshotFromConfig projects the operator config blocks into the resolved ConfigSnapshot Open consumes.

Functions

This section is empty.

Types

type ArtifactStub

type ArtifactStub = internal.ArtifactStub

ArtifactStub replaces raw heavy content at the LLM edge (D-026).

type AudioPart

type AudioPart = internal.AudioPart

AudioPart is an audio content part.

type ChatMessage

type ChatMessage = internal.ChatMessage

ChatMessage is one role-tagged message.

type CompleteRequest

type CompleteRequest = internal.CompleteRequest

CompleteRequest is the canonical completion request.

type CompleteResponse

type CompleteResponse = internal.CompleteResponse

CompleteResponse is the canonical completion response.

type ConfigSnapshot

type ConfigSnapshot = internal.ConfigSnapshot

ConfigSnapshot is the resolved LLM configuration a client opens with.

type Content

type Content = internal.Content

Content is a message body (text or multimodal parts).

type ContentPart

type ContentPart = internal.ContentPart

ContentPart is one multimodal content part.

type Cost

type Cost = internal.Cost

Cost is the computed cost block of a response.

type Deps

type Deps = internal.Deps

Deps carries the shared dependencies llm.Open threads to drivers and wrapper layers (bus, artifact store, logger).

type FilePart

type FilePart = internal.FilePart

FilePart is a file content part.

type ImagePart

type ImagePart = internal.ImagePart

ImagePart is an image content part.

type LLMClient

type LLMClient = internal.LLMClient

LLMClient is the provider-corrected completion client interface.

type OutputMode

type OutputMode = internal.OutputMode

OutputMode selects the structured-output strategy.

type PartType

type PartType = internal.PartType

PartType discriminates ContentPart kinds.

type ResponseFormat

type ResponseFormat = internal.ResponseFormat

ResponseFormat requests text / JSON / schema-constrained output.

type ResponseFormatKind

type ResponseFormatKind = internal.ResponseFormatKind

ResponseFormatKind discriminates ResponseFormat.

type Role

type Role = internal.Role

Role tags a ChatMessage (system / user / assistant / tool).

type StubFetch

type StubFetch = internal.StubFetch

StubFetch resolves an ArtifactStub back to bytes on demand.

type ToolCallStructured

type ToolCallStructured = internal.ToolCallStructured

ToolCallStructured is one structured tool call in a response.

type ToolDeclaration

type ToolDeclaration = internal.ToolDeclaration

ToolDeclaration declares one tool to the provider.

type Usage

type Usage = internal.Usage

Usage is the token usage block of a response.

Jump to

Keyboard shortcuts

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