Expose prompt inspection through the engine

This commit is contained in:
2026-07-30 21:03:47 +00:00
parent 272b6a4bc1
commit e920168b30
5 changed files with 348 additions and 25 deletions

37
doc.go
View File

@@ -3,27 +3,27 @@
//
// Applications construct an [Engine] with [NewEngine], select filesystem or
// in-memory sources and optional engine-scoped [Backend] registrations, and
// call [Engine.InspectProfile], [Engine.Prepare], [Engine.PrepareExecution],
// [Engine.Run], or [Engine.RunPrepared]. Concrete registries, repositories,
// validators, and the built-in OpenAI-compatible client remain internal
// implementation details.
// call [Engine.InspectPrompt], [Engine.InspectProfile], [Engine.Prepare],
// [Engine.PrepareExecution], [Engine.Run], or [Engine.RunPrepared]. Concrete
// registries, repositories, validators, and the built-in OpenAI-compatible
// client remain internal implementation details.
//
// # Concurrency and ownership
//
// An Engine supports concurrent InspectProfile, Prepare, PrepareExecution, Run,
// and RunPrepared calls. Engine-local backend policies bound admitted Run and
// RunPrepared calls and model generations where configured, while different
// backend pools and unlimited backends continue independently. An injected
// [LLMClient] or [ArtifactReader] can therefore still receive concurrent calls
// and must be safe for that use.
// An Engine supports concurrent InspectPrompt, InspectProfile, Prepare,
// PrepareExecution, Run, and RunPrepared calls. Engine-local backend policies
// bound admitted Run and RunPrepared calls and model generations where
// configured, while different backend pools and unlimited backends continue
// independently. An injected [LLMClient] or [ArtifactReader] can therefore
// still receive concurrent calls and must be safe for that use.
//
// NewEngine copies in-memory profiles and backend definitions. Prepare,
// PrepareExecution, and Run copy request maps, slices, pointer values, and
// JSON-compatible extra parameters before using them. InspectProfile returns
// copied profile inspection values. Returned values and values passed to
// extension interfaces are likewise isolated from engine state. Callers own
// those copies and may mutate them after the call that supplied or returned
// them.
// JSON-compatible extra parameters before using them. InspectPrompt and
// InspectProfile return copied inspection values. Returned values and values
// passed to extension interfaces are likewise isolated from engine state.
// Callers own those copies and may mutate them after the call that supplied or
// returned them.
//
// # Security and sensitive data
//
@@ -51,9 +51,10 @@
//
// Construction, inspection, and handle values, including [Config], [Backend],
// [RunRequest], [ArtifactRef], [ExecutionTargetOverride], [Profile],
// [OpenAICompatibleProfileConfig], [ProfileInspection], and
// [PreparedExecution], do not have stable JSON representations. Direct API
// keys are nevertheless excluded from JSON for every public value.
// [OpenAICompatibleProfileConfig], [ProfileInspection],
// [PromptInputDefinition], [PromptInspection], and [PreparedExecution], do
// not have stable JSON representations. Direct API keys are nevertheless
// excluded from JSON for every public value.
//
// JSON timestamps use time.Time's RFC 3339 encoding and are omitted when zero.
// PreparedRun and RunResult durations are encoded as integer milliseconds in