Cut modules over to Scriptorium prompts
This commit is contained in:
@@ -2,9 +2,8 @@
|
||||
|
||||
The implemented LLM runtime lives in `internal/framework/llm`. It provides
|
||||
transport-neutral structured completion contracts, a Scriptorium-backed
|
||||
production client, an OpenAI-compatible HTTP adapter retained for legacy tests
|
||||
and helpers, concurrency scheduling, prompt/schema asset registration, schema
|
||||
registry helpers, and secret redaction.
|
||||
production client, concurrency scheduling, prompt/schema asset registration,
|
||||
schema registry helpers, and secret redaction.
|
||||
|
||||
## Contract
|
||||
|
||||
@@ -15,9 +14,8 @@ CompleteStructured(ctx, request, out) (response, error)
|
||||
```
|
||||
|
||||
The request contains prompt ID/version, profile ID, session ID, prompt input
|
||||
materials, variables, and legacy rendered-message/schema fields used by modules
|
||||
that have not yet moved to prompt-asset execution. The caller supplies a pointer
|
||||
target for decoded structured output.
|
||||
materials, and variables. The caller supplies a pointer target for decoded
|
||||
structured output.
|
||||
|
||||
Modules that call the LLM own their prompts, schemas, prompt IDs, validators,
|
||||
and domain-specific interpretation. Provider adapters should not contain
|
||||
@@ -57,48 +55,6 @@ Generated-output validation failures are returned as Notarius errors. Provider
|
||||
and runtime errors are wrapped with prompt context and bearer tokens are
|
||||
redacted from error strings.
|
||||
|
||||
## OpenAI-Compatible Adapter
|
||||
|
||||
`OpenAICompatibleClient` posts JSON to:
|
||||
|
||||
```text
|
||||
<base_url>/chat/completions
|
||||
```
|
||||
|
||||
It sends:
|
||||
|
||||
- `model`
|
||||
- `messages`
|
||||
- `response_format.type = "json_schema"`
|
||||
- `response_format.json_schema.name`
|
||||
- `response_format.json_schema.strict = true`
|
||||
- `response_format.json_schema.schema`
|
||||
|
||||
If an API key is configured, the adapter sends an `Authorization: Bearer ...`
|
||||
header.
|
||||
|
||||
The adapter accepts assistant content either as a JSON string containing JSON or
|
||||
as raw JSON content. It then unmarshals that content into the caller-provided
|
||||
target.
|
||||
|
||||
External wire-contract details belong in the
|
||||
[OpenAI-compatible integration doc](../integrations/openai-compatible.md).
|
||||
|
||||
## Retries And Timeouts
|
||||
|
||||
The adapter retries:
|
||||
|
||||
- provider request failures;
|
||||
- response read failures;
|
||||
- HTTP `429`;
|
||||
- HTTP `5xx`;
|
||||
- malformed provider envelopes;
|
||||
- malformed assistant JSON;
|
||||
- structured-output decode failures.
|
||||
|
||||
Non-retryable `4xx` responses are returned without retry. Context cancellation
|
||||
is respected.
|
||||
|
||||
## Scheduler
|
||||
|
||||
`Scheduler` bounds concurrent provider calls. It tracks in-flight calls and a
|
||||
|
||||
@@ -36,11 +36,9 @@ normalizer targets. Runtime delivery uses `contracts.ChunkRequest.References`,
|
||||
`contracts.ExtractionRequest.References`, and
|
||||
`contracts.NormalizeRequest.References`. Reference material is not source
|
||||
evidence and must not be converted into `SourceRef` values. If a module prompt
|
||||
uses references, load the prompt bundle with the same declared slots and render
|
||||
with `RenderUserSystemWithReferences`. Prompt templates may use the `reference`
|
||||
function for content and the `hasreference` function for conditional sections.
|
||||
Prompt metadata hashes remain based on template source, not rendered reference
|
||||
bytes.
|
||||
uses references, pass them as prompt input materials through the structured LLM
|
||||
request. Prompt metadata hashes remain based on prompt asset source, not
|
||||
rendered reference bytes.
|
||||
|
||||
Chunk modules receive the structured LLM client through `contracts.ChunkRequest`
|
||||
when they need model-backed chunking. The pipeline runner validates generic
|
||||
|
||||
@@ -42,9 +42,8 @@ production modules.
|
||||
resolution, capability checks, run orchestration, warnings, validation, and
|
||||
manifest population.
|
||||
- `internal/framework/llm`: Scriptorium-backed structured-output client,
|
||||
prompt/schema asset registry, scheduler, schema registry, retries, and secret
|
||||
prompt/schema asset registry, scheduler, schema registry, and secret
|
||||
redaction.
|
||||
- `internal/framework/prompt`: embedded prompt registry and template rendering.
|
||||
- `internal/framework/validate`: validator decision helpers and cardinality
|
||||
enforcement.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user