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
- Variables
- type ArtifactStub
- type AudioPart
- type ChatMessage
- type CompleteRequest
- type CompleteResponse
- type ConfigSnapshot
- type Content
- type ContentPart
- type Cost
- type Deps
- type FilePart
- type ImagePart
- type LLMClient
- type OutputMode
- type PartType
- type ResponseFormat
- type ResponseFormatKind
- type Role
- type StubFetch
- type ToolCallStructured
- type ToolDeclaration
- type Usage
Constants ¶
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.
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.
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.
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.
const DefaultDriver = internal.DefaultDriver
DefaultDriver is the production LLM driver name.
Variables ¶
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.
var Open = internal.Open
Open resolves the configured driver and composes the production wrapper chain (corrections, downgrade, retry, governance) around it.
var RegisteredDrivers = internal.RegisteredDrivers
RegisteredDrivers lists the seated LLM driver names (blank-import sdk/drivers/prod to seat the production set).
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 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 ContentPart ¶
type ContentPart = internal.ContentPart
ContentPart is one multimodal content part.
type Deps ¶
Deps carries the shared dependencies llm.Open threads to drivers and wrapper layers (bus, artifact store, logger).
type OutputMode ¶
type OutputMode = internal.OutputMode
OutputMode selects the structured-output strategy.
type ResponseFormat ¶
type ResponseFormat = internal.ResponseFormat
ResponseFormat requests text / JSON / schema-constrained output.
type ResponseFormatKind ¶
type ResponseFormatKind = internal.ResponseFormatKind
ResponseFormatKind discriminates ResponseFormat.
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.