llm

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorWithSecretsRedacted

func ErrorWithSecretsRedacted(err error, secrets []string) error

ErrorWithSecretsRedacted returns an error with known secret values removed from its message.

func HashAssets added in v0.2.0

func HashAssets(parts []AssetHashPart) (string, error)

func NewScheduledClient

func NewScheduledClient(client contracts.StructuredLLMClient, scheduler *Scheduler) contracts.StructuredLLMClient

func PromptKitLocalBackendOption added in v0.2.0

func PromptKitLocalBackendOption(cfg PromptKitLocalBackendConfig) promptkit.Option

func RedactSecrets

func RedactSecrets(message string, secrets []string) string

RedactSecrets replaces configured secret values in diagnostics.

Types

type AssetHashPart added in v0.2.0

type AssetHashPart struct {
	FS   fs.FS
	Path string
}

type AssetRegistry added in v0.2.0

type AssetRegistry struct {
	// contains filtered or unexported fields
}

func NewAssetRegistry added in v0.2.0

func NewAssetRegistry() *AssetRegistry

func (*AssetRegistry) FallbackProfileDigest added in v0.2.0

func (r *AssetRegistry) FallbackProfileDigest() (string, error)

FallbackProfileDigest returns a deterministic, non-secret identity for the flattened fallback profile assets.

func (*AssetRegistry) FallbackProfileFS added in v0.2.0

func (r *AssetRegistry) FallbackProfileFS() (fs.FS, error)

func (*AssetRegistry) PromptFS added in v0.2.0

func (r *AssetRegistry) PromptFS() (fs.FS, error)

func (*AssetRegistry) PromptKitOptions added in v0.2.0

func (r *AssetRegistry) PromptKitOptions() ([]promptkit.Option, error)

func (*AssetRegistry) RegisterFallbackProfileFS added in v0.2.0

func (r *AssetRegistry) RegisterFallbackProfileFS(fsys fs.FS, root string) error

RegisterFallbackProfileFS registers profile assets that PromptKit uses only when an operator-configured source does not provide a matching profile.

func (*AssetRegistry) RegisterPromptFS added in v0.2.0

func (r *AssetRegistry) RegisterPromptFS(fsys fs.FS, root string) error

func (*AssetRegistry) RegisterSchemaFS added in v0.2.0

func (r *AssetRegistry) RegisterSchemaFS(fsys fs.FS, root string) error

func (*AssetRegistry) SchemaFS added in v0.2.0

func (r *AssetRegistry) SchemaFS() (fs.FS, error)

type AssetSource added in v0.2.0

type AssetSource struct {
	FS   fs.FS
	Root string
}

type CheckpointFingerprint added in v0.2.0

type CheckpointFingerprint struct {
	Name  string
	Value string
}

CheckpointFingerprint is a stable, non-secret semantic identity contributed by the LLM runtime before pipeline execution.

type CheckpointFingerprintProvider added in v0.2.0

type CheckpointFingerprintProvider interface {
	LLMCheckpointFingerprints() ([]CheckpointFingerprint, error)
}

CheckpointFingerprintProvider exposes LLM-runtime identities that must participate in checkpoint composition.

type LLMProfileRecorder added in v0.2.0

type LLMProfileRecorder struct {
	// contains filtered or unexported fields
}

func NewLLMProfileRecorder added in v0.2.0

func NewLLMProfileRecorder() *LLMProfileRecorder

func (*LLMProfileRecorder) Manifests added in v0.2.0

func (*LLMProfileRecorder) Record added in v0.2.0

func (r *LLMProfileRecorder) Record(profile artifacts.LLMProfileManifest)

type PromptKitClient added in v0.2.0

type PromptKitClient struct {
	// contains filtered or unexported fields
}

func NewPromptKitClient added in v0.2.0

func NewPromptKitClient(cfg PromptKitClientConfig) (*PromptKitClient, error)

func (*PromptKitClient) CompleteStructured added in v0.2.0

func (*PromptKitClient) LLMCheckpointFingerprints added in v0.2.0

func (c *PromptKitClient) LLMCheckpointFingerprints() ([]CheckpointFingerprint, error)

func (*PromptKitClient) LLMProfileManifests added in v0.2.0

func (c *PromptKitClient) LLMProfileManifests() []artifacts.LLMProfileManifest

type PromptKitClientConfig added in v0.2.0

type PromptKitClientConfig struct {
	ProfileDir       string
	ProfileFile      string
	TransientRetries *int
	LocalBackend     *PromptKitLocalBackendConfig
	Assets           *AssetRegistry
	Timeout          time.Duration
	HTTPClient       *http.Client
	EngineOptions    []promptkit.Option
	Recorder         *LLMProfileRecorder
	ReasoningEffort  *string
}

type PromptKitLocalBackendConfig added in v0.2.0

type PromptKitLocalBackendConfig struct {
	Endpoint         string
	ConcurrencyLimit int
}

type PromptKitProfileInspection added in v0.2.0

type PromptKitProfileInspection struct {
	ProfileID             string
	BackendID             string
	Model                 string
	CredentialEnvironment string
	CredentialRequired    bool
}

type PromptKitProfileInspectionError added in v0.2.0

type PromptKitProfileInspectionError struct {
	ProfileID string
	// contains filtered or unexported fields
}

func (*PromptKitProfileInspectionError) Error added in v0.2.0

func (*PromptKitProfileInspectionError) Unwrap added in v0.2.0

type PromptKitProfileInspector added in v0.2.0

type PromptKitProfileInspector struct {
	// contains filtered or unexported fields
}

func NewPromptKitProfileInspector added in v0.2.0

func NewPromptKitProfileInspector(cfg PromptKitProfileInspectorConfig) (*PromptKitProfileInspector, error)

func (*PromptKitProfileInspector) InspectProfile added in v0.2.0

func (i *PromptKitProfileInspector) InspectProfile(ctx context.Context, profileID string) (PromptKitProfileInspection, error)

type PromptKitProfileInspectorConfig added in v0.2.0

type PromptKitProfileInspectorConfig struct {
	Source PromptKitProfileSourceConfig
	Assets *AssetRegistry
}

type PromptKitProfileSourceConfig added in v0.2.0

type PromptKitProfileSourceConfig struct {
	ProfileDir   string
	ProfileFile  string
	LocalBackend *PromptKitLocalBackendConfig
}

type ResponseSchema

type ResponseSchema struct {
	Key        ResponseSchemaKey `json:"key"`
	ID         string            `json:"id"`
	Version    string            `json:"version"`
	Name       string            `json:"name"`
	JSONSchema json.RawMessage   `json:"json_schema"`
	SHA256     string            `json:"sha256"`
}

ResponseSchema describes one registered structured response schema.

func LoadResponseSchema

func LoadResponseSchema(fsys fs.FS, def ResponseSchemaDefinition) (ResponseSchema, error)

LoadResponseSchema loads a structured response schema from a caller-owned filesystem.

func LookupResponseSchema

func LookupResponseSchema(key ResponseSchemaKey) (ResponseSchema, bool)

LookupResponseSchema returns a copy of the schema for key.

func MustLookupResponseSchema

func MustLookupResponseSchema(key ResponseSchemaKey) ResponseSchema

MustLookupResponseSchema returns a copy of the schema for key and panics when missing.

func RegisteredResponseSchemas

func RegisteredResponseSchemas() []ResponseSchema

RegisteredResponseSchemas returns all registered response schemas sorted by key.

func (ResponseSchema) DiagnosticsMap

func (s ResponseSchema) DiagnosticsMap() map[string]any

DiagnosticsMap returns schema metadata without raw schema content.

type ResponseSchemaDefinition

type ResponseSchemaDefinition struct {
	Key       ResponseSchemaKey
	ID        string
	Version   string
	Name      string
	AssetPath string
}

ResponseSchemaDefinition identifies a caller-owned structured response schema asset.

type ResponseSchemaKey

type ResponseSchemaKey string

ResponseSchemaKey identifies one structured response schema.

const (
	TestArtifactSchemaKey          ResponseSchemaKey = "test_artifact"
	TestValidatorDecisionSchemaKey ResponseSchemaKey = "test_validator_decision"
)

type Scheduler

type Scheduler struct {
	// contains filtered or unexported fields
}

Scheduler bounds concurrent LLM backend calls.

func NewScheduler

func NewScheduler(maxConcurrency int) (*Scheduler, error)

NewScheduler creates a scheduler with a fixed concurrency limit.

func (*Scheduler) Acquire

func (s *Scheduler) Acquire(ctx context.Context) (func(), error)

Acquire blocks until a permit is available or the context is canceled. The returned release function is safe to call multiple times.

func (*Scheduler) Run

func (s *Scheduler) Run(ctx context.Context, fn func(context.Context) error) error

Run acquires a permit, executes fn, and releases the permit.

Jump to

Keyboard shortcuts

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