Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.
feature/Verdict-natives · L-260919-406599 (#1324)
Louis Choquel1deef1471638
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 71b74a297..03fd88197 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,12 +10,14 @@### Changed-- **`mthds` version, MTHDS protocol 0.7.0**: the pin moves to `mthds==0.18.0`, the release that carries protocol 0.7.0, whose model list adds the `judgment` category beside `llm`, `extract`, `img_gen` and `search`, so the runner and `GET /v1/version` report `protocol_version` `0.7.0`. `PipelexModelDeck` inherits the release's open `ModelInfo.type`, typed `ModelCategory | str | None`, though pipelex itself only ever emits a protocol category; everyone downstream inherits that exact `mthds`.+- **`mthds` version, MTHDS protocol 0.7.0 and standard 3.0.0 (Breaking)**: the pin moves to `mthds==0.19.0`, which carries protocol 0.7.0, whose model list adds the `judgment` category beside `llm`, `extract`, `img_gen` and `search`, so the runner and `GET /v1/version` report `protocol_version` `0.7.0`, and which implements MTHDS standard 3.0.0. A crate pipelex normalizes is stamped `mthds_version` `3.0.0`, and a `METHODS.toml` declaring `mthds_version = "^2.0.0"` now warns that the engine does not satisfy it. `PipelexModelDeck` inherits the release's open `ModelInfo.type`, typed `ModelCategory | str | None`, though pipelex itself only ever emits a protocol category; everyone downstream inherits that exact `mthds`.+- **The native concepts are pinned at MTHDS 3.0.0: `YesNo` gains a probability, and `Choice` and `Rating` are added (Breaking)**: `YesNo` carries an optional `probability`, which a `PipeLLM` whose output is `YesNo` may fill with the model's own estimate; `Choice` (an option key, with optional `confidence` and `probabilities`) and `Rating` (a level index, with optional `confidence`, `probabilities` and `position`) are new natives, so a bundle declaring a concept named `Choice` or `Rating` must rename it. A `YesNo` written to the wire carries `"probability": null` when none was reported, the output-form descriptor states a `YesNo` result as an object carrying `yes_no` and `probability` while an input stays a bare boolean, and a crate's normalized fingerprint changes wherever it materializes `YesNo`. Python callers read the new verdicts with `main_stuff_as_choice` and `main_stuff_as_rating`. Every measure is a strict number, so a boolean or a numeric string is refused rather than read as `1.0` or `0.9`; and a `PipeDocGen` office template or auto-layout sees a verdict as its verdict alone, while a `pdf` template reads it whole.- **The method-app template and the SDK references link `Pipelex/pipelex-sdk`**: the SDKs and the method-app templates now live in the `Pipelex/pipelex-sdk` repository, so the README and the documentation's **Quick Start** link the method-app template to its `method-apps/` directory, the webapp's by-hand commands clone it and copy `method-apps/webapp-js/`, and the `@pipelex/sdk` and `pipelex-sdk` references point at its `js/docs/` and `python/docs/` directories.- **Boot builds the secrets provider before the log sink, and a sink factory receives it (Breaking)**: a `LogSinkFactoryFn` is now called as `factory(log_config, secrets_provider=…)`, and the plugin API version moves to 5, so a plugin declaring `targets_api = 4` is refused at discovery and is rebuilt against this release. A secrets provider that fails to build now reports on stderr, redacted, rather than through the configured sink.### Fixed+- **A bare value is refused where it reads as a concept the input does not accept (Breaking)**: an input declared as a container native (`Html`, `Page`, `TextAndImages`, `SearchResult`, `Composite`), as `Choice` or `Rating`, or as a concept refining one, built a bare string as a `native.Text` and handed that text on, so the step reading the input met a text where it declared another concept. The value is now refused with `StructureValidationError` naming the concept it read as; send it in its `{concept, content}` envelope. The concept's own content sent without that envelope, such as `{"choice": "billing"}`, is refused with the same advice, where it was told to redeclare the input as `JSON`, and so is a bare level or key at a `Rating` or `Choice` input, such as `2`, where it was told to redeclare the input as `Anything`. A `Dynamic` input still keeps whatever its value reads as.- **A name a template sets is read where Jinja binds it (Breaking)**: the input check of `PipeLLM`, `PipeCompose`, `PipeSearch`, `PipeImgGen` and `PipeDocGen`, `PipeDocGen`'s field check and the optional-input guard now treat a `{% set %}` name as the template's own inside the loop, macro or block that sets it and after an `{% if %}` every branch of which sets it, so a template setting a name in a loop body or in each branch of an `if` and reading it there is no longer refused as reading an undeclared input. A name only some branches set is still read from the input of that name. Newly refused: an input declared only so that such a set would load, which is now never read, a macro called before its `{% macro %}`, an optional input read unguarded in a macro argument's default, and a name a loop or a macro binds read inside a `{% block %}` without `scoped`, which Jinja reads from the input of that name.- **File inputs are checked against the models that read them (Breaking)**: run setup now identifies every image and document input from its first bytes, refuses an `Image` input holding something other than an image with `PipelineInputNotAnImageError`, and refuses a document certain to reach a `PipeExtract` or `PipeLLM` step whose model does not read its format with `PipelineInputFormatUnsupportedError`, both 422 input errors naming the input, the step, the model and the formats it reads; a step reached only through a condition refuses the file itself with `ExtractInputFormatError` or `PromptDocumentFormatError`. A `PipeLLM` document its model does not read now raises `PromptDocumentFormatError` where it raised `LLMCapabilityError`, so a consumer branching on `error_type` must follow. `docling-extract-text` now declares the Word, PowerPoint, Excel, HTML, Markdown, CSV, plain-text, WebVTT and email files it already extracted, which `pipelex update` installs.- **Markdown with unclosed emphasis is converted in memory proportional to its length**: the Markdown parser behind the `markdown` filter, the `Markdown` concept's HTML and the built-in PDF engine held memory growing with the square of the text when emphasis or strikethrough markers were left unmatched, about 1.5 GB for 64,000 characters of `**a `; it now joins the text they leave behind in one pass, and renders the same HTML.diff --git a/docs/building-methods/concepts/define_your_concepts.md b/docs/building-methods/concepts/define_your_concepts.mdindex 816a016d6..92a890ecb 100644--- a/docs/building-methods/concepts/define_your_concepts.md+++ b/docs/building-methods/concepts/define_your_concepts.md@@ -147,7 +147,7 @@ The refined concept inherits the structure of the base concept while adding sema## Native Concepts-Pipelex includes these built-in native concepts: `Text`, `Markdown`, `Image`, `Document`, `TextAndImages`, `Number`, `YesNo`, `Date`, `Time`, `Page`, `Dynamic`, `JSON`, `Html`, `SearchResult`, `Composite`, and `Anything`.+Pipelex includes these built-in native concepts: `Text`, `Markdown`, `Image`, `Document`, `TextAndImages`, `Number`, `YesNo`, `Choice`, `Rating`, `Date`, `Time`, `Page`, `Dynamic`, `JSON`, `Html`, `SearchResult`, `Composite`, and `Anything`. Their names are reserved: a bundle declaring a concept named `Choice` or `Rating` is refused, as for every native.These concepts are automatically available in all pipelines—no setup required. You can use them directly in your pipes or refine them to create more specific concepts.diff --git a/docs/building-methods/concepts/native-concepts.md b/docs/building-methods/concepts/native-concepts.mdindex 8a022bd6a..487a5c474 100644--- a/docs/building-methods/concepts/native-concepts.md+++ b/docs/building-methods/concepts/native-concepts.md@@ -31,7 +31,9 @@ Here are all the native concepts you can use out of the box:| `Document` | A document: PDF, Office (Word, PowerPoint, Excel), web page, or a text file such as Markdown or CSV | `DocumentContent` || `TextAndImages` | Text with its associated images | `TextAndImagesContent` || `Number` | A number | `NumberContent` |-| `YesNo` | The answer to a yes/no question | `YesNoContent` |+| `YesNo` | The answer to a yes/no question, with an optional probability | `YesNoContent` |+| `Choice` | One option picked out of a declared set | `ChoiceContent` |+| `Rating` | A position on an ordered scale of described levels | `RatingContent` || `Date` | A calendar date, optionally with a time of day | `DateContent` || `Time` | A time of day, optionally with a UTC offset | `TimeContent` || `Page` | A document page with text, images, and optional page view | `PageContent` |@@ -218,14 +220,15 @@ class NumberContent(StuffContent):### YesNoContent-Represents the answer to a yes/no question — a single boolean verdict:+Represents the answer to a yes/no question — a boolean verdict, and the probability that the answer is yes when its producer reports one:```pythonclass YesNoContent(StuffContent):yes_no: bool+ probability: float | None = None # from 0 to 1```-Renders as `yes` or `no` when injected into a prompt. Especially handy as a `PipeLLM` output for judgments — `output = "YesNo"` makes the model return a typed boolean instead of free text answering "yes"/"no":+Renders as `yes` or `no` when injected into a prompt, whatever the probability. Especially handy as a `PipeLLM` output for judgments — `output = "YesNo"` makes the model return a typed boolean instead of free text answering "yes"/"no":```toml[pipe.judge_is_urgent]@@ -240,6 +243,32 @@ Read the verdict from a Python caller via `pipe_output.main_stuff_as_yes_no.yes_**Use for:** Yes/no judgments, boolean classifications, presence/absence checks, pass/fail verdicts.+### The verdict natives: `YesNo`, `Choice` and `Rating`++`YesNo`, `Choice` and `Rating` are verdicts, and they follow one rule: **a verdict native requires its verdict and nothing else.** The verdict — the boolean, the option key, the level — is what every producer can state. Every measure of uncertainty beside it is optional and defined by what it means, never by how a producer computes it, so a producer that measures less fills in less, and one that measures nothing still writes a valid verdict. An unreported measure is absent: a bare yes is never a probability of 1.++```python+class ChoiceContent(StuffContent):+ choice: str # the key of the selected option+ confidence: float | None = None # from 0 to 1+ probabilities: dict[str, float] | None = None # keyed by option key+++class RatingContent(StuffContent):+ level: int # the index of the selected level, 0 being the first+ confidence: float | None = None # from 0 to 1+ probabilities: dict[str, float] | None = None # keyed by level index written as text: "0", "1", ...+ position: float | None = None # a continuous position, from 0 to the last level's index+```++A `Choice` renders as its key and a `Rating` as its level, so `$team` in a later prompt reads `billing` and `$severity` reads `2`. Branch on them with a `PipeCondition`: `expression = "team.choice"` routes by the key, and `expression = "'severe' if severity.level >= 2 else 'mild'"` by the level.++A measure is only as good as its producer. A language model asked to fill a verdict — a `PipeLLM` whose output is `YesNo`, `Choice` or `Rating` — sees the uncertainty members, optional and described, and may fill them with its own estimate of its verdict. That estimate is worth having, and it is not the probability a dedicated judging model measures over the options it was given: a `Choice` written by a `PipeLLM` has no declared option set behind it, so its `probabilities` are keyed by whatever the model wrote. When a `PipeCondition` gates on a probability, read which producer wrote it, and guard against its absence: `approved.probability is not none and approved.probability >= 0.8`.++**Where a caller supplies a verdict, and where a producer reports one.** An input declared `YesNo` takes the bare verdict, `true` or `false`, and builds a `YesNo` with no probability; send its object form inside the explicit envelope when you have a probability to pass on. A result is read the other way: a `YesNo` a pipe produces is an object carrying `yes_no` and, when reported, `probability`, at every depth of the result. A `Choice` or `Rating` input is provided in its envelope, `{"concept": "native.Choice", "content": {"choice": "billing"}}`, since a bare `"billing"` would read as a text.++**Use for:** `Choice` for routing and classification over a declared set of options, `Rating` for grading on an ordered scale whose levels are described, and both wherever a method branches on a verdict and may weigh how sure its producer was.+### DateContentRepresents a calendar date, as precise as its source states — a required `date` plus an optional time of day:diff --git a/docs/building-methods/pipes/pipe-operators/PipeCompose.md b/docs/building-methods/pipes/pipe-operators/PipeCompose.mdindex 84a216407..87b83b487 100644--- a/docs/building-methods/pipes/pipe-operators/PipeCompose.md+++ b/docs/building-methods/pipes/pipe-operators/PipeCompose.md@@ -187,6 +187,8 @@ Conversion matrix:When the target field expects a content object rather than a native value (e.g. a field typed with a concept), the object is kept as-is — the conversion only fires when the field expects the native type.+`Choice` and `Rating` are not in the matrix: reach their verdict by path, `{ from = "team.choice" }` or `{ from = "severity.level" }`. A `YesNo` converts to its boolean and leaves its probability behind, so copy `{ from = "approved.probability" }` into a `number` field when you need it.+One fidelity guard: a `Date` stuff that carries a time of day cannot be copied into a bare `date` field — that would silently drop the time and its UTC offset, so the composer raises an error instead. Target a `Date`-typed field to keep the full timestamp. The same guard applies per item when copying a `Date[]` into a list of `date` items.`Time` needs no such guard, and the asymmetry is deliberate: a `Time` is a single value that carries its UTC offset inside the time itself, so copying it into a `time` field is lossless and nothing can be dropped. In the other direction, a whole `Date` does not convert into a `time` field at all — that would drop the date. Use a dotted path instead, `{ from = "deadline.time" }`, to take the time of day out of a `Date`.diff --git a/docs/building-methods/pipes/pipe-operators/PipeDocGen.md b/docs/building-methods/pipes/pipe-operators/PipeDocGen.mdindex 8bb51ace1..08e90f766 100644--- a/docs/building-methods/pipes/pipe-operators/PipeDocGen.md+++ b/docs/building-methods/pipes/pipe-operators/PipeDocGen.md@@ -23,6 +23,7 @@ With no template, the step lays its inputs out by itself, which is called the au- a `Text` input prints as paragraphs, and a [`Markdown`](../../concepts/native-concepts.md) input prints formatted, with its headings, emphasis, lists, tables, code blocks and links;- an `Html` input prints as its text with the tags removed, since the auto-layout does not interpret HTML, a table row on one line with its cells separated by `|`;- an `Image` prints as a picture, with its caption;+- a verdict prints as its verdict alone, like any scalar: a `YesNo` as its answer, a `Choice` as its option key and a `Rating` as its level, without the probability or confidence a producer reported;- a list of images, of `Markdown` texts or of other native values prints item by item, each as it would print alone.A single input is the document itself: an invoice's fields fill the page. Several inputs each get a section, in the order the step declares them. Every page carries the document's title in a running header and "Page N of M" in its footer, on A4 portrait, in a font bundled with Pipelex so that a PDF looks the same on every machine.@@ -118,7 +119,7 @@ A `pdf` step's `template`, or its `.html` `template_file`, is rendered with exac### Office template files-An `.xlsx`, `.docx` or `.pptx` template file is filled by its engine from the inputs as plain data, so it sees fields, not the sigils and filters of HTML templates. Its contract is documented with the plugin. When the plugin's engine checks templates, `pipelex validate` and the dry run compare the file with the inputs' concepts: a misspelled name is reported before any run.+An `.xlsx`, `.docx` or `.pptx` template file is filled by its engine from the inputs as plain data, so it sees fields, not the sigils and filters of HTML templates. In plain data a native value is its value, and a verdict is its verdict: a `YesNo` is its boolean, a `Choice` its option key and a `Rating` its level, so the file reads `team` rather than `team.choice`, and a verdict's probability or confidence does not reach it. A `pdf` template reads the verdict whole, `team.choice` and `team.confidence` included, as a `PipeCompose` template does. Its contract is documented with the plugin. When the plugin's engine checks templates, `pipelex validate` and the dry run compare the file with the inputs' concepts: a misspelled name is reported before any run.A template file is found beside the bundle, so it works for a bundle loaded from a directory, a dependency package's included. A bundle loaded from a string, as the hosted API does, cannot name one: the step is refused at load. An inline `template` works on every load path.diff --git a/docs/building-methods/pipes/pipe-output.md b/docs/building-methods/pipes/pipe-output.mdindex 1eb3b75d4..555fb9376 100644--- a/docs/building-methods/pipes/pipe-output.md+++ b/docs/building-methods/pipes/pipe-output.md@@ -162,7 +162,21 @@ This works only if the main_stuff is (or refines) a `NumberContent` concept.verdict = pipe_output.main_stuff_as_yes_no.yes_no # a bool```-This works only if the main_stuff is (or refines) a `YesNoContent` concept.+This works only if the main_stuff is (or refines) a `YesNoContent` concept. Its `probability` is `None` unless the producer reported one.++**`main_stuff_as_choice`** - Returns `ChoiceContent` object:++```python+team = pipe_output.main_stuff_as_choice.choice # the selected option's key+```++**`main_stuff_as_rating`** - Returns `RatingContent` object:++```python+severity = pipe_output.main_stuff_as_rating.level # the selected level's index+```++Each works only if the main_stuff is (or refines) the matching verdict native.**`main_stuff_as_markdown`** - Returns `MarkdownContent` object:diff --git a/docs/building-methods/pipes/provide-inputs.md b/docs/building-methods/pipes/provide-inputs.mdindex 2238b6eb4..61e60826c 100644--- a/docs/building-methods/pipes/provide-inputs.md+++ b/docs/building-methods/pipes/provide-inputs.md@@ -92,7 +92,7 @@ Each value is typed as the **declared** concept — `question` becomes a `legal.In a bare list for `Anything[]` or `JSON[]`, an item shaped like an envelope (an object with `concept` and `content` keys) is refused rather than guessed at. To type a list, wrap the whole list in one envelope instead.!!! note "Concepts the signature can't shape"- A few concepts still carry no single expected value shape — `Dynamic` and the container natives (`Html`, `Page`, `TextAndImages`, `SearchResult`, `Composite`). For an input declared as one of these, the value is read by its own shape (a bare string becomes `native.Text`, and so on), and a value with no reading, such as a list of plain objects, is refused with an error naming the input and the declaration to change. Use the explicit format if you need a specific concept there.+ A few concepts still carry no single expected value shape — `Dynamic`, the container natives (`Html`, `Page`, `TextAndImages`, `SearchResult`, `Composite`) and the verdicts `Choice` and `Rating`. For an input declared as one of these, the value is read by its own shape (a bare string reads as a `native.Text`, and so on). A `Dynamic` input keeps whatever its value reads as; any other refuses a value that reads as a concept it does not accept, so a bare `"billing"` at a `Choice` input is refused rather than handed on as a text, as is its content without the envelope, `{"choice": "billing"}`, or a bare level `2` at a `Rating` input, each with an error showing the expected shape; a value with no reading at all, such as a list of plain objects, is refused with an error naming the input and the declaration to change. Provide these in the explicit format: `{"concept": "native.Choice", "content": {"choice": "billing"}}`.## Lists and multiplicitydiff --git a/docs/contribute/generate-projection-corpus.md b/docs/contribute/generate-projection-corpus.mdindex 4071d0310..738256101 100644--- a/docs/contribute/generate-projection-corpus.md+++ b/docs/contribute/generate-projection-corpus.md@@ -72,7 +72,7 @@ A key is a whole template and never a slot, and the shaper stops at the first sl## The bundles-`tests/data/input_semantics/` holds the corpus bundles, and the command above names every one of them: a bundle that exists in that directory but is left off the command line does not appear in the capture, and the regeneration silently drops the pipes it contributed. `probe_bundle.mthds` exercises every construct the language accepts and `hinted_bundle.mthds` the intent hints; `output_bundle.mthds` covers the output form specifically, since every bundle before it resolved to `Text`; `scaffold_bundle.mthds` was added for this corpus and covers what the others do not — a text field merely named `url` beside a real file position, an optional nested structure, optional `native.Image` and `native.Document` fields inside a structure, and both a fixed `[N]` and a variable `[]` slot over a structured concept. Its `scaffold_open_natives` pipe holds the natives whose payload shape the descriptor states openly, at slot positions: `native.Dynamic`, `native.Composite` and `native.Anything`, which declare no pinned structure and whose node is therefore `unknown`, beside `native.JSON`, which does declare one — its pinned blueprint carries a required `json_obj`, so its explicit template expands like any other pinned native's, while its compact template is the bare object with `json_obj` unwrapped, and that dict is where `unknown-empty-object` is measured. Its `scaffold_dynamic_prompt` pipe puts a `native.Dynamic` slot at an LLM prompt position under both markers, which the corpus could not carry while the prompt analyzers read a dynamic concept's universal compatibility as identity and demanded an `ImageContent` for it.+`tests/data/input_semantics/` holds the corpus bundles, and the command above names every one of them: a bundle that exists in that directory but is left off the command line does not appear in the capture, and the regeneration silently drops the pipes it contributed. `probe_bundle.mthds` exercises every construct the language accepts and `hinted_bundle.mthds` the intent hints; `output_bundle.mthds` covers the output form specifically, since every bundle before it resolved to `Text`; `scaffold_bundle.mthds` was added for this corpus and covers what the others do not — a text field merely named `url` beside a real file position, an optional nested structure, optional `native.Image` and `native.Document` fields inside a structure, and both a fixed `[N]` and a variable `[]` slot over a structured concept. Its `scaffold_open_natives` pipe holds the natives whose payload shape the descriptor states openly, at slot positions: `native.Dynamic`, `native.Composite` and `native.Anything`, which declare no pinned structure and whose node is therefore `unknown`, beside `native.JSON`, which does declare one — its pinned blueprint carries a required `json_obj`, so its explicit template expands like any other pinned native's, while its compact template is the bare object with `json_obj` unwrapped, and that dict is where `unknown-empty-object` is measured. Its `scaffold_dynamic_prompt` pipe puts a `native.Dynamic` slot at an LLM prompt position under both markers, which the corpus could not carry while the prompt analyzers read a dynamic concept's universal compatibility as identity and demanded an `ImageContent` for it. Its `scaffold_verdict_natives` pipe holds the three verdict natives at slot positions: `native.YesNo`, which a slot reads as a bare boolean, beside `native.Choice` and `native.Rating`, which a slot takes in their envelope. `output_bundle.mthds` carries the other side in `output_native_yes_no`, whose `YesNo` output is the object holding `yes_no` and its optional `probability`, the one native whose output form differs from its input form.`native.Anything`'s compact template keeps its envelope, `{"concept": "native.Anything", "content": {}}`, in the engine and in every projection: its bare placeholder, `{}`, would read as "send an object", while the envelope names the concept that says any value goes. The input shaper takes that envelope back, reading its empty object as a JSON object under the `Anything` concept.diff --git a/docs/errors/structure-validation-error.md b/docs/errors/structure-validation-error.mdindex 9c7a52063..468d17039 100644--- a/docs/errors/structure-validation-error.md+++ b/docs/errors/structure-validation-error.md@@ -11,7 +11,7 @@ A provided input value could not be built as the concept its input declares.Most often the value is the right JSON kind but does not fit the concept's structure: an object missing a required field, a malformed `{"url": ...}` for an image or a document, a string that is not an ISO date for a `Date` input. The message names the input and the declared concept, and ends with the expected shape rendered from the method's signature. The fix is the value.-The other case is a value that an input reading bare values by their own shape has no reading for. An input declared `Dynamic`, or as one of the container natives (`Html`, `Page`, `TextAndImages`, `SearchResult`, `Composite`), reads a bare value that way, and some values have none: a number, or a list of plain objects. The message says so, `Input 'records' could not be built as 'native.Dynamic': you provided a list of 2 item(s), and an input of this concept reads a bare value by its own shape, with no reading for this one.`, and its next step names the declaration that would read the value: `JSON` for an object, `JSON[]` for a list of objects, `Anything` or `Anything[]` for anything else, or a concept with a structure that describes it. The fix is usually the method's declaration rather than the value.+The other case is a value that an input reading bare values by their own shape has no reading for, or reads as a concept the input does not accept. An input declared `Dynamic`, as one of the container natives (`Html`, `Page`, `TextAndImages`, `SearchResult`, `Composite`), or as a `Choice` or a `Rating`, reads a bare value that way. A bare string reads as a text, which only a `Dynamic` input takes: at a `Choice` input the message is `Input 'team' could not be built as 'native.Choice': you provided a string ("billing"), which reads as 'native.Text', and a 'native.Text' is not a 'native.Choice'.`, and the fix is the value, sent in the expected shape the message ends with. So it is for the input's own content sent without its envelope: `{"choice": "billing"}` at a `Choice` input is refused as `the content of a 'native.Choice' without the envelope that names its concept`, and declaring the input `JSON` instead would discard the concept the method asked for. A bare level or key at a `Rating` or a `Choice` input, such as `2`, is refused the same way, as a value that `takes its value in the envelope that names its concept`, since declaring the input `Anything` would discard the verdict. Some values have no reading at all: a number, or a list of plain objects. The message says so, `Input 'records' could not be built as 'native.Dynamic': you provided a list of 2 item(s), and an input of this concept reads a bare value by its own shape, with no reading for this one.`, and its next step names the declaration that would read the value: `JSON` for an object, `JSON[]` for a list of objects, `Anything` or `Anything[]` for anything else, or a concept with a structure that describes it. The fix is usually the method's declaration rather than the value.When no declaration reads the value, such as an empty list at a `Html[]` input, a list mixing prebuilt contents of different kinds, or a list holding nulls or nested lists, the message carries the reason itself.diff --git a/docs/features/concepts.md b/docs/features/concepts.mdindex 1b3370a86..bbac6d029 100644--- a/docs/features/concepts.md+++ b/docs/features/concepts.md@@ -23,7 +23,9 @@ Pre-built universal concepts available in every Pipelex project:- **Html** — HTML content- **TextAndImages** — Combined text and image content in a single structure- **Number** — Numeric value-- **YesNo** — The answer to a yes/no question+- **YesNo** — The answer to a yes/no question, with an optional probability+- **Choice** — One option picked out of a declared set, with optional confidence and probabilities+- **Rating** — A level on an ordered scale of described levels, with optional measures of uncertainty- **Date** — A calendar date, optionally with a time of day- **Time** — A time of day, optionally with a UTC offset- **Page** — A single page extracted from a document, with markdown text and optional imagesdiff --git a/docs/under-the-hood/input-form-descriptor.md b/docs/under-the-hood/input-form-descriptor.mdindex acacad60d..c1387c458 100644--- a/docs/under-the-hood/input-form-descriptor.md+++ b/docs/under-the-hood/input-form-descriptor.md@@ -40,12 +40,16 @@ The table and rules above ARE the no-hint kind assignment — stated rules, not|---|---|| `Text`, `Markdown` | `prose` || `Number` | `number` with `integer: false` |-| `YesNo` | `boolean` |+| `YesNo` | `boolean` on the input side; `object` over `yes_no` and `probability` in an output descriptor || `Time` | `text` with `format: "time"` || `Document` | `document` || `Image` | `image` |-| `Date`, `Html`, `Page`, `TextAndImages`, `SearchResult` | `object` over the pinned blueprint's fields |-| `Dynamic`, `Anything`, `JSON` | `unknown` |+| `Date`, `Html`, `Page`, `TextAndImages`, `SearchResult`, `JSON`, `Choice`, `Rating` | `object` over the pinned blueprint's fields |+| `Dynamic`, `Anything`, `Composite` | `unknown` |++`JSON` is the one row where Pipelex departs from the published standard, which lists it as `unknown`: Pipelex derives it as an `object` over its pinned `json_obj` member, itself an `unknown` dict, because a template describing a `JSON` input as unknown renders `{}`, which `JSONContent` then refuses.++`YesNo` is the one native read differently by position, as the standard states: a caller supplies the bare verdict, while a producer may report a probability beside it. The output descriptor is the same derivation (`InputFormDeriver`) told its position by `build_output_form`, and the position is read in `YesNo`'s row and nowhere else, so a `YesNo` is an `object` at every depth of an output node — at the top, as a nested field, as a list's item, through a reflected class field and through a class-backed concept.Nested structure fields map by their declared type: `text` → `text`; `integer` → `number` with `integer: true`; `number` → `number`; `boolean` → `boolean`; `date` → `date`; `datetime` → `date` with `datetime: true`; `time` → `text` with `format: "time"`; a field with `choices` → `enum` (choices win over `type`, matching the structure generator); `concept` → the concept's node, carrying its namespaced `concept_ref`; `list` → `list` whose `item` comes from `item_type` / `item_concept_ref` (a nested list's inner item is inexpressible and reports `unknown`; the `item` node carries no `name` member — a list's item has no authored name, and the index labels entries); `dict` → `unknown`. The shorthand `field = "description"` form is a required `text`. Nested fields take the blueprint field's description and `required` over the concept's; a scalar flattened at the top level keeps the concept's description.diff --git a/pipelex/builder/concept/concept_spec.py b/pipelex/builder/concept/concept_spec.pyindex c51b7b925..b8901859d 100644--- a/pipelex/builder/concept/concept_spec.py+++ b/pipelex/builder/concept/concept_spec.py@@ -10,6 +10,7 @@ from pipelex.builder.concept.exceptions import ConceptSpecErrorfrom pipelex.cogt.content_generation.dry_run_factory import MockFormatfrom pipelex.core.concepts.concept_blueprint import ConceptBlueprint, ConceptStructureBlueprintfrom pipelex.core.concepts.concept_structure_blueprint import ConceptStructureBlueprintFieldType+from pipelex.core.concepts.native.concept_native import NativeConceptCodefrom pipelex.core.concepts.validation import is_concept_ref_or_code_validfrom pipelex.core.stuffs.structured_content import StructuredContentfrom pipelex.tools.misc.pretty import require_rich_for_rendering@@ -263,7 +264,7 @@ class ConceptSpec(StructuredContent):default=None,description=("If applicable: the native concept this concept extends "- "(Text, Markdown, Html, Image, Document, Number, Page, TextAndImages, JSON, Anything, Dynamic) "+ f"({', '.join(NativeConceptCode)}) ""in PascalCase format. Cannot be used together with 'structure'."),examples=["Text", "Markdown", "Html", "Image", "Document", "Number", "Page", "TextAndImages", "JSON"],diff --git a/pipelex/codegen/native_expansion.py b/pipelex/codegen/native_expansion.pyindex 5b583e97c..603e5d098 100644--- a/pipelex/codegen/native_expansion.py+++ b/pipelex/codegen/native_expansion.py@@ -14,12 +14,13 @@ its pinned blueprint, proving the two can never drift silently.Reflection is faithful-or-absent: a native's structure is reflected only when *every* field of itscontent class maps unambiguously to a blueprint field — primitive, dict, list, a reference toanother native, or a nested non-native model (whose wire form is a JSON object, so it maps honestly-to a `dict` blueprint with unspecified value types — declared imprecision). A field whose+to a `dict` blueprint with unspecified value types — declared imprecision). A dict states its value+type when that type is a scalar the blueprint vocabulary names, and `Any` otherwise. A field whoseannotation has no honest blueprint form at all (e.g. a non-Optional union) makes the wholereflected structure absent."""-from typing import Any, cast, get_origin+from typing import Annotated, Any, cast, get_args, get_originfrom pydantic import BaseModel@@ -99,7 +100,11 @@ def _annotation_to_blueprint(annotation: Any, *, description: str) -> ConceptStrorigin = get_origin(inner)if origin is dict:return ConceptStructureBlueprint(- description=description, type=ConceptStructureBlueprintFieldType.DICT, key_type="text", value_type="Any", required=required+ description=description,+ type=ConceptStructureBlueprintFieldType.DICT,+ key_type="text",+ value_type=_dict_value_type(dict_annotation=inner),+ required=required,)if origin is list:return _list_blueprint(inner, description=description, required=required)@@ -125,6 +130,21 @@ def _annotation_to_blueprint(annotation: Any, *, description: str) -> ConceptStrraise _UnmappableAnnotationError+def _dict_value_type(*, dict_annotation: Any) -> str:+ """A dict's value type in the spec vocabulary: a scalar it maps, else the reserved `Any` marker (declared imprecision)."""+ args = get_args(dict_annotation)+ if len(args) != 2:+ return "Any"+ value_annotation = args[1]+ if get_origin(value_annotation) is Annotated:+ # A constrained value type (`UnitInterval`) is its base type: the blueprint vocabulary states no range.+ value_annotation = get_args(value_annotation)[0]+ scalar_type = scalar_field_type(annotation=value_annotation)+ if scalar_type is None:+ return "Any"+ return scalar_type.value++def _list_blueprint(list_annotation: Any, *, description: str, required: bool) -> ConceptStructureBlueprint:item_inner = list_item_annotation(annotation=list_annotation)if item_inner is None:diff --git a/pipelex/cogt/doc_gen/input_shape.py b/pipelex/cogt/doc_gen/input_shape.pyindex 18ad6058a..12b9a344e 100644--- a/pipelex/cogt/doc_gen/input_shape.py+++ b/pipelex/cogt/doc_gen/input_shape.py@@ -17,6 +17,7 @@ from typing import Any, Literal, Unionfrom pydantic import BaseModel, Fieldfrom pipelex.cogt.doc_gen.plain_data import plain_data+from pipelex.core.stuffs.choice_content import ChoiceContentfrom pipelex.core.stuffs.composite_content import CompositeContentfrom pipelex.core.stuffs.date_content import DateContentfrom pipelex.core.stuffs.document_content import DocumentContent@@ -26,6 +27,7 @@ from pipelex.core.stuffs.json_content import JSONContentfrom pipelex.core.stuffs.list_content import ListContentfrom pipelex.core.stuffs.markdown_content import MarkdownContentfrom pipelex.core.stuffs.number_content import NumberContent+from pipelex.core.stuffs.rating_content import RatingContentfrom pipelex.core.stuffs.text_content import TextContentfrom pipelex.core.stuffs.time_content import TimeContentfrom pipelex.core.stuffs.yes_no_content import YesNoContent@@ -85,6 +87,10 @@ def _content_leaf_kind(content_class: type[BaseModel]) -> InputShapeKind | None:return InputShapeKind.NUMBERif issubclass(content_class, YesNoContent):return InputShapeKind.BOOLEAN+ if issubclass(content_class, ChoiceContent):+ return InputShapeKind.TEXT+ if issubclass(content_class, RatingContent):+ return InputShapeKind.NUMBERif issubclass(content_class, DateContent):return InputShapeKind.DATEif issubclass(content_class, TimeContent):diff --git a/pipelex/cogt/doc_gen/layout_builder.py b/pipelex/cogt/doc_gen/layout_builder.pyindex c9a7c5044..a67fb0696 100644--- a/pipelex/cogt/doc_gen/layout_builder.py+++ b/pipelex/cogt/doc_gen/layout_builder.py@@ -28,6 +28,7 @@ from pipelex.cogt.doc_gen.layout_tree import (SectionBlock,TableBlock,)+from pipelex.core.stuffs.choice_content import ChoiceContentfrom pipelex.core.stuffs.date_content import DateContentfrom pipelex.core.stuffs.document_content import DocumentContentfrom pipelex.core.stuffs.html_content import HtmlContent@@ -36,6 +37,7 @@ from pipelex.core.stuffs.json_content import JSONContentfrom pipelex.core.stuffs.list_content import ListContentfrom pipelex.core.stuffs.markdown_content import MarkdownContentfrom pipelex.core.stuffs.number_content import NumberContent+from pipelex.core.stuffs.rating_content import RatingContentfrom pipelex.core.stuffs.structured_content import StructuredContentfrom pipelex.core.stuffs.stuff_content import StuffContentfrom pipelex.core.stuffs.text_content import TextContent@@ -138,6 +140,10 @@ def _scalar(value: Any) -> tuple[bool, LayoutScalar]:return True, value.numbercase YesNoContent():return True, value.yes_no+ case ChoiceContent():+ return True, value.choice+ case RatingContent():+ return True, value.levelcase DateContent():if value.time is None:return True, value.datediff --git a/pipelex/cogt/doc_gen/plain_data.py b/pipelex/cogt/doc_gen/plain_data.pyindex 2650469c3..13f273f2e 100644--- a/pipelex/cogt/doc_gen/plain_data.py+++ b/pipelex/cogt/doc_gen/plain_data.py@@ -14,11 +14,13 @@ from typing import Anyfrom pydantic import BaseModel+from pipelex.core.stuffs.choice_content import ChoiceContentfrom pipelex.core.stuffs.date_content import DateContentfrom pipelex.core.stuffs.html_content import HtmlContentfrom pipelex.core.stuffs.json_content import JSONContentfrom pipelex.core.stuffs.list_content import ListContentfrom pipelex.core.stuffs.number_content import NumberContent+from pipelex.core.stuffs.rating_content import RatingContentfrom pipelex.core.stuffs.text_content import TextContentfrom pipelex.core.stuffs.time_content import TimeContentfrom pipelex.core.stuffs.yes_no_content import YesNoContent@@ -37,6 +39,10 @@ def plain_data(value: Any) -> Any:return value.numbercase YesNoContent():return value.yes_no+ case ChoiceContent():+ return value.choice+ case RatingContent():+ return value.levelcase DateContent():if value.time is None:return value.datediff --git a/pipelex/core/concepts/concept_factory.py b/pipelex/core/concepts/concept_factory.pyindex 65ef57a0c..06c567009 100644--- a/pipelex/core/concepts/concept_factory.py+++ b/pipelex/core/concepts/concept_factory.py@@ -216,6 +216,20 @@ class ConceptFactory:description="A search result with answer and sources",structure_class_name=structure_class_name,)+ case NativeConceptCode.CHOICE:+ return Concept(+ code=native_concept_code,+ domain_code=SpecialDomain.NATIVE,+ description="One option picked out of a declared set",+ structure_class_name=structure_class_name,+ )+ case NativeConceptCode.RATING:+ return Concept(+ code=native_concept_code,+ domain_code=SpecialDomain.NATIVE,+ description="A position on an ordered scale of described levels",+ structure_class_name=structure_class_name,+ )case NativeConceptCode.COMPOSITE:return Concept(code=native_concept_code,diff --git a/pipelex/core/concepts/native/concept_native.py b/pipelex/core/concepts/native/concept_native.pyindex 9e75a3c18..04e8514a6 100644--- a/pipelex/core/concepts/native/concept_native.py+++ b/pipelex/core/concepts/native/concept_native.py@@ -4,6 +4,7 @@ from pipelex.core.concepts.native.exceptions import NativeConceptDefinitionErrorfrom pipelex.core.concepts.validation import is_concept_ref_or_code_validfrom pipelex.core.domains.domain import SpecialDomainfrom pipelex.core.qualified_ref import QualifiedRef+from pipelex.core.stuffs.choice_content import ChoiceContentfrom pipelex.core.stuffs.composite_content import CompositeContentfrom pipelex.core.stuffs.date_content import DateContentfrom pipelex.core.stuffs.document_content import DocumentContent@@ -14,6 +15,7 @@ from pipelex.core.stuffs.json_content import JSONContentfrom pipelex.core.stuffs.markdown_content import MarkdownContentfrom pipelex.core.stuffs.number_content import NumberContentfrom pipelex.core.stuffs.page_content import PageContent+from pipelex.core.stuffs.rating_content import RatingContentfrom pipelex.core.stuffs.search_result_content import SearchResultContentfrom pipelex.core.stuffs.text_and_images_content import TextAndImagesContentfrom pipelex.core.stuffs.text_content import TextContent@@ -31,6 +33,8 @@ class NativeConceptCode(StrEnum):TEXT_AND_IMAGES = "TextAndImages"NUMBER = "Number"YES_NO = "YesNo"+ CHOICE = "Choice"+ RATING = "Rating"DATE = "Date"TIME = "Time"PAGE = "Page"@@ -59,6 +63,8 @@ class NativeConceptCode(StrEnum):| NativeConceptCode.TEXT_AND_IMAGES| NativeConceptCode.NUMBER| NativeConceptCode.YES_NO+ | NativeConceptCode.CHOICE+ | NativeConceptCode.RATING| NativeConceptCode.DATE| NativeConceptCode.TIME| NativeConceptCode.PAGE@@ -89,6 +95,8 @@ class NativeConceptCode(StrEnum):| NativeConceptCode.TEXT_AND_IMAGES| NativeConceptCode.NUMBER| NativeConceptCode.YES_NO+ | NativeConceptCode.CHOICE+ | NativeConceptCode.RATING| NativeConceptCode.DATE| NativeConceptCode.TIME| NativeConceptCode.PAGE@@ -120,6 +128,8 @@ class NativeConceptCode(StrEnum):| NativeConceptCode.TEXT_AND_IMAGES| NativeConceptCode.NUMBER| NativeConceptCode.YES_NO+ | NativeConceptCode.CHOICE+ | NativeConceptCode.RATING| NativeConceptCode.DATE| NativeConceptCode.TIME| NativeConceptCode.PAGE@@ -164,6 +174,10 @@ class NativeConceptCode(StrEnum):return NumberContentcase NativeConceptCode.YES_NO:return YesNoContent+ case NativeConceptCode.CHOICE:+ return ChoiceContent+ case NativeConceptCode.RATING:+ return RatingContentcase NativeConceptCode.DATE:return DateContentcase NativeConceptCode.TIME:@@ -228,6 +242,8 @@ class NativeConceptCode(StrEnum):| NativeConceptCode.TEXT_AND_IMAGES| NativeConceptCode.NUMBER| NativeConceptCode.YES_NO+ | NativeConceptCode.CHOICE+ | NativeConceptCode.RATING| NativeConceptCode.DATE| NativeConceptCode.TIME| NativeConceptCode.PAGE@@ -265,6 +281,8 @@ class NativeConceptCode(StrEnum):| NativeConceptCode.TEXT_AND_IMAGES| NativeConceptCode.NUMBER| NativeConceptCode.YES_NO+ | NativeConceptCode.CHOICE+ | NativeConceptCode.RATING| NativeConceptCode.DATE| NativeConceptCode.TIME| NativeConceptCode.PAGE@@ -291,6 +309,8 @@ class NativeConceptCode(StrEnum):| NativeConceptCode.TEXT_AND_IMAGES| NativeConceptCode.NUMBER| NativeConceptCode.YES_NO+ | NativeConceptCode.CHOICE+ | NativeConceptCode.RATING| NativeConceptCode.DATE| NativeConceptCode.TIME| NativeConceptCode.PAGEdiff --git a/pipelex/core/concepts/native/pinned_blueprints.py b/pipelex/core/concepts/native/pinned_blueprints.pyindex ca4c98952..4bb7e68e4 100644--- a/pipelex/core/concepts/native/pinned_blueprints.py+++ b/pipelex/core/concepts/native/pinned_blueprints.py@@ -14,7 +14,7 @@ standard's page itself, read live from the sibling `mthds/` checkout (the `MTHDSconformance` CI workflow runs it against a fresh checkout on every pull request), so the day thestandard moves a definition, this repo goes red instead of a downstream port.-The set below is the one the standard pinned at MTHDS 2.0.0, named by+The set below is the one the standard pinned at MTHDS 3.0.0, named by`PINNED_NATIVES_MTHDS_VERSION`. Version-keyed lookup can come when a second pinned set exists;until then an implementation of standard version `V` materializes the greatest pinned set notabove `V`, and this is the only one there is.@@ -32,7 +32,7 @@ from pipelex.core.concepts.native.concept_native import NativeConceptCode# is the latest release of the standard. `tests/unit/pipelex/core/concepts/test_pinned_natives_vs_standard.py`# holds this value to the page; `test_pinned_natives_version.py` beside it holds it to the standard# version this engine implements, which is the reading that needs no sibling checkout.-PINNED_NATIVES_MTHDS_VERSION = "2.0.0"+PINNED_NATIVES_MTHDS_VERSION = "3.0.0"def make_pinned_native_blueprint(native_code: NativeConceptCode) -> ConceptBlueprint:@@ -64,6 +64,10 @@ def _pinned_description(native_code: NativeConceptCode) -> str:return "A number"case NativeConceptCode.YES_NO:return "The answer to a yes/no question"+ case NativeConceptCode.CHOICE:+ return "One option picked out of a declared set"+ case NativeConceptCode.RATING:+ return "A position on an ordered scale of described levels"case NativeConceptCode.DATE:return "A calendar date, optionally with a time of day — as precise as its source states."case NativeConceptCode.TIME:@@ -149,6 +153,32 @@ def _pinned_structure(native_code: NativeConceptCode) -> dict[str, ConceptStruct"yes_no": ConceptStructureBlueprint(description="Whether the answer is yes (true) or no (false).", type=ConceptStructureBlueprintFieldType.BOOLEAN, required=True),+ "probability": _number_field(+ description="The probability that the answer is yes, from 0 to 1, when the producer reports one.",+ ),+ }+ case NativeConceptCode.CHOICE:+ return {+ "choice": _text_field(description="The key of the selected option.", required=True),+ "confidence": _number_field(description="The producer's confidence in the choice, from 0 to 1, when it reports one."),+ "probabilities": _number_dict_field(+ description="The probability of each option, keyed by option key, when the producer measures a distribution.",+ ),+ }+ case NativeConceptCode.RATING:+ return {+ "level": ConceptStructureBlueprint(+ description="The index of the selected level, 0 being the first level declared.",+ type=ConceptStructureBlueprintFieldType.INTEGER,+ required=True,+ ),+ "confidence": _number_field(description="The producer's confidence in the level, from 0 to 1, when it reports one."),+ "probabilities": _number_dict_field(+ description="The probability of each level, keyed by level index written as text, when the producer measures a distribution.",+ ),+ "position": _number_field(+ description="A continuous position on the scale, from 0 to the index of the last level, when the producer measures one.",+ ),}case NativeConceptCode.DATE:return {@@ -213,3 +243,16 @@ def _pinned_structure(native_code: NativeConceptCode) -> dict[str, ConceptStructdef _text_field(*, description: str, required: bool = False) -> ConceptStructureBlueprint:return ConceptStructureBlueprint(description=description, type=ConceptStructureBlueprintFieldType.TEXT, required=required)+++def _number_field(*, description: str) -> ConceptStructureBlueprint:+ return ConceptStructureBlueprint(description=description, type=ConceptStructureBlueprintFieldType.NUMBER)+++def _number_dict_field(*, description: str) -> ConceptStructureBlueprint:+ return ConceptStructureBlueprint(+ description=description,+ type=ConceptStructureBlueprintFieldType.DICT,+ key_type="text",+ value_type=ConceptStructureBlueprintFieldType.NUMBER.value,+ )diff --git a/pipelex/core/memory/exceptions.py b/pipelex/core/memory/exceptions.pyindex 0d9646fa6..b080381b4 100644--- a/pipelex/core/memory/exceptions.py+++ b/pipelex/core/memory/exceptions.py@@ -136,9 +136,13 @@ class StructureValidationError(InputShapingError):Covers a structured-concept dict missing a required field, a malformed ``{"url": ...}`` for afile concept, a non-ISO string for a Date concept — any value that is the right JSON kind but- does not build into the declared content class. It also covers a value an input reading bare- values by their own shape has no reading for — a list of plain objects at a ``Dynamic`` or- ``Html`` input — where the fix is usually the input's declaration rather than the value (R8).+ does not build into the declared content class. It also covers the bare values an input reading+ values by their own shape refuses (R8): one it has no reading for, such as a list of plain objects+ at a ``Dynamic`` input, where the fix is usually the input's declaration; one it reads as a concept+ the input does not accept, such as a string at a ``Choice`` input; the content of the declared+ concept sent without the envelope that names it, such as ``{"choice": "billing"}`` at a ``Choice``+ input; and a scalar at an input of a verdict native, such as a bare level at a ``Rating`` input.+ The last three are fixed in the value, sent in the expected shape."""@classmethod@@ -188,6 +192,88 @@ class StructureValidationError(InputShapingError):)return cls(message, variable_name=variable_name, user_action=user_action)+ @classmethod+ def make_for_content_without_its_envelope(+ cls,+ *,+ variable_name: str,+ declared_concept_ref: str,+ provided_description: str,+ expected_shape: str,+ ) -> "StructureValidationError":+ """The refusal for the declared concept's own content, sent bare at an input that takes it in its envelope.++ An input of a native read bottom-up takes its value in the `{"concept", "content"}` envelope, so+ `{"choice": "billing"}` at a `Choice` input has no reading. The value is right in substance and+ wrong in form, so the advice is the expected shape: a declaration that reads the bare object, such+ as `JSON`, would discard the concept the method asked for.+ """+ message = (+ f"Input '{variable_name}' could not be built as '{declared_concept_ref}': you provided {provided_description}, "+ f"which is the content of a '{declared_concept_ref}' without the envelope that names its concept, "+ f"and an input of this concept takes its value in that envelope.\nExpected shape:\n{expected_shape}"+ )+ user_action = UserAction(+ kind=UserActionKind.CHANGE_INPUT,+ detail=f"Send input '{variable_name}' in the expected shape, which names its concept and spells out its content.",+ )+ return cls(message, variable_name=variable_name, user_action=user_action)++ @classmethod+ def make_for_scalar_at_a_verdict_input(+ cls,+ *,+ variable_name: str,+ declared_concept_ref: str,+ provided_description: str,+ expected_shape: str,+ ) -> "StructureValidationError":+ """The refusal for a scalar, or a list of scalars, at an input of a verdict native.++ A `Choice` or a `Rating` input takes its value in the `{"concept", "content"}` envelope, and a+ caller naturally sends its key or its level alone, as a `Number` or a `YesNo` input would take+ it. A verdict is more than its key or its level, so the value has no reading, and a declaration+ that reads it, such as `Anything`, would discard the verdict the method branches on: the advice+ is the expected shape.+ """+ message = (+ f"Input '{variable_name}' could not be built as '{declared_concept_ref}': you provided {provided_description}, "+ f"and an input of this concept takes its value in the envelope that names its concept, with its content spelled out."+ f"\nExpected shape:\n{expected_shape}"+ )+ user_action = UserAction(+ kind=UserActionKind.CHANGE_INPUT,+ detail=f"Send input '{variable_name}' in the expected shape, which names its concept and spells out its content.",+ )+ return cls(message, variable_name=variable_name, user_action=user_action)++ @classmethod+ def make_for_bare_value_of_another_concept(+ cls,+ *,+ variable_name: str,+ declared_concept_ref: str,+ provided_description: str,+ built_concept_ref: str,+ expected_shape: str,+ ) -> "StructureValidationError":+ """The refusal for a bare value the bottom-up fallback reads as a concept the input does not accept.++ An input of a native read bottom-up (`Html`, `Page`, `SearchResult`, `Choice`, `Rating`) takes+ its value in its envelope, so a bare string there reads as a `Text`, which is no such native.+ The value is right in substance and wrong in form, so the advice is the expected shape, not a+ different declaration.+ """+ message = (+ f"Input '{variable_name}' could not be built as '{declared_concept_ref}': you provided {provided_description}, "+ f"which reads as '{built_concept_ref}', and a '{built_concept_ref}' is not a '{declared_concept_ref}'.\nExpected shape:\n{expected_shape}"+ )+ user_action = UserAction(+ kind=UserActionKind.CHANGE_INPUT,+ detail=f"Send input '{variable_name}' in the expected shape, which names its concept and spells out its content.",+ )+ return cls(message, variable_name=variable_name, user_action=user_action)+class ExplicitConceptIncompatibleError(InputShapingError):"""An explicit envelope/object names a concept incompatible with the declared one (D6).diff --git a/pipelex/core/memory/input_shaper.py b/pipelex/core/memory/input_shaper.pyindex 785dbd3a5..faa43ec11 100644--- a/pipelex/core/memory/input_shaper.py+++ b/pipelex/core/memory/input_shaper.py@@ -47,6 +47,7 @@ from pipelex.core.memory.working_memory import WorkingMemoryfrom pipelex.core.pipes.inputs.input_stuff_specs import InputStuffSpecsfrom pipelex.core.pipes.stuff_spec.stuff_spec import StuffSpecfrom pipelex.core.pipes.variable_multiplicity import VariableMultiplicity, fixed_item_count, is_multiple_multiplicity+from pipelex.core.stuffs.composite_content import CompositeContentfrom pipelex.core.stuffs.exceptions import StuffContentFactoryError, StuffFactoryErrorfrom pipelex.core.stuffs.list_content import ListContentfrom pipelex.core.stuffs.structured_content import StructuredContent@@ -64,9 +65,10 @@ class InputKind(StrEnum):``native.Anything``: it takes any JSON value but an array or a null, held as the natural contentfor the value's JSON type while the stuff keeps the declared concept (R1). ``JSON`` takes a JSONobject as it is (R7). ``DYNAMIC`` is the bottom-up fallback used for ``Dynamic`` and the natives- no arm reads top-down (Html, Page, TextAndImages, SearchResult, Composite) — the shape-driven- ``StuffFactory`` path handles the whole value there, and a value it has no reading for is- refused naming the input (R8).+ no arm reads top-down (Html, Page, TextAndImages, SearchResult, Composite, Choice, Rating): the+ shape-driven ``StuffFactory`` path reads the whole value there. Only a ``Dynamic`` input keeps+ whatever it builds; any other is compatibility-checked, and a value with no reading, or one read+ as a concept the input does not accept, is refused naming the input (R8)."""TEXT = "text"@@ -229,7 +231,7 @@ class InputShaper:# The signature genuinely does not know how to shape this — hand the whole raw value# to the bottom-up factory (today's behavior, including its own list handling).try:- return StuffFactory.make_stuff_from_stuff_content_or_data(+ stuff = StuffFactory.make_stuff_from_stuff_content_or_data(stuff_content_or_data=value,concept_provider=concept_provider,name=variable_name,@@ -250,6 +252,22 @@ class InputShaper:reason=str(exc),expected_shape=expected_shape,) from exc+ if cls._is_content_of_declared_concept(+ value=value, declared_concept=declared_concept, stuff_spec=stuff_spec, concept_provider=concept_provider+ ):+ raise StructureValidationError.make_for_content_without_its_envelope(+ variable_name=variable_name,+ declared_concept_ref=declared_concept.concept_ref,+ provided_description=cls._describe_value(value),+ expected_shape=expected_shape,+ ) from exc+ if cls._is_scalar_at_a_verdict_input(value=value, declared_concept=declared_concept, concept_provider=concept_provider):+ raise StructureValidationError.make_for_scalar_at_a_verdict_input(+ variable_name=variable_name,+ declared_concept_ref=declared_concept.concept_ref,+ provided_description=cls._describe_value(value),+ expected_shape=expected_shape,+ ) from excraise StructureValidationError.make_for_unreadable_bare_value(variable_name=variable_name,declared_concept_ref=declared_concept.concept_ref,@@ -257,6 +275,19 @@ class InputShaper:suggested_declaration=suggested_declaration,expected_shape=expected_shape,) from exc+ if not NativeConceptCode.is_dynamic_concept(concept_code=declared_concept.code) and not concept_provider.is_compatible(+ tested_concept=stuff.concept, wanted_concept=declared_concept+ ):+ # The factory reads a bare value by its own shape alone, so a string at an input of a+ # native read bottom-up builds a `Text`. Only a `Dynamic` input takes whatever it builds.+ raise StructureValidationError.make_for_bare_value_of_another_concept(+ variable_name=variable_name,+ declared_concept_ref=declared_concept.concept_ref,+ provided_description=cls._describe_value(value),+ built_concept_ref=stuff.concept.concept_ref,+ expected_shape=cls._render_expected_shape(concept_provider=concept_provider, stuff_spec=stuff_spec),+ )+ return stuffcase (InputKind.TEXT| InputKind.NUMBER@@ -312,7 +343,7 @@ class InputShaper:# A user (non-native) concept whose structure is StructuredContent dispatches its dict# top-down. Everything else — the natives no arm reads top-down (Html/Page/TextAndImages/- # SearchResult/Composite) — falls back to bottom-up building.+ # SearchResult/Composite/Choice/Rating) — falls back to bottom-up building.if not Concept.is_native_concept(concept=concept):if issubclass(concept_provider.get_structure_class(concept=concept), StructuredContent):return InputKind.STRUCTURED@@ -1000,6 +1031,62 @@ class InputShaper:expected_shape=cls._render_expected_shape(concept_provider=concept_provider, stuff_spec=stuff_spec),)+ @classmethod+ def _is_content_of_declared_concept(+ cls, *, value: Any, declared_concept: Concept, stuff_spec: StuffSpec, concept_provider: ConceptProviderAbstract+ ) -> bool:+ """Whether a bare value the fallback has no reading for is the declared concept's own content, unwrapped.++ It is when the value, or every item of a list at a multiple input, is an object whose keys are all+ fields of the concept's structure and which validates as it. `Dynamic` and `Composite` hold any+ object, so a value fitting them says nothing about what the caller meant, and they never answer.+ """+ if NativeConceptCode.is_dynamic_concept(concept_code=declared_concept.code):+ return False+ structure_class = concept_provider.get_structure_class(concept=declared_concept)+ if issubclass(structure_class, CompositeContent):+ return False+ is_multiple, _ = cls._peel_multiplicity(stuff_spec.multiplicity)+ if is_multiple:+ if not isinstance(value, list) or not value:+ return False+ items = cast("list[Any]", value)+ else:+ items = [value]+ field_names = set(structure_class.model_fields)+ for item in items:+ if not isinstance(item, dict) or not item:+ return False+ item_dict = cast("dict[Any, Any]", item)+ if not set(item_dict) <= field_names:+ return False+ try:+ structure_class.model_validate(item_dict)+ except ValidationError:+ return False+ return True++ @classmethod+ def _is_scalar_at_a_verdict_input(cls, *, value: Any, declared_concept: Concept, concept_provider: ConceptProviderAbstract) -> bool:+ """Whether a bare value the fallback has no reading for is a scalar, or a list of scalars, at an input of a verdict native.++ A caller sends a `Choice`'s key or a `Rating`'s level alone by mistake, which no container native+ invites, so only an input whose concept is or refines a verdict native answers. An object is+ never a scalar: whether it is the verdict's content unwrapped is `_is_content_of_declared_concept`'s+ question. `Dynamic` is compatible with every concept, so it never answers.+ """+ if NativeConceptCode.is_dynamic_concept(concept_code=declared_concept.code):+ return False+ if isinstance(value, dict):+ return False+ if isinstance(value, list) and any(isinstance(item, dict) for item in cast("list[Any]", value)):+ return False+ for verdict_native in (NativeConceptCode.CHOICE, NativeConceptCode.RATING):+ wanted_concept = concept_provider.get_native_concept(native_concept=verdict_native)+ if concept_provider.is_compatible(tested_concept=declared_concept, wanted_concept=wanted_concept, strict=True):+ return True+ return False+@classmethoddef _declaration_suggested_for(cls, *, value: Any) -> str | None:"""The declaration that reads a bare value the fallback has no reading for, or ``None`` when nodiff --git a/pipelex/core/memory/working_memory.py b/pipelex/core/memory/working_memory.pyindex 655b28e72..a0fbccc27 100644--- a/pipelex/core/memory/working_memory.py+++ b/pipelex/core/memory/working_memory.py@@ -13,6 +13,7 @@ from pipelex.core.memory.exceptions import (WorkingMemoryStuffNotFoundError,WorkingMemoryTypeError,)+from pipelex.core.stuffs.choice_content import ChoiceContentfrom pipelex.core.stuffs.composite_content import CompositeContentfrom pipelex.core.stuffs.date_content import DateContentfrom pipelex.core.stuffs.document_content import DocumentContent@@ -22,6 +23,7 @@ from pipelex.core.stuffs.list_content import ListContentfrom pipelex.core.stuffs.markdown_content import MarkdownContentfrom pipelex.core.stuffs.mermaid_content import MermaidContentfrom pipelex.core.stuffs.number_content import NumberContent+from pipelex.core.stuffs.rating_content import RatingContentfrom pipelex.core.stuffs.stuff import Stufffrom pipelex.core.stuffs.stuff_artefact import StuffArtefactfrom pipelex.core.stuffs.stuff_content import StuffContent, StuffContentType@@ -498,6 +500,14 @@ class WorkingMemory(WorkingMemoryAbstract[Stuff], ContextProviderAbstract):"""Get stuff content as YesNoContent if applicable."""return self.get_stuff(name=name).as_yes_no+ def get_stuff_as_choice(self, name: str) -> ChoiceContent:+ """Get stuff content as ChoiceContent if applicable."""+ return self.get_stuff(name=name).as_choice++ def get_stuff_as_rating(self, name: str) -> RatingContent:+ """Get stuff content as RatingContent if applicable."""+ return self.get_stuff(name=name).as_rating+def get_stuff_as_date(self, name: str) -> DateContent:"""Get stuff content as DateContent if applicable."""return self.get_stuff(name=name).as_date@@ -553,6 +563,16 @@ class WorkingMemory(WorkingMemoryAbstract[Stuff], ContextProviderAbstract):"""Get main stuff content as YesNoContent if applicable."""return self.get_stuff_as_yes_no(name=MAIN_STUFF_NAME)+ @property+ def main_stuff_as_choice(self) -> ChoiceContent:+ """Get main stuff content as ChoiceContent if applicable."""+ return self.get_stuff_as_choice(name=MAIN_STUFF_NAME)++ @property+ def main_stuff_as_rating(self) -> RatingContent:+ """Get main stuff content as RatingContent if applicable."""+ return self.get_stuff_as_rating(name=MAIN_STUFF_NAME)+@propertydef main_stuff_as_date(self) -> DateContent:"""Get main stuff content as DateContent if applicable."""diff --git a/pipelex/core/pipes/pipe_output.py b/pipelex/core/pipes/pipe_output.pyindex 4d417867b..2b42c272d 100644--- a/pipelex/core/pipes/pipe_output.py+++ b/pipelex/core/pipes/pipe_output.py@@ -5,6 +5,7 @@ from pydantic import Field, PrivateAttrfrom pipelex.core.memory.working_memory import WorkingMemoryfrom pipelex.core.pipes.pipe_io_artifacts import PipeIOArtifacts+from pipelex.core.stuffs.choice_content import ChoiceContentfrom pipelex.core.stuffs.date_content import DateContentfrom pipelex.core.stuffs.html_content import HtmlContentfrom pipelex.core.stuffs.image_content import ImageContent@@ -12,6 +13,7 @@ from pipelex.core.stuffs.list_content import ListContentfrom pipelex.core.stuffs.markdown_content import MarkdownContentfrom pipelex.core.stuffs.mermaid_content import MermaidContentfrom pipelex.core.stuffs.number_content import NumberContent+from pipelex.core.stuffs.rating_content import RatingContentfrom pipelex.core.stuffs.stuff import Stufffrom pipelex.core.stuffs.stuff_content import StuffContentTypefrom pipelex.core.stuffs.text_and_images_content import TextAndImagesContent@@ -130,6 +132,16 @@ class PipeOutput(PipeOutputAbstract[WorkingMemory]):"""Get main stuff content as YesNoContent if applicable."""return self.working_memory.main_stuff_as_yes_no+ @property+ def main_stuff_as_choice(self) -> ChoiceContent:+ """Get main stuff content as ChoiceContent if applicable."""+ return self.working_memory.main_stuff_as_choice++ @property+ def main_stuff_as_rating(self) -> RatingContent:+ """Get main stuff content as RatingContent if applicable."""+ return self.working_memory.main_stuff_as_rating+@propertydef main_stuff_as_date(self) -> DateContent:"""Get main stuff content as DateContent if applicable."""diff --git a/pipelex/core/registry_models.py b/pipelex/core/registry_models.pyindex 6be00be21..c59511a87 100644--- a/pipelex/core/registry_models.py+++ b/pipelex/core/registry_models.py@@ -1,5 +1,6 @@from typing import ClassVar+from pipelex.core.stuffs.choice_content import ChoiceContentfrom pipelex.core.stuffs.composite_content import CompositeContentfrom pipelex.core.stuffs.date_content import DateContentfrom pipelex.core.stuffs.document_content import DocumentContent@@ -11,6 +12,7 @@ from pipelex.core.stuffs.list_content import ListContentfrom pipelex.core.stuffs.markdown_content import MarkdownContentfrom pipelex.core.stuffs.number_content import NumberContentfrom pipelex.core.stuffs.page_content import PageContent+from pipelex.core.stuffs.rating_content import RatingContentfrom pipelex.core.stuffs.search_result_content import SearchResultContentfrom pipelex.core.stuffs.structured_content import StructuredContentfrom pipelex.core.stuffs.stuff import Stuff@@ -38,6 +40,8 @@ class CoreRegistryModels(RegistryModels):MarkdownContent,NumberContent,YesNoContent,+ ChoiceContent,+ RatingContent,DateContent,TimeContent,ImageContent,diff --git a/pipelex/core/stuffs/choice_content.py b/pipelex/core/stuffs/choice_content.pynew file mode 100644index 000000000..e07361c43--- /dev/null+++ b/pipelex/core/stuffs/choice_content.py@@ -0,0 +1,42 @@+import html+import json++from pydantic import Field+from typing_extensions import override++from pipelex.core.stuffs.stuff_content import StuffContent+from pipelex.core.stuffs.verdict_measures import UnitInterval+++class ChoiceContent(StuffContent):+ """One option picked out of a declared set"""++ choice: str = Field(description="The key of the selected option.")+ confidence: float | None = Field(+ default=None, ge=0, le=1, strict=True, description="The producer's confidence in the choice, from 0 to 1, when it reports one."+ )+ probabilities: dict[str, UnitInterval] | None = Field(+ default=None, description="The probability of each option, keyed by option key, when the producer measures a distribution."+ )++ @property+ @override+ def short_desc(self) -> str:+ return f"a choice ({self.choice})"++ @override+ def rendered_plain(self) -> str:+ return self.choice++ @override+ def rendered_html(self) -> str:+ return html.escape(self.choice)++ @override+ def rendered_markdown(self, *, level: int = 1, is_pretty: bool = False) -> str:+ return self.choice++ @override+ def rendered_json(self) -> str:+ # The rendering a prompt reads: the verdict, and only the measures the producer reported.+ return json.dumps(self.model_dump(mode="json", exclude_none=True))diff --git a/pipelex/core/stuffs/rating_content.py b/pipelex/core/stuffs/rating_content.pynew file mode 100644index 000000000..a5e5cef07--- /dev/null+++ b/pipelex/core/stuffs/rating_content.py@@ -0,0 +1,50 @@+import json++from pydantic import Field+from typing_extensions import override++from pipelex.core.stuffs.stuff_content import StuffContent+from pipelex.core.stuffs.verdict_measures import UnitInterval+++class RatingContent(StuffContent):+ """A position on an ordered scale of described levels"""++ # strict=True for the same reason as `YesNoContent.yes_no`: lax mode would turn "2" or 2.0 into a level.+ level: int = Field(ge=0, description="The index of the selected level, 0 being the first level declared.", strict=True)+ confidence: float | None = Field(+ default=None, ge=0, le=1, strict=True, description="The producer's confidence in the level, from 0 to 1, when it reports one."+ )+ probabilities: dict[str, UnitInterval] | None = Field(+ default=None,+ description="The probability of each level, keyed by level index written as text, when the producer measures a distribution.",+ )+ position: float | None = Field(+ default=None,+ ge=0,+ allow_inf_nan=False,+ strict=True,+ description="A continuous position on the scale, from 0 to the index of the last level, when the producer measures one.",+ )++ @property+ @override+ def short_desc(self) -> str:+ return f"a rating (level {self.level})"++ @override+ def rendered_plain(self) -> str:+ return str(self.level)++ @override+ def rendered_html(self) -> str:+ return str(self.level)++ @override+ def rendered_markdown(self, *, level: int = 1, is_pretty: bool = False) -> str:+ return str(self.level)++ @override+ def rendered_json(self) -> str:+ # The rendering a prompt reads: the verdict, and only the measures the producer reported.+ return json.dumps(self.model_dump(mode="json", exclude_none=True))diff --git a/pipelex/core/stuffs/stuff.py b/pipelex/core/stuffs/stuff.pyindex d7bbfabb0..82f9e715e 100644--- a/pipelex/core/stuffs/stuff.py+++ b/pipelex/core/stuffs/stuff.py@@ -9,6 +9,7 @@ from typing_extensions import overridefrom pipelex import logfrom pipelex.core.concepts.concept import Concept+from pipelex.core.stuffs.choice_content import ChoiceContentfrom pipelex.core.stuffs.date_content import DateContentfrom pipelex.core.stuffs.document_content import DocumentContentfrom pipelex.core.stuffs.exceptions import StuffContentTypeError, StuffContentValidationError@@ -18,6 +19,7 @@ from pipelex.core.stuffs.list_content import ListContentfrom pipelex.core.stuffs.markdown_content import MarkdownContentfrom pipelex.core.stuffs.mermaid_content import MermaidContentfrom pipelex.core.stuffs.number_content import NumberContent+from pipelex.core.stuffs.rating_content import RatingContentfrom pipelex.core.stuffs.stuff_artefact import StuffArtefactfrom pipelex.core.stuffs.stuff_content import StuffContent, StuffContentTypefrom pipelex.core.stuffs.text_and_images_content import TextAndImagesContent@@ -102,6 +104,14 @@ class Stuff(PrettyRenderable, CustomBaseModel, StuffAbstract[Concept, StuffContedef is_yes_no(self) -> bool:return isinstance(self.content, YesNoContent)+ @property+ def is_choice(self) -> bool:+ return isinstance(self.content, ChoiceContent)++ @property+ def is_rating(self) -> bool:+ return isinstance(self.content, RatingContent)+@propertydef is_date(self) -> bool:return isinstance(self.content, DateContent)@@ -238,6 +248,16 @@ class Stuff(PrettyRenderable, CustomBaseModel, StuffAbstract[Concept, StuffConte"""Get content as YesNoContent if applicable."""return self.content_as(content_type=YesNoContent)+ @property+ def as_choice(self) -> ChoiceContent:+ """Get content as ChoiceContent if applicable."""+ return self.content_as(content_type=ChoiceContent)++ @property+ def as_rating(self) -> RatingContent:+ """Get content as RatingContent if applicable."""+ return self.content_as(content_type=RatingContent)+@propertydef as_date(self) -> DateContent:"""Get content as DateContent if applicable."""diff --git a/pipelex/core/stuffs/verdict_measures.py b/pipelex/core/stuffs/verdict_measures.pynew file mode 100644index 000000000..cbe221ceb--- /dev/null+++ b/pipelex/core/stuffs/verdict_measures.py@@ -0,0 +1,18 @@+"""The value range shared by the verdict natives' probabilities and confidences.++The pinned definitions state the range in prose only ("from 0 to 1"), so it is the content classes'+own invariant: a content holding a probability of 1.5 is not a verdict this engine will hold,+whichever producer wrote it. It is stated as a schema constraint rather than enforced by a+validator, so a model filling the structure is told the range, and the dry-run mock factory, which+reads constraints but cannot see inside a validator, builds values within it.++Every measure is strict: an integer still reads as a number, but a boolean or a numeric string is+refused rather than coerced, so a stray `true` never becomes a probability of 1.+"""++from typing import Annotated++from pydantic import Field++UnitInterval = Annotated[float, Field(ge=0, le=1, strict=True)]+"""A probability or a confidence: a number from 0 to 1, as a distribution's value type."""diff --git a/pipelex/core/stuffs/yes_no_content.py b/pipelex/core/stuffs/yes_no_content.pyindex add4f4d7b..0b8e5495a 100644--- a/pipelex/core/stuffs/yes_no_content.py+++ b/pipelex/core/stuffs/yes_no_content.py@@ -1,4 +1,5 @@import json+from typing import Anyfrom pydantic import Fieldfrom typing_extensions import override@@ -13,6 +14,13 @@ class YesNoContent(StuffContent):# "yes"/"true"/"1"/0/1 into a bool on the dict-content path (model_validate), silently bypassing# the no-cross-kind-coercion contract the scalar envelope arm enforces. Only a real bool is accepted.yes_no: bool = Field(description="Whether the answer is yes (true) or no (false).", strict=True)+ probability: float | None = Field(+ default=None,+ ge=0,+ le=1,+ strict=True,+ description="The probability that the answer is yes, from 0 to 1, when the producer reports one.",+ )@property@override@@ -33,4 +41,8 @@ class YesNoContent(StuffContent):@overridedef rendered_json(self) -> str:- return json.dumps({"yes_no": self.yes_no})+ # The rendering a prompt reads: the verdict, and the probability only when one was reported.+ rendered: dict[str, Any] = {"yes_no": self.yes_no}+ if self.probability is not None:+ rendered["probability"] = self.probability+ return json.dumps(rendered)diff --git a/pipelex/pipeline/hint_warnings.py b/pipelex/pipeline/hint_warnings.pyindex 237edd358..96d44b315 100644--- a/pipelex/pipeline/hint_warnings.py+++ b/pipelex/pipeline/hint_warnings.py@@ -63,7 +63,9 @@ def _native_class_value_kind(*, class_name: str) -> HintSiteValueKind:Mirrors the deriver's `_class_backed_node` lookup: `TextContent` is the native Text payload and`MarkdownContent` the native Markdown one, which refines Text (both text-valued, both `prose` in thedescriptor), `NumberContent` the native Number payload (number-valued). Every other class — the- remaining natives and registered project classes alike — is not a hint-applicable site.+ remaining natives and registered project classes alike — is not a hint-applicable site. The verdict+ natives `YesNo`, `Choice` and `Rating` are structured sites where no intent word applies, `Rating`+ included despite its number-valued level.One divergence is open (L-260930-173b03): the deriver reflects a registered `RootModel` over ascalar as its root value, which this lookup still classifies as OTHER."""@@ -80,6 +82,8 @@ def _native_class_value_kind(*, class_name: str) -> HintSiteValueKind:| NativeConceptCode.HTML| NativeConceptCode.TEXT_AND_IMAGES| NativeConceptCode.YES_NO+ | NativeConceptCode.CHOICE+ | NativeConceptCode.RATING| NativeConceptCode.DATE| NativeConceptCode.TIME| NativeConceptCode.PAGEdiff --git a/pipelex/pipeline/input_form.py b/pipelex/pipeline/input_form.pyindex 6e11940b2..8855f22b2 100644--- a/pipelex/pipeline/input_form.py+++ b/pipelex/pipeline/input_form.py@@ -40,6 +40,7 @@ registry, and bundle-defined classes are only reliably current while their libra"""from collections.abc import Mapping, Sequence+from enum import StrEnumfrom typing import Any, get_originfrom annotated_types import Ge, Gt, Le, Lt, MaxLen, MinLen@@ -171,7 +172,7 @@ def build_input_form(pipes: Sequence[PipeAbstract], *, qualified_crate: Qualifie`pipe_ref` → `PipeInputFormDescriptor` for every given pipe."""qualified = qualified_crate if qualified_crate is not None else qualify_current_library_crate()- deriver = InputFormDeriver(concepts=qualified.concepts)+ deriver = InputFormDeriver(concepts=qualified.concepts, position=FormPosition.INPUT)input_form: InputForm = {}for pipe in pipes:# Slot hints come from the qualified blueprint, not the runtime spec: `StuffSpec` stays@@ -191,9 +192,11 @@ def build_output_form(pipes: Sequence[PipeAbstract], *, qualified_crate: Qualifi"""Derive the `output_form` descriptors of loaded pipes — what each pipe RESOLVES TO, described.The twin of `build_input_form`, iterating the same pipes in the same order so all three- validate artifacts share one key set, and reusing the same deriver: an output is a concept ref- exactly like an input is, so its kinds, its nesting and its constraints are the same questions- with the same answers. `derive_concept` is the entry point that describes a concept on its own,+ validate artifacts share one key set, and reusing the same derivation told its position: an+ output is a concept ref exactly like an input is, so its kinds, its nesting and its constraints+ are the same questions with the same answers, except for `YesNo`, which the output position+ states as an `object` carrying its probability where the input position takes the bare boolean.+ `derive_concept` is the entry point that describes a concept on its own,which is precisely what an output is — a node belonging to no slot. It is not a new code patheither: it is what runs for every nested concept field of every input.@@ -224,7 +227,7 @@ def build_output_form(pipes: Sequence[PipeAbstract], *, qualified_crate: Qualifi`pipe_ref` → `PipeOutputFormDescriptor` for every given pipe."""qualified = qualified_crate if qualified_crate is not None else qualify_current_library_crate()- deriver = InputFormDeriver(concepts=qualified.concepts)+ deriver = InputFormDeriver(concepts=qualified.concepts, position=FormPosition.OUTPUT)output_form: OutputForm = {}for pipe in pipes:node = deriver.derive_concept(name=_OUTPUT_NODE_NAME, concept_ref=pipe.output.concept.concept_ref)@@ -260,11 +263,27 @@ def _slot_hints_of(slot_value: "str | InputSlotBlueprint | None") -> dict[str, sreturn slot_value.hints if isinstance(slot_value, InputSlotBlueprint) else None+class FormPosition(StrEnum):+ """Which side of a pipe a deriver describes.++ The standard reads one native differently by position: a caller supplies a `YesNo` as its bare+ verdict, so the input-form descriptor states it as a `boolean`, while a producer may report a+ probability beside the verdict, so the output-form descriptor states it as an `object` carrying+ `yes_no` and `probability`, at every depth of an output node. It is one derivation reading a+ different row of the native table, never a second derivation, and `YesNo` is the only native+ whose row differs.+ """++ INPUT = "input"+ OUTPUT = "output"++class InputFormDeriver:"""Derives field descriptors over one qualified crate's concepts (`QualifiedCrateContent.concepts`)."""- def __init__(self, *, concepts: dict[str, ConceptBlueprint | str]) -> None:+ def __init__(self, *, concepts: dict[str, ConceptBlueprint | str], position: FormPosition) -> None:self._concepts = concepts+ self._position = position# ---- Pipe slots -------------------------------------------------------------------------------@@ -398,7 +417,13 @@ class InputFormDeriver:case NativeConceptCode.NUMBER:return NumberField(name=name, concept_ref=node_ref, refines=refines, description=text, required=True, integer=False)case NativeConceptCode.YES_NO:- return BooleanField(name=name, concept_ref=node_ref, refines=refines, description=text, required=True)+ match self._position:+ case FormPosition.INPUT:+ # A caller supplies the verdict alone, so the slot is the bare boolean.+ return BooleanField(name=name, concept_ref=node_ref, refines=refines, description=text, required=True)+ case FormPosition.OUTPUT:+ # A producer may report a probability beside the verdict: the pinned object.+ return self._pinned_object_node(name=name, node_ref=node_ref, refines=refines, description=text, pinned=pinned, seen=seen)case NativeConceptCode.TIME:return TextField(name=name, concept_ref=node_ref, refines=refines, description=text, required=True, format="time")case NativeConceptCode.DOCUMENT:@@ -406,22 +431,16 @@ class InputFormDeriver:case NativeConceptCode.IMAGE:return ImageField(name=name, concept_ref=node_ref, refines=refines, description=text, required=True)case (- NativeConceptCode.DATE+ NativeConceptCode.CHOICE+ | NativeConceptCode.RATING+ | NativeConceptCode.DATE| NativeConceptCode.HTML| NativeConceptCode.JSON| NativeConceptCode.PAGE| NativeConceptCode.TEXT_AND_IMAGES| NativeConceptCode.SEARCH_RESULT):- pinned_structure = pinned.structure if isinstance(pinned.structure, dict) else {}- return ObjectField(- name=name,- concept_ref=node_ref,- refines=refines,- description=text,- required=True,- fields=[self._structure_field(name=field_name, field=field, seen=seen) for field_name, field in pinned_structure.items()],- )+ return self._pinned_object_node(name=name, node_ref=node_ref, refines=refines, description=text, pinned=pinned, seen=seen)case NativeConceptCode.DYNAMIC | NativeConceptCode.ANYTHING | NativeConceptCode.COMPOSITE:# The three natives that declare no pinned structure: `_pinned_structure` returns# None for exactly these, so there is no authored shape to expand and `unknown` states@@ -432,6 +451,20 @@ class InputFormDeriver:# rendered `{}`, which `JSONContent` then refused.return UnknownField(name=name, concept_ref=node_ref, refines=refines, description=text, required=True)+ def _pinned_object_node(+ self, *, name: str, node_ref: str, refines: list[str] | None, description: str, pinned: ConceptBlueprint, seen: frozenset[str]+ ) -> InputFormField:+ """A native stated as an `object` over its pinned structure's fields."""+ pinned_structure = pinned.structure if isinstance(pinned.structure, dict) else {}+ return ObjectField(+ name=name,+ concept_ref=node_ref,+ refines=refines,+ description=description,+ required=True,+ fields=[self._structure_field(name=field_name, field=field, seen=seen) for field_name, field in pinned_structure.items()],+ )+def _class_backed_node(self,*,diff --git a/pipelex/test_extras/mthds_corpus/entries/native_choice_ticket_routing/bundle.mthds b/pipelex/test_extras/mthds_corpus/entries/native_choice_ticket_routing/bundle.mthdsnew file mode 100644index 000000000..70f896680--- /dev/null+++ b/pipelex/test_extras/mthds_corpus/entries/native_choice_ticket_routing/bundle.mthds@@ -0,0 +1,40 @@+domain = "ticket_routing"+description = "Sending a support ticket to the team a verdict picked for it"+main_pipe = "route_ticket"++[concept]+Team = { description = "The team a support ticket is routed to", refines = "Choice" }++[pipe.route_ticket]+type = "PipeCondition"+description = "Sends the ticket to the team its routing verdict picked"+inputs = { ticket = "Text", team = "Team" }+output = "Text?"+expression = "team.choice"+default_outcome = "continue"++[pipe.route_ticket.outcomes]+billing = "reply_billing"+technical = "reply_technical"++[pipe.reply_billing]+type = "PipeLLM"+description = "Writes the billing team's first reply to the ticket"+inputs = { ticket = "Text" }+output = "Text"+prompt = """+Write the billing team's first one-line reply to this ticket.++$ticket+"""++[pipe.reply_technical]+type = "PipeLLM"+description = "Writes the technical team's first reply to the ticket"+inputs = { ticket = "Text" }+output = "Text"+prompt = """+Write the technical team's first one-line reply to this ticket.++$ticket+"""diff --git a/pipelex/test_extras/mthds_corpus/entries/native_choice_ticket_routing/entry.toml b/pipelex/test_extras/mthds_corpus/entries/native_choice_ticket_routing/entry.tomlnew file mode 100644index 000000000..d6a15642c--- /dev/null+++ b/pipelex/test_extras/mthds_corpus/entries/native_choice_ticket_routing/entry.toml@@ -0,0 +1,10 @@+name = "native_choice_ticket_routing"+description = "A support ticket routed on the option a choice verdict picked"++validity = "valid"+tier = "dry"+granularity = "focused"++covers = [+ "native.choice",+]diff --git a/pipelex/test_extras/mthds_corpus/entries/native_choice_ticket_routing/inputs.json b/pipelex/test_extras/mthds_corpus/entries/native_choice_ticket_routing/inputs.jsonnew file mode 100644index 000000000..6f84edcb1--- /dev/null+++ b/pipelex/test_extras/mthds_corpus/entries/native_choice_ticket_routing/inputs.json@@ -0,0 +1,19 @@+{+ "ticket": {+ "concept": "native.Text",+ "content": {+ "text": "I was charged twice for the March invoice."+ }+ },+ "team": {+ "concept": "ticket_routing.Team",+ "content": {+ "choice": "billing",+ "confidence": 0.82,+ "probabilities": {+ "billing": 0.91,+ "technical": 0.09+ }+ }+ }+}diff --git a/pipelex/test_extras/mthds_corpus/entries/native_rating_damage_report/bundle.mthds b/pipelex/test_extras/mthds_corpus/entries/native_rating_damage_report/bundle.mthdsnew file mode 100644index 000000000..c99b953b1--- /dev/null+++ b/pipelex/test_extras/mthds_corpus/entries/native_rating_damage_report/bundle.mthds@@ -0,0 +1,16 @@+domain = "damage_report"+description = "Writing a claim note from how badly a parcel was damaged"+main_pipe = "write_claim_note"++[pipe.write_claim_note]+type = "PipeLLM"+description = "Writes a claim note from the damage level a rating verdict placed the parcel at"+inputs = { damage = "Rating", parcel = "Text" }+output = "Text"+prompt = """+The parcel below was rated at damage level $damage, on a scale where 0 is intact, 1 is scuffed and 2 is crushed.++$parcel++Write a two-line claim note for the carrier.+"""diff --git a/pipelex/test_extras/mthds_corpus/entries/native_rating_damage_report/entry.toml b/pipelex/test_extras/mthds_corpus/entries/native_rating_damage_report/entry.tomlnew file mode 100644index 000000000..3b0a9b95b--- /dev/null+++ b/pipelex/test_extras/mthds_corpus/entries/native_rating_damage_report/entry.toml@@ -0,0 +1,10 @@+name = "native_rating_damage_report"+description = "A claim note written from the level a rating verdict placed a damaged parcel at"++validity = "valid"+tier = "dry"+granularity = "focused"++covers = [+ "native.rating",+]diff --git a/pipelex/test_extras/mthds_corpus/entries/native_rating_damage_report/inputs.json b/pipelex/test_extras/mthds_corpus/entries/native_rating_damage_report/inputs.jsonnew file mode 100644index 000000000..20b173b99--- /dev/null+++ b/pipelex/test_extras/mthds_corpus/entries/native_rating_damage_report/inputs.json@@ -0,0 +1,21 @@+{+ "parcel": {+ "concept": "native.Text",+ "content": {+ "text": "A carton of glassware, delivered with one corner caved in."+ }+ },+ "damage": {+ "concept": "native.Rating",+ "content": {+ "level": 1,+ "confidence": 0.64,+ "probabilities": {+ "0": 0.12,+ "1": 0.71,+ "2": 0.17+ },+ "position": 1.05+ }+ }+}diff --git a/pipelex/test_extras/mthds_corpus/vocabulary.toml b/pipelex/test_extras/mthds_corpus/vocabulary.tomlindex b043e0591..d27a00f5a 100644--- a/pipelex/test_extras/mthds_corpus/vocabulary.toml+++ b/pipelex/test_extras/mthds_corpus/vocabulary.toml@@ -41,6 +41,12 @@ code = "Number"[native.yes_no]code = "YesNo"+[native.choice]+code = "Choice"++[native.rating]+code = "Rating"+[native.date]code = "Date"diff --git a/pyproject.toml b/pyproject.tomlindex f4860d31e..79816e1ed 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -31,7 +31,7 @@ dependencies = ["json2html>=1.3.0","kajson==0.7.1","markdown-it-py[linkify]>=3.0.0", # the Markdown concept, the `markdown` filter and the built-in PDF engine- "mthds==0.18.0",+ "mthds==0.19.0","networkx>=3.4.2","openai>=2.0.0","opentelemetry-api>=1.39.0",diff --git a/subject_grants.toml b/subject_grants.tomlindex 7807388f0..2f3bab7e8 100644--- a/subject_grants.toml+++ b/subject_grants.toml@@ -2892,6 +2892,10 @@ rationale = "Memory getter keyed by the stuff name; single operand."param = "name"rationale = "Memory getter keyed by the stuff name; content type stays keyword."+["pipelex/core/memory/working_memory.py::WorkingMemory.get_stuff_as_choice"]+param = "name"+rationale = "Entity-keyed getter on working memory."+["pipelex/core/memory/working_memory.py::WorkingMemory.get_stuff_as_date"]param = "name"rationale = "Entity-keyed getter on working memory."@@ -2920,6 +2924,10 @@ rationale = "Memory getter keyed by the stuff name; single operand."param = "name"rationale = "Memory getter keyed by the stuff name; single operand."+["pipelex/core/memory/working_memory.py::WorkingMemory.get_stuff_as_rating"]+param = "name"+rationale = "Entity-keyed getter on working memory."+["pipelex/core/memory/working_memory.py::WorkingMemory.get_stuff_as_str"]param = "name"rationale = "Memory getter keyed by the stuff name; single operand."diff --git a/tests/data/input_semantics/output_bundle.mthds b/tests/data/input_semantics/output_bundle.mthdsindex e90aa95ab..a7aef10b3 100644--- a/tests/data/input_semantics/output_bundle.mthds+++ b/tests/data/input_semantics/output_bundle.mthds@@ -119,3 +119,15 @@ description = "OUTPUT_pipe_output_native_image: a file-bearing output, whose coninputs = { subject = "Text" }output = "Image"prompt = "$subject"++# A verdict output. Where a producer reports a `native.YesNo`, the descriptor states it as an+# object carrying `yes_no` and the optional `probability`, the reading the input side does not take.+[pipe.output_native_yes_no]+type = "PipeLLM"+description = "OUTPUT_pipe_output_native_yes_no: a verdict output, an object where a slot is a bare boolean"+inputs = { note = "Text" }+output = "YesNo"+prompt = """+OUTPUT_prompt_output_native_yes_no+@note+"""diff --git a/tests/data/input_semantics/rejected/non_string_choices.mthds_invalid b/tests/data/input_semantics/rejected/non_string_choices.mthds_invalidindex 9b9aec1f9..8acac3764 100644--- a/tests/data/input_semantics/rejected/non_string_choices.mthds_invalid+++ b/tests/data/input_semantics/rejected/non_string_choices.mthds_invalid@@ -1,8 +1,8 @@domain = "input_semantics_rejected"description = "REJECTED probe: choices must be strings — numeric choice values are refused"-[concept.Rating]+[concept.StarRating]description = "A rating with numeric choices"-[concept.Rating.structure]+[concept.StarRating.structure]stars = { choices = [1, 2, 3], description = "numeric choices" }diff --git a/tests/data/input_semantics/scaffold_bundle.mthds b/tests/data/input_semantics/scaffold_bundle.mthdsindex 988f29fef..445a04f61 100644--- a/tests/data/input_semantics/scaffold_bundle.mthds+++ b/tests/data/input_semantics/scaffold_bundle.mthds@@ -87,3 +87,14 @@ SCAFFOLD_prompt_dynamic_marker_dollar: $dynamic_promptedAnd the bookmark beside it:@bookmark"""++# The verdict natives at slot positions. `native.YesNo` is a `boolean` where a caller supplies it,+# so its compact template is the bare verdict; `native.Choice` and `native.Rating` carry optional+# measures beside their verdict, so the descriptor states them as objects and every projection+# keeps their `{concept, content}` envelope, which is the only form the input shaper takes back.+[pipe.scaffold_verdict_natives]+type = "PipeCompose"+description = "SCAFFOLD_pipe_scaffold_verdict_natives: the three verdict natives, each at a slot position"+inputs = { approved_in = "YesNo", team_in = "Choice", grade_in = "Rating" }+output = "Text"+template = "SCAFFOLD_template_verdict_natives: $approved_in $team_in $grade_in"diff --git a/tests/integration/pipelex/pipeline/test_input_form_verdict_natives.py b/tests/integration/pipelex/pipeline/test_input_form_verdict_natives.pynew file mode 100644index 000000000..adf0f100d--- /dev/null+++ b/tests/integration/pipelex/pipeline/test_input_form_verdict_natives.py@@ -0,0 +1,214 @@+"""`YesNo` is read by position: a `boolean` where a caller supplies it, an `object` where a producer reports it.++`Choice` and `Rating` are objects on both sides, with their pinned fields. The position is set once by+`build_input_form` and `build_output_form` and read in `YesNo`'s row alone, so these tests reach a+`YesNo` at every depth on each side: at the top, as a list's item, as a nested structure field, through+a refinement, and through a reflected class field.+"""++from __future__ import annotations++from typing import TYPE_CHECKING++import pytest+from kajson.kajson_manager import KajsonManager+from pydantic import Field++from pipelex.core.stuffs.structured_content import StructuredContent+from pipelex.core.stuffs.yes_no_content import YesNoContent+from pipelex.interpreter_hub import (+ clear_current_library,+ get_current_library_id_or_none,+ get_library_manager,+ set_current_library,+)+from pipelex.pipeline.input_form import FieldKind, InputFormField, InputFormItem, ObjectField, ObjectItem, build_input_form, build_output_form+from pipelex.pipeline.validate_bundle import validate_bundle+from tests.helpers.input_form import as_list, fields_by_name++if TYPE_CHECKING:+ from collections.abc import Callable++ from mthds.protocol.output_form import PipeOutputFormDescriptor++ from pipelex.pipeline.input_form import PipeInputFormDescriptor+++def _teardown_validation_library(outer_library_id: str) -> None:+ """Tear down the library `validate_bundle` left open on success, restoring the outer one."""+ validation_library_id = get_current_library_id_or_none()+ if validation_library_id is not None and validation_library_id != outer_library_id:+ set_current_library(library_id=outer_library_id)+ get_library_manager().teardown(library_id=validation_library_id)+ clear_current_library()+++def _field_by_name(descriptor: PipeInputFormDescriptor, name: str) -> InputFormField:+ by_name = {field.name: field for field in descriptor.fields}+ assert name in by_name, f"Expected a field named {name!r}, got {sorted(by_name)}"+ return by_name[name]+++class InputFormVerdictPayload(StructuredContent):+ """A registered structure class holding a `YesNo` field, reached by reflection rather than by a structure table."""++ approved: YesNoContent = Field(description="PROBE_desc_reflected_approved")+++_VERDICTS_MTHDS = """+domain = "verdict_forms"+description = "The verdict natives on both sides of a pipe, at every depth"++[concept.Assessment]+description = "An assessment carrying verdicts as fields"++[concept.Assessment.structure]+urgent = { type = "concept", concept_ref = "native.YesNo", description = "Whether it is urgent", required = true }+flags = { type = "list", item_type = "concept", item_concept_ref = "native.YesNo", description = "One verdict per flag" }++[concept.Escalation]+description = "Whether to escalate"+refines = "YesNo"++[concept.Reviewed]+description = "A class-backed concept whose class holds a verdict"+structure = "InputFormVerdictPayload"++[concept.Team]+description = "The team a message is routed to"+refines = "Choice"++[pipe.verdicts_in]+type = "PipeCompose"+description = "Every verdict native as an input"+output = "Text"+template = "$answer $answers $team $grade $assessment $escalation $reviewed"++[pipe.verdicts_in.inputs]+answer = "YesNo"+answers = "YesNo[]"+team = "Choice"+grade = "Rating"+assessment = "Assessment"+escalation = "Escalation"+reviewed = "Reviewed"++[pipe.yes_no_out]+type = "PipeLLM"+description = "A yes/no answer"+output = "YesNo"+prompt = "Is it raining?"++[pipe.yes_no_list_out]+type = "PipeLLM"+description = "Several yes/no answers"+output = "YesNo[]"+prompt = "Is it raining, and is it cold?"++[pipe.assessment_out]+type = "PipeLLM"+description = "An assessment"+output = "Assessment"+prompt = "Assess it."++[pipe.escalation_out]+type = "PipeLLM"+description = "Whether to escalate"+output = "Escalation"+prompt = "Escalate?"++[pipe.reviewed_out]+type = "PipeLLM"+description = "A review"+output = "Reviewed"+prompt = "Review it."++[pipe.choice_out]+type = "PipeLLM"+description = "A team"+output = "Team"+prompt = "Pick a team."++[pipe.rating_out]+type = "PipeLLM"+description = "A grade"+output = "Rating"+prompt = "Grade it."+"""+++def _assert_yes_no_object(node: InputFormField | InputFormItem) -> None:+ """The output-side `YesNo`: an object with the verdict required and the probability optional."""+ assert isinstance(node, (ObjectField, ObjectItem)), f"Expected an object node, got {node.kind!r}"+ fields = {field.name: field for field in node.fields}+ assert list(fields) == ["yes_no", "probability"], "Pinned-blueprint fields, in pinned order"+ assert fields["yes_no"].kind == FieldKind.BOOLEAN+ assert fields["yes_no"].required is True+ assert fields["probability"].kind == FieldKind.NUMBER+ assert fields["probability"].required is False++[email protected](loop_scope="class")+class TestVerdictNativesByPosition:+ """`YesNo` is a `boolean` where a caller supplies it and an `object` where a producer reports it.++ `Choice` and `Rating` are objects on both sides.+ """++ async def _derive(self, load_empty_library: Callable[[], str]) -> tuple[dict[str, PipeInputFormDescriptor], dict[str, PipeOutputFormDescriptor]]:+ outer_library_id = load_empty_library()+ registry = KajsonManager.get_class_registry()+ try:+ registry.register_class(InputFormVerdictPayload)+ result = await validate_bundle(mthds_contents=[_VERDICTS_MTHDS])+ return build_input_form(result.pipes), build_output_form(result.pipes)+ finally:+ registry.unregister_class(InputFormVerdictPayload)+ _teardown_validation_library(outer_library_id)++ async def test_a_yes_no_input_is_a_boolean_at_every_depth(self, load_empty_library: Callable[[], str]) -> None:+ input_form, _ = await self._derive(load_empty_library)+ verdicts = input_form["verdict_forms.verdicts_in"]+ assert _field_by_name(verdicts, "answer").kind == FieldKind.BOOLEAN+ assert as_list(_field_by_name(verdicts, "answers")).item.kind == FieldKind.BOOLEAN+ escalation = _field_by_name(verdicts, "escalation")+ assert escalation.kind == FieldKind.BOOLEAN, "A concept refining YesNo reads as YesNo"+ assert escalation.refines == ["native.YesNo"]+ assessment = fields_by_name(_field_by_name(verdicts, "assessment"))+ assert assessment["urgent"].kind == FieldKind.BOOLEAN+ assert as_list(assessment["flags"]).item.kind == FieldKind.BOOLEAN+ assert fields_by_name(_field_by_name(verdicts, "reviewed"))["approved"].kind == FieldKind.BOOLEAN++ async def test_a_yes_no_output_is_an_object_at_every_depth(self, load_empty_library: Callable[[], str]) -> None:+ _, output_form = await self._derive(load_empty_library)+ _assert_yes_no_object(output_form["verdict_forms.yes_no_out"].field)+ _assert_yes_no_object(as_list(output_form["verdict_forms.yes_no_list_out"].field).item)+ escalation = output_form["verdict_forms.escalation_out"].field+ _assert_yes_no_object(escalation)+ assert escalation.refines == ["native.YesNo"]+ assessment = fields_by_name(output_form["verdict_forms.assessment_out"].field)+ _assert_yes_no_object(assessment["urgent"])+ _assert_yes_no_object(as_list(assessment["flags"]).item)+ _assert_yes_no_object(fields_by_name(output_form["verdict_forms.reviewed_out"].field)["approved"])++ async def test_choice_and_rating_are_objects_on_both_sides(self, load_empty_library: Callable[[], str]) -> None:+ input_form, output_form = await self._derive(load_empty_library)+ verdicts = input_form["verdict_forms.verdicts_in"]+ for team in (_field_by_name(verdicts, "team"), output_form["verdict_forms.choice_out"].field):+ assert team.kind == FieldKind.OBJECT+ team_fields = fields_by_name(team)+ assert list(team_fields) == ["choice", "confidence", "probabilities"], "Pinned-blueprint fields, in pinned order"+ assert team_fields["choice"].kind == FieldKind.TEXT+ assert team_fields["choice"].required is True+ assert team_fields["confidence"].kind == FieldKind.NUMBER+ assert team_fields["confidence"].required is False+ assert team_fields["probabilities"].kind == FieldKind.UNKNOWN, "A dict field has no form kind"+ assert output_form["verdict_forms.choice_out"].field.refines == ["native.Choice"]+ for grade in (_field_by_name(verdicts, "grade"), output_form["verdict_forms.rating_out"].field):+ assert grade.kind == FieldKind.OBJECT+ grade_fields = fields_by_name(grade)+ assert list(grade_fields) == ["level", "confidence", "probabilities", "position"], "Pinned-blueprint fields, in pinned order"+ assert grade_fields["level"].kind == FieldKind.NUMBER+ assert grade_fields["level"].integer is True+ assert grade_fields["level"].required is True+ assert grade_fields["position"].required is Falsediff --git a/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_verdict_routing.py b/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_verdict_routing.pynew file mode 100644index 000000000..e0d792a46--- /dev/null+++ b/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_verdict_routing.py@@ -0,0 +1,130 @@+"""A `PipeCondition` branches on a verdict native's members, live and with no inference.++The verdict natives exist to be branched on: a `Choice` routes by its key, a `Rating` by its level,+and a `YesNo` gates on its probability when its producer reported one. Every branch here is a+`PipeCompose`, so the run is live without spending anything, and the outcome proves the expression+read the member it names rather than whatever a dry run would walk.+"""++from typing import Any++import pytest++from pipelex.pipeline.runner import PipelexMTHDSProtocol++_VERDICT_ROUTING_MTHDS = """+domain = "verdict_routing"+description = "Routing on the members of the verdict natives"++[concept]+Team = { description = "The team a ticket is routed to", refines = "Choice" }++[pipe.route_by_team]+type = "PipeCondition"+description = "Routes on the option a choice picked"+inputs = { team = "Team" }+output = "Text"+expression = "team.choice"+default_outcome = "fail"++[pipe.route_by_team.outcomes]+billing = "say_billing"+technical = "say_technical"++[pipe.say_billing]+type = "PipeCompose"+description = "Names the billing desk"+inputs = { team = "Team" }+output = "Text"+template = "billing desk, routed as $team"++[pipe.say_technical]+type = "PipeCompose"+description = "Names the technical desk"+inputs = { team = "Team" }+output = "Text"+template = "technical desk, routed as $team"++[pipe.route_by_grade]+type = "PipeCondition"+description = "Routes on the level a rating selected"+inputs = { grade = "Rating" }+output = "Text"+expression = "'severe' if grade.level >= 2 else 'mild'"+default_outcome = "fail"++[pipe.route_by_grade.outcomes]+severe = "say_severe"+mild = "say_mild"++[pipe.say_severe]+type = "PipeCompose"+description = "Names a severe grade"+inputs = { grade = "Rating" }+output = "Text"+template = "severe at level $grade"++[pipe.say_mild]+type = "PipeCompose"+description = "Names a mild grade"+inputs = { grade = "Rating" }+output = "Text"+template = "mild at level $grade"++[pipe.gate_by_probability]+type = "PipeCondition"+description = "Gates on the probability a yes/no verdict carries, when it carries one"+inputs = { approved = "YesNo" }+output = "Text"+expression = "'confident' if approved.probability is not none and approved.probability >= 0.8 else 'unsure'"+default_outcome = "fail"++[pipe.gate_by_probability.outcomes]+confident = "say_confident"+unsure = "say_unsure"++[pipe.say_confident]+type = "PipeCompose"+description = "Names a confident verdict"+inputs = { approved = "YesNo" }+output = "Text"+template = "confident $approved"++[pipe.say_unsure]+type = "PipeCompose"+description = "Names an unsure verdict"+inputs = { approved = "YesNo" }+output = "Text"+template = "unsure $approved"+"""+++async def _run(*, pipe_code: str, inputs: dict[str, Any]) -> str:+ response = await PipelexMTHDSProtocol().execute(pipe_code=pipe_code, mthds_contents=[_VERDICT_ROUTING_MTHDS], inputs=inputs)+ return response.pipe_output.main_stuff.as_text.text++[email protected](loop_scope="class")+class TestPipeConditionVerdictRouting:+ @pytest.mark.parametrize(+ ("choice", "expected"), [("billing", "billing desk, routed as billing"), ("technical", "technical desk, routed as technical")]+ )+ async def test_a_choice_routes_by_its_key(self, choice: str, expected: str) -> None:+ team = {+ "concept": "verdict_routing.Team",+ "content": {"choice": choice, "confidence": 0.7, "probabilities": {"billing": 0.7, "technical": 0.3}},+ }+ assert await _run(pipe_code="route_by_team", inputs={"team": team}) == expected++ @pytest.mark.parametrize(("level", "expected"), [(2, "severe at level 2"), (0, "mild at level 0")])+ async def test_a_rating_routes_by_its_level(self, level: int, expected: str) -> None:+ grade = {"concept": "native.Rating", "content": {"level": level, "probabilities": {"0": 0.2, "1": 0.3, "2": 0.5}}}+ assert await _run(pipe_code="route_by_grade", inputs={"grade": grade}) == expected++ async def test_a_yes_no_gates_on_a_reported_probability(self) -> None:+ approved = {"concept": "native.YesNo", "content": {"yes_no": True, "probability": 0.93}}+ assert await _run(pipe_code="gate_by_probability", inputs={"approved": approved}) == "confident yes"++ async def test_a_yes_no_without_a_probability_reads_as_absent(self) -> None:+ """A bare boolean builds a `YesNo` with `yes_no` alone, and the guard reads its absent probability as `none`."""+ assert await _run(pipe_code="gate_by_probability", inputs={"approved": True}) == "unsure yes"diff --git a/tests/integration/pipelex/pipes/operator/pipe_llm/test_pipe_llm_yes_no_output_path.py b/tests/integration/pipelex/pipes/operator/pipe_llm/test_pipe_llm_yes_no_output_path.pyindex 84acf20b9..9f0271e4e 100644--- a/tests/integration/pipelex/pipes/operator/pipe_llm/test_pipe_llm_yes_no_output_path.py+++ b/tests/integration/pipelex/pipes/operator/pipe_llm/test_pipe_llm_yes_no_output_path.py@@ -66,5 +66,17 @@ class TestPipeLLMYesNoOutputPath:schema = object_class.model_json_schema()assert schema["properties"]["yes_no"]["description"]- # And the produced verdict is a YesNo, not text.+ # The model fills the native as pinned: its probability is offered, optional and described, so it+ # may report its own estimate beside the verdict, within the range the schema states.+ assert "probability" in schema["properties"]+ assert "probability" not in schema.get("required", [])+ assert schema["properties"]["probability"]["description"]+ probability_arms = schema["properties"]["probability"]["anyOf"]+ assert {"type": "number", "minimum": 0, "maximum": 1} in probability_arms++ # And the produced verdict is a YesNo, not text, whose verdict is a real boolean.assert pipe_output.main_stuff.is_yes_no+ verdict = pipe_output.main_stuff.content+ assert isinstance(verdict, YesNoContent)+ assert isinstance(verdict.yes_no, bool)+ assert verdict.probability is None or 0 <= verdict.probability <= 1diff --git a/tests/unit/pipelex/cli/dev_cli/test_projection_reference.py b/tests/unit/pipelex/cli/dev_cli/test_projection_reference.pyindex 28f72773b..5a1550c8c 100644--- a/tests/unit/pipelex/cli/dev_cli/test_projection_reference.py+++ b/tests/unit/pipelex/cli/dev_cli/test_projection_reference.py@@ -217,6 +217,38 @@ class TestOutOfMatrixNatives:projected = project_inputs_template(descriptor=_descriptor(date_slot), explicit=False)["date_in"]assert projected == {"concept": "native.Date", "content": {"date": "2026-01-01", "time": "12:00:00"}}+ @pytest.mark.parametrize(+ ("native_ref", "fields", "expected_content"),+ [+ (+ "native.Choice",+ [+ {"kind": "text", "name": "choice", "required": True},+ {"kind": "number", "name": "confidence", "required": False, "integer": False},+ ],+ {"choice": "choice_value", "confidence": 0.0},+ ),+ (+ "native.Rating",+ [+ {"kind": "number", "name": "level", "required": True, "integer": True},+ {"kind": "number", "name": "position", "required": False, "integer": False},+ ],+ {"level": 0, "position": 0.0},+ ),+ ],+ )+ def test_a_verdict_object_native_keeps_its_envelope(self, native_ref: str, fields: list[dict[str, Any]], expected_content: dict[str, Any]):+ """`Choice` and `Rating` are objects in the descriptor, so they keep their envelope with no entry in the out-of-matrix set."""+ verdict_slot = {"kind": "object", "name": "verdict_in", "concept_ref": native_ref, "required": True, "fields": fields}+ projected = project_inputs_template(descriptor=_descriptor(verdict_slot), explicit=False)["verdict_in"]+ assert projected == {"concept": native_ref, "content": expected_content}++ def test_a_yes_no_slot_stays_the_bare_boolean(self):+ """The input side states `YesNo` as a `boolean`, so its compact template is the verdict alone, probability or not."""+ yes_no_slot = {"kind": "boolean", "name": "approved_in", "concept_ref": "native.YesNo", "required": True}+ assert project_inputs_template(descriptor=_descriptor(yes_no_slot), explicit=False) == {"approved_in": False}+def test_a_json_slot_unwraps_to_its_object_in_the_compact_shape(self):"""`native.JSON` is not out of matrix: the shaper reads a bare object there literally, so thecompact shape is the object its `json_obj` holds, and the explicit shape keeps the content form.diff --git a/tests/unit/pipelex/cogt/doc_gen/test_input_shape.py b/tests/unit/pipelex/cogt/doc_gen/test_input_shape.pyindex 848104e4f..67d851852 100644--- a/tests/unit/pipelex/cogt/doc_gen/test_input_shape.py+++ b/tests/unit/pipelex/cogt/doc_gen/test_input_shape.py@@ -5,11 +5,14 @@ from typing import Literalfrom pydantic import Fieldfrom pipelex.cogt.doc_gen.input_shape import InputShape, InputShapeKind, shape_of_class, shape_of_input+from pipelex.core.stuffs.choice_content import ChoiceContentfrom pipelex.core.stuffs.composite_content import CompositeContentfrom pipelex.core.stuffs.image_content import ImageContentfrom pipelex.core.stuffs.markdown_content import MarkdownContent+from pipelex.core.stuffs.rating_content import RatingContentfrom pipelex.core.stuffs.structured_content import StructuredContentfrom pipelex.core.stuffs.text_content import TextContent+from pipelex.core.stuffs.yes_no_content import YesNoContentclass _LineItem(StructuredContent):@@ -79,6 +82,9 @@ class TestInputShape:def test_native_contents_are_leaves(self) -> None:assert shape_of_class(TextContent).kind == InputShapeKind.TEXTassert shape_of_class(MarkdownContent).kind == InputShapeKind.MARKDOWN+ assert shape_of_class(YesNoContent).kind == InputShapeKind.BOOLEAN+ assert shape_of_class(ChoiceContent).kind == InputShapeKind.TEXT+ assert shape_of_class(RatingContent).kind == InputShapeKind.NUMBERassert "url" in shape_of_class(ImageContent).fieldsdef test_a_recursive_structure_stops_where_it_repeats(self) -> None:diff --git a/tests/unit/pipelex/cogt/doc_gen/test_plain_data.py b/tests/unit/pipelex/cogt/doc_gen/test_plain_data.pyindex 0823207ef..1aa8aa0f3 100644--- a/tests/unit/pipelex/cogt/doc_gen/test_plain_data.py+++ b/tests/unit/pipelex/cogt/doc_gen/test_plain_data.py@@ -2,12 +2,15 @@ import datetimefrom enum import StrEnumfrom pipelex.cogt.doc_gen.plain_data import plain_data+from pipelex.core.stuffs.choice_content import ChoiceContentfrom pipelex.core.stuffs.composite_content import CompositeContentfrom pipelex.core.stuffs.date_content import DateContentfrom pipelex.core.stuffs.list_content import ListContentfrom pipelex.core.stuffs.number_content import NumberContent+from pipelex.core.stuffs.rating_content import RatingContentfrom pipelex.core.stuffs.structured_content import StructuredContentfrom pipelex.core.stuffs.text_content import TextContent+from pipelex.core.stuffs.yes_no_content import YesNoContentclass _Color(StrEnum):@@ -38,3 +41,8 @@ class TestPlainData:assert plain_data(DateContent(date=datetime.date(2026, 9, 30))) == datetime.date(2026, 9, 30)with_time = DateContent(date=datetime.date(2026, 9, 30), time=datetime.time(9, 30))assert plain_data(with_time) == datetime.datetime(2026, 9, 30, 9, 30)++ def test_a_verdict_is_its_verdict(self) -> None:+ assert plain_data(YesNoContent(yes_no=True, probability=0.9)) is True+ assert plain_data(ChoiceContent(choice="billing", confidence=0.7)) == "billing"+ assert plain_data(RatingContent(level=2, position=1.8)) == 2diff --git a/tests/unit/pipelex/core/memory/input_shaper/test_errors.py b/tests/unit/pipelex/core/memory/input_shaper/test_errors.pyindex 08a5a7148..b83dc4a48 100644--- a/tests/unit/pipelex/core/memory/input_shaper/test_errors.py+++ b/tests/unit/pipelex/core/memory/input_shaper/test_errors.py@@ -97,6 +97,15 @@ ERROR_CASES: list[tuple[str, str, VariableMultiplicity | None, Any, type[InputShWrongScalarKindError,"wrap the whole list in one",),+ # A bare value the bottom-up fallback builds as another concept is refused, never kept as that concept:+ # a bare string at a `Choice` slot used to become a `Text` stuff, and a `PipeCondition` routing on+ # `team.choice` then met a text with no `choice` to read.+ ("choice-bare-string", "native.Choice", None, "billing", StructureValidationError, "which reads as 'native.Text'"),+ ("rating-bare-string", "native.Rating", None, "two", StructureValidationError, "which reads as 'native.Text'"),+ ("html-bare-string", "native.Html", None, "<p>hi</p>", StructureValidationError, "which reads as 'native.Text'"),+ ("search-result-bare-string-list", "native.SearchResult", True, ["a", "b"], StructureValidationError, "which reads as 'native.Text'"),+ # The input side reads `YesNo` as a bare boolean: its object form, probability included, needs the envelope.+ ("yes-no-object", "native.YesNo", None, {"yes_no": True, "probability": 0.9}, WrongScalarKindError, "expects a boolean"),# D6 an explicit envelope naming an incompatible concept.("explicit-incompatible",diff --git a/tests/unit/pipelex/core/memory/input_shaper/test_fallback_refusal.py b/tests/unit/pipelex/core/memory/input_shaper/test_fallback_refusal.pyindex e4ff57745..4499f4fa0 100644--- a/tests/unit/pipelex/core/memory/input_shaper/test_fallback_refusal.py+++ b/tests/unit/pipelex/core/memory/input_shaper/test_fallback_refusal.py@@ -70,6 +70,8 @@ class TestInputShaperFallbackRefusal:("native.Dynamic", None, True, "'Anything'"),("native.Dynamic", True, [1, "a"], "'Anything[]'"),("native.Dynamic", True, [{"a": 1}, {"b": 2}], "'JSON[]'"),+ # A container native keeps the declaration advice for a scalar: only a verdict is sent as one by mistake.+ ("native.Html", None, 3, "'Anything'"),],)def test_the_advice_names_the_declaration_that_reads_the_value(@@ -113,3 +115,84 @@ class TestInputShaperFallbackRefusal:assert factory_reason in messageassert "no reading" not in messageassert isinstance(exc_info.value.__cause__, StuffFactoryError)++ @pytest.mark.parametrize(+ ("concept_ref", "multiplicity", "provided_value"),+ [+ ("native.Choice", None, {"choice": "billing"}),+ ("native.Choice", None, {"choice": "billing", "confidence": 0.9}),+ ("native.Rating", None, {"level": 2}),+ ("native.Html", None, {"inner_html": "<p>hi</p>"}),+ ("native.Html", True, [{"inner_html": "<p>a</p>"}, {"inner_html": "<p>b</p>"}]),+ ],+ )+ def test_the_declared_concept_s_own_content_unwrapped_is_told_to_send_the_envelope(+ self, concept_ref: str, multiplicity: VariableMultiplicity | None, provided_value: Any+ ) -> None:+ input_specs = build_input_specs([("payload", concept_ref, multiplicity)])+ payload_input: dict[str, Any] = {"payload": provided_value}++ with pytest.raises(StructureValidationError, match="without the envelope that names its concept") as exc_info:+ InputShaper.shape(payload_input, input_specs=input_specs, concept_provider=get_concept_library(), read_scope=None)++ error = exc_info.value+ assert f"could not be built as '{concept_ref}'" in str(error)+ assert "Expected shape:" in str(error)+ assert isinstance(error.__cause__, StuffFactoryError)+ # The value is right in substance: declaring the input as `JSON` would discard the concept the method asked for.+ assert error.user_action is not None+ assert error.user_action.kind == UserActionKind.CHANGE_INPUT+ assert "expected shape" in error.user_action.detail+ assert "Declare" not in error.user_action.detail++ @pytest.mark.parametrize(+ ("concept_ref", "multiplicity", "provided_value", "suggested_declaration"),+ [+ # A key the structure does not have, or a field of the wrong kind, is not the concept's content.+ ("native.Choice", None, {"choice": "billing", "team": "support"}, "'JSON'"),+ ("native.Choice", None, {"choice": 3}, "'JSON'"),+ ("native.Html", True, [{"inner_html": "<p>a</p>"}, {"b": 2}], "'JSON[]'"),+ # `Composite` holds any object, so fitting it says nothing about what the caller meant.+ ("native.Composite", True, [{"a": 1}], "'JSON[]'"),+ ],+ )+ def test_an_object_that_is_not_the_declared_concept_s_content_keeps_the_declaration_advice(+ self, concept_ref: str, multiplicity: VariableMultiplicity | None, provided_value: Any, suggested_declaration: str+ ) -> None:+ input_specs = build_input_specs([("payload", concept_ref, multiplicity)])+ payload_input: dict[str, Any] = {"payload": provided_value}++ with pytest.raises(StructureValidationError, match="with no reading for this one") as exc_info:+ InputShaper.shape(payload_input, input_specs=input_specs, concept_provider=get_concept_library(), read_scope=None)++ user_action = exc_info.value.user_action+ assert user_action is not None+ assert f"as {suggested_declaration}," in user_action.detail++ @pytest.mark.parametrize(+ ("concept_ref", "multiplicity", "provided_value", "provided_description"),+ [+ ("native.Rating", None, 2, "a number (2)"),+ ("native.Rating", True, [1, 2], "a list of 2 item(s)"),+ ("native.Rating", None, True, "a boolean (true)"),+ ("native.Choice", None, 3, "a number (3)"),+ ],+ )+ def test_a_scalar_at_a_verdict_input_is_told_to_send_the_envelope(+ self, concept_ref: str, multiplicity: VariableMultiplicity | None, provided_value: Any, provided_description: str+ ) -> None:+ input_specs = build_input_specs([("payload", concept_ref, multiplicity)])+ payload_input: dict[str, Any] = {"payload": provided_value}++ with pytest.raises(StructureValidationError, match="takes its value in the envelope that names its concept") as exc_info:+ InputShaper.shape(payload_input, input_specs=input_specs, concept_provider=get_concept_library(), read_scope=None)++ error = exc_info.value+ assert f"could not be built as '{concept_ref}': you provided {provided_description}," in str(error)+ assert "Expected shape:" in str(error)+ assert isinstance(error.__cause__, StuffFactoryError)+ # A bare level is a verdict's level without the verdict: declaring the input `Anything` would discard the verdict the method branches on.+ assert error.user_action is not None+ assert error.user_action.kind == UserActionKind.CHANGE_INPUT+ assert "expected shape" in error.user_action.detail+ assert "Declare" not in error.user_action.detaildiff --git a/tests/unit/pipelex/core/memory/input_shaper/test_scalar_arms.py b/tests/unit/pipelex/core/memory/input_shaper/test_scalar_arms.pyindex 1b1baa474..7735379db 100644--- a/tests/unit/pipelex/core/memory/input_shaper/test_scalar_arms.py+++ b/tests/unit/pipelex/core/memory/input_shaper/test_scalar_arms.py@@ -53,9 +53,9 @@ SCALAR_ARM_CASES: list[tuple[str, str, Any, str, StuffContent]] = ["shaper_test.ShaperInvoice",ShaperInvoice(invoice_number="INV-001", amount=1250.0),),- # D5 Dynamic and the out-of-matrix natives: bottom-up passthrough.+ # D5 Dynamic: bottom-up passthrough, whatever the value builds. An out-of-matrix native refuses a+ # bare value its own shape does not read (see the error cases).("dynamic-str-bottom-up", "native.Dynamic", "hi", "native.Text", TextContent(text="hi")),- ("html-out-of-matrix-bottom-up", "native.Html", "hi", "native.Text", TextContent(text="hi")),# R1 Anything: the slot keeps its declared concept, and the content is the natural one for the# value's JSON type. Nothing is guessed from a string's text: a URL or an ISO date stays text.("anything-string", "native.Anything", "hi", "native.Anything", TextContent(text="hi")),diff --git a/tests/unit/pipelex/core/stuffs/verdict_content/test_choice_content.py b/tests/unit/pipelex/core/stuffs/verdict_content/test_choice_content.pynew file mode 100644index 000000000..560f66f77--- /dev/null+++ b/tests/unit/pipelex/core/stuffs/verdict_content/test_choice_content.py@@ -0,0 +1,71 @@+import json++import pytest+from pydantic import ValidationError++from pipelex.core.stuffs.choice_content import ChoiceContent+++class TestChoiceContent:+ """`Choice` requires its option key; `confidence` and `probabilities` are optional measures within [0, 1]."""++ def test_requires_the_choice(self):+ with pytest.raises(ValidationError, match="choice"):+ ChoiceContent.model_validate({})++ def test_measures_are_absent_by_default(self):+ content = ChoiceContent(choice="billing")+ assert content.confidence is None+ assert content.probabilities is None++ def test_accepts_every_measure(self):+ content = ChoiceContent(choice="billing", confidence=0.7, probabilities={"billing": 0.8, "technical": 0.2})+ assert content.choice == "billing"+ assert content.confidence == 0.7+ assert content.probabilities == {"billing": 0.8, "technical": 0.2}++ @pytest.mark.parametrize("confidence", [-0.1, 1.1])+ def test_refuses_a_confidence_outside_the_unit_interval(self, confidence: float):+ with pytest.raises(ValidationError, match="confidence"):+ ChoiceContent(choice="billing", confidence=confidence)++ @pytest.mark.parametrize("probability", [-0.1, 1.1])+ def test_refuses_a_probability_outside_the_unit_interval(self, probability: float):+ with pytest.raises(ValidationError, match="probabilities"):+ ChoiceContent(choice="billing", probabilities={"billing": probability})++ def test_renders_as_its_key(self):+ content = ChoiceContent(choice="billing", confidence=0.7)+ assert content.rendered_plain() == "billing"+ assert content.rendered_markdown() == "billing"+ assert content.rendered_html() == "billing"+ assert content.rendered_for_prompt() == "billing"++ def test_html_rendering_escapes_the_key(self):+ assert ChoiceContent(choice="<b>").rendered_html() == "<b>"++ def test_rendered_json_writes_the_present_members_only(self):+ assert json.loads(ChoiceContent(choice="billing").rendered_json()) == {"choice": "billing"}+ assert json.loads(ChoiceContent(choice="billing", probabilities={"billing": 1.0}).rendered_json()) == {+ "choice": "billing",+ "probabilities": {"billing": 1.0},+ }++ def test_smart_dump_writes_absent_members_null(self):+ assert ChoiceContent(choice="billing").smart_dump() == {"choice": "billing", "confidence": None, "probabilities": None}++ def test_short_desc_names_the_choice(self):+ assert ChoiceContent(choice="billing").short_desc == "a choice (billing)"++ @pytest.mark.parametrize(+ "measures",+ [{"confidence": True}, {"confidence": "0.9"}, {"probabilities": {"billing": True}}, {"probabilities": {"billing": "1"}}],+ )+ def test_refuses_a_measure_that_is_not_a_number(self, measures: dict[str, object]):+ with pytest.raises(ValidationError):+ ChoiceContent.model_validate({"choice": "billing", **measures})++ def test_reads_integer_measures_as_numbers(self):+ content = ChoiceContent.model_validate({"choice": "billing", "confidence": 1, "probabilities": {"billing": 1, "other": 0}})+ assert content.confidence == 1.0+ assert content.probabilities == {"billing": 1.0, "other": 0.0}diff --git a/tests/unit/pipelex/core/stuffs/verdict_content/test_rating_content.py b/tests/unit/pipelex/core/stuffs/verdict_content/test_rating_content.pynew file mode 100644index 000000000..babc39c55--- /dev/null+++ b/tests/unit/pipelex/core/stuffs/verdict_content/test_rating_content.py@@ -0,0 +1,73 @@+import json++import pytest+from pydantic import ValidationError++from pipelex.core.stuffs.rating_content import RatingContent+++class TestRatingContent:+ """`Rating` requires its level index; `confidence`, `probabilities` and `position` are optional measures."""++ def test_requires_the_level(self):+ with pytest.raises(ValidationError, match="level"):+ RatingContent.model_validate({})++ def test_measures_are_absent_by_default(self):+ content = RatingContent(level=2)+ assert content.confidence is None+ assert content.probabilities is None+ assert content.position is None++ def test_accepts_every_measure(self):+ content = RatingContent(level=1, confidence=0.6, probabilities={"0": 0.1, "1": 0.6, "2": 0.3}, position=1.2)+ assert content.level == 1+ assert content.position == 1.2+ assert content.probabilities == {"0": 0.1, "1": 0.6, "2": 0.3}++ def test_refuses_a_negative_level(self):+ with pytest.raises(ValidationError, match="level"):+ RatingContent(level=-1)++ def test_refuses_a_negative_position(self):+ with pytest.raises(ValidationError, match="position"):+ RatingContent(level=0, position=-0.5)++ @pytest.mark.parametrize("confidence", [-0.1, 1.1])+ def test_refuses_a_confidence_outside_the_unit_interval(self, confidence: float):+ with pytest.raises(ValidationError, match="confidence"):+ RatingContent(level=0, confidence=confidence)++ def test_refuses_a_probability_outside_the_unit_interval(self):+ with pytest.raises(ValidationError, match="probabilities"):+ RatingContent(level=0, probabilities={"0": 1.2})++ def test_renders_as_its_level(self):+ content = RatingContent(level=3, position=2.7)+ assert content.rendered_plain() == "3"+ assert content.rendered_markdown() == "3"+ assert content.rendered_html() == "3"+ assert content.rendered_for_prompt() == "3"++ def test_rendered_json_writes_the_present_members_only(self):+ assert json.loads(RatingContent(level=0).rendered_json()) == {"level": 0}+ assert json.loads(RatingContent(level=2, position=1.8).rendered_json()) == {"level": 2, "position": 1.8}++ def test_smart_dump_writes_absent_members_null(self):+ assert RatingContent(level=1).smart_dump() == {"level": 1, "confidence": None, "probabilities": None, "position": None}++ def test_short_desc_names_the_level(self):+ assert RatingContent(level=2).short_desc == "a rating (level 2)"++ @pytest.mark.parametrize(+ "measures",+ [{"confidence": False}, {"confidence": "0.5"}, {"probabilities": {"0": True}}, {"position": True}, {"position": "1.5"}],+ )+ def test_refuses_a_measure_that_is_not_a_number(self, measures: dict[str, object]):+ with pytest.raises(ValidationError):+ RatingContent.model_validate({"level": 1, **measures})++ def test_reads_integer_measures_as_numbers(self):+ content = RatingContent.model_validate({"level": 1, "confidence": 1, "probabilities": {"0": 0, "1": 1}, "position": 1})+ assert content.position == 1.0+ assert content.probabilities == {"0": 0.0, "1": 1.0}diff --git a/tests/unit/pipelex/core/stuffs/verdict_content/test_verdict_accessors.py b/tests/unit/pipelex/core/stuffs/verdict_content/test_verdict_accessors.pynew file mode 100644index 000000000..f78708c0e--- /dev/null+++ b/tests/unit/pipelex/core/stuffs/verdict_content/test_verdict_accessors.py@@ -0,0 +1,36 @@+from pipelex.core.concepts.concept_factory import ConceptFactory+from pipelex.core.concepts.native.concept_native import NativeConceptCode+from pipelex.core.memory.working_memory_factory import WorkingMemoryFactory+from pipelex.core.stuffs.choice_content import ChoiceContent+from pipelex.core.stuffs.rating_content import RatingContent+from pipelex.core.stuffs.stuff_factory import StuffFactory+++class TestVerdictAccessors:+ """A Python caller reads a verdict back through typed accessors, as it reads a `YesNo`."""++ def test_stuff_and_memory_accessors_narrow_a_choice(self):+ stuff = StuffFactory.make_stuff(+ concept=ConceptFactory.make_native_concept(native_concept_code=NativeConceptCode.CHOICE),+ content=ChoiceContent(choice="billing"),+ name="team",+ )+ assert stuff.is_choice+ assert not stuff.is_rating+ assert stuff.as_choice.choice == "billing"+ memory = WorkingMemoryFactory.make_from_single_stuff(stuff=stuff)+ assert memory.get_stuff_as_choice("team").choice == "billing"+ assert memory.main_stuff_as_choice.choice == "billing"++ def test_stuff_and_memory_accessors_narrow_a_rating(self):+ stuff = StuffFactory.make_stuff(+ concept=ConceptFactory.make_native_concept(native_concept_code=NativeConceptCode.RATING),+ content=RatingContent(level=2),+ name="grade",+ )+ assert stuff.is_rating+ assert not stuff.is_choice+ assert stuff.as_rating.level == 2+ memory = WorkingMemoryFactory.make_from_single_stuff(stuff=stuff)+ assert memory.get_stuff_as_rating("grade").level == 2+ assert memory.main_stuff_as_rating.level == 2diff --git a/tests/unit/pipelex/core/stuffs/verdict_content/test_yes_no_probability.py b/tests/unit/pipelex/core/stuffs/verdict_content/test_yes_no_probability.pynew file mode 100644index 000000000..c5cd92aa2--- /dev/null+++ b/tests/unit/pipelex/core/stuffs/verdict_content/test_yes_no_probability.py@@ -0,0 +1,47 @@+import json++import pytest+from pydantic import ValidationError++from pipelex.core.stuffs.yes_no_content import YesNoContent+from pipelex.tools.templating.text_format import TextFormat+++class TestYesNoProbability:+ """`YesNo` gains an optional `probability`: absent unless the producer reports one, and always within [0, 1]."""++ def test_probability_is_absent_by_default(self):+ assert YesNoContent(yes_no=True).probability is None++ @pytest.mark.parametrize("probability", [0.0, 0.42, 1.0])+ def test_accepts_a_probability_within_the_unit_interval(self, probability: float):+ assert YesNoContent(yes_no=True, probability=probability).probability == probability++ @pytest.mark.parametrize("probability", [-0.01, 1.01, 1.5])+ def test_refuses_a_probability_outside_the_unit_interval(self, probability: float):+ with pytest.raises(ValidationError, match="probability"):+ YesNoContent(yes_no=True, probability=probability)++ def test_rendered_json_carries_a_reported_probability(self):+ assert json.loads(YesNoContent(yes_no=False, probability=0.12).rendered_json()) == {"yes_no": False, "probability": 0.12}++ def test_rendered_json_leaves_an_absent_probability_out(self):+ assert json.loads(YesNoContent(yes_no=True).rendered_json()) == {"yes_no": True}++ def test_renders_as_the_verdict_whatever_the_probability(self):+ content = YesNoContent(yes_no=True, probability=0.83)+ assert content.rendered_plain() == "yes"+ assert content.rendered_for_prompt(text_format=TextFormat.MARKDOWN) == "yes"+ assert content.rendered_html() == "yes"++ def test_smart_dump_writes_an_absent_probability_null(self):+ assert YesNoContent(yes_no=True).smart_dump() == {"yes_no": True, "probability": None}++ @pytest.mark.parametrize("probability", [True, False, "0.9"])+ def test_refuses_a_probability_that_is_not_a_number(self, probability: object):+ # A stray `true` coerced to 1.0 would read as a confident yes.+ with pytest.raises(ValidationError):+ YesNoContent.model_validate({"yes_no": True, "probability": probability})++ def test_reads_an_integer_probability_as_a_number(self):+ assert YesNoContent.model_validate({"yes_no": True, "probability": 1}).probability == 1.0diff --git a/tests/unit/pipelex/core/stuffs/yes_no_content/test_data.py b/tests/unit/pipelex/core/stuffs/yes_no_content/test_data.pyindex b36cefa3e..662a9aacb 100644--- a/tests/unit/pipelex/core/stuffs/yes_no_content/test_data.py+++ b/tests/unit/pipelex/core/stuffs/yes_no_content/test_data.py@@ -6,9 +6,9 @@ class TestData:SAMPLE_TRUE = TrueSAMPLE_FALSE = False- # Expected outputs for smart_dump- EXPECTED_SMART_DUMP_TRUE: ClassVar[dict[str, Any]] = {"yes_no": True}- EXPECTED_SMART_DUMP_FALSE: ClassVar[dict[str, Any]] = {"yes_no": False}+ # Expected outputs for smart_dump: an unreported probability is written null, as an absent `Date.time` is+ EXPECTED_SMART_DUMP_TRUE: ClassVar[dict[str, Any]] = {"yes_no": True, "probability": None}+ EXPECTED_SMART_DUMP_FALSE: ClassVar[dict[str, Any]] = {"yes_no": False, "probability": None}# Expected outputs for render methodsEXPECTED_RENDERED_PLAIN_TRUE = "yes"diff --git a/tests/unit/pipelex/libraries/test_fingerprint_pins.py b/tests/unit/pipelex/libraries/test_fingerprint_pins.pyindex f4096d75e..43dc9499d 100644--- a/tests/unit/pipelex/libraries/test_fingerprint_pins.py+++ b/tests/unit/pipelex/libraries/test_fingerprint_pins.py@@ -25,9 +25,11 @@ _PROBE_BUNDLE_PATH = Path(__file__).parents[3] / "data" / "input_semantics" / "p# The normalized pin was recomputed again when MTHDS v0.9.0 made `native.Html`'s `css_class`# optional: normalization materializes the pinned natives into the crate, so a standard change to# a pinned definition legitimately moves every conforming implementation's normalized digest — the-# content pin, which hashes only authored content, did not move.+# content pin, which hashes only authored content, did not move. It moved once more, for the same+# reason, when MTHDS 3.0.0 gave `native.YesNo` its optional `probability`: removing that one member+# from the pinned definition reproduces the previous digest exactly._PINNED_CONTENT_FINGERPRINT = "053d3ce1a1963feffcea1aaea21e6329a7d2d2371cecdb92eb4a1e51269b0043"-_PINNED_NORMALIZED_FINGERPRINT = "8d6fd88088228beb4f5fdad5b204a30146e8fcfc9392df93caa7df37d4ed471a"+_PINNED_NORMALIZED_FINGERPRINT = "6c53e12e4dd7af352130382c4dd39dc3ac4767783b30f3e42cc8f2c42f84dffa"_MTHDS_TEST_VERSION = "0.0.0-test"diff --git a/tests/unit/pipelex/pipeline/test_input_form_deriver.py b/tests/unit/pipelex/pipeline/test_input_form_deriver.pyindex bcc8888ff..6810657a3 100644--- a/tests/unit/pipelex/pipeline/test_input_form_deriver.py+++ b/tests/unit/pipelex/pipeline/test_input_form_deriver.py@@ -13,7 +13,7 @@ from pydantic import Field, RootModelfrom pipelex.core.concepts.concept_blueprint import ConceptBlueprintfrom pipelex.core.concepts.concept_structure_blueprint import ConceptStructureBlueprint, ConceptStructureBlueprintFieldTypefrom pipelex.core.stuffs.structured_content import StructuredContent-from pipelex.pipeline.input_form import FieldKind, InputFormDeriver+from pipelex.pipeline.input_form import FieldKind, FormPosition, InputFormDeriverfrom pipelex.system.registries.class_registry_access import get_class_registryfrom tests.helpers.input_form import as_list, as_object, fields_by_name@@ -59,7 +59,7 @@ class TestInputFormDeriverEscapeHatches:structure={"label": "The label", "child": _concept_field(concept_ref="demo.Node")},),}- node = InputFormDeriver(concepts=concepts).derive_concept(name="root", concept_ref="demo.Node")+ node = InputFormDeriver(concepts=concepts, position=FormPosition.INPUT).derive_concept(name="root", concept_ref="demo.Node")child = as_object(node).fields[1]assert child.name == "child"@@ -71,7 +71,7 @@ class TestInputFormDeriverEscapeHatches:"demo.Left": ConceptBlueprint(description="Left", structure={"right": _concept_field(concept_ref="demo.Right")}),"demo.Right": ConceptBlueprint(description="Right", structure={"left": _concept_field(concept_ref="demo.Left")}),}- left = InputFormDeriver(concepts=concepts).derive_concept(name="left", concept_ref="demo.Left")+ left = InputFormDeriver(concepts=concepts, position=FormPosition.INPUT).derive_concept(name="left", concept_ref="demo.Left")right = as_object(as_object(left).fields[0])assert right.fields[0].kind == FieldKind.UNKNOWN@@ -82,7 +82,7 @@ class TestInputFormDeriverEscapeHatches:concepts: dict[str, ConceptBlueprint | str] = {"demo.Ghost": ConceptBlueprint(description="Backed by a class nobody registered", structure="NoSuchRegisteredClass"),}- ghost = InputFormDeriver(concepts=concepts).derive_concept(name="ghost", concept_ref="demo.Ghost")+ ghost = InputFormDeriver(concepts=concepts, position=FormPosition.INPUT).derive_concept(name="ghost", concept_ref="demo.Ghost")assert ghost.kind == FieldKind.UNKNOWNassert ghost.concept_ref == "demo.Ghost"@@ -90,7 +90,7 @@ class TestInputFormDeriverEscapeHatches:def test_concept_absent_from_the_crate_is_unknown_without_a_class(self) -> None:"""A slot typed with a concept the crate never saw (a `library_dirs` load) still gets a descriptor."""- missing = InputFormDeriver(concepts={}).derive_concept(name="missing", concept_ref="elsewhere.Missing")+ missing = InputFormDeriver(concepts={}, position=FormPosition.INPUT).derive_concept(name="missing", concept_ref="elsewhere.Missing")assert missing.kind == FieldKind.UNKNOWNassert missing.concept_ref == "elsewhere.Missing"@@ -100,7 +100,7 @@ class TestInputFormDeriverEscapeHatches:concepts: dict[str, ConceptBlueprint | str] = {"demo.RefinedScore": ConceptBlueprint(description="Refines a dependency's score", refines="dep->other.Score"),}- node = InputFormDeriver(concepts=concepts).derive_concept(name="score", concept_ref="demo.RefinedScore")+ node = InputFormDeriver(concepts=concepts, position=FormPosition.INPUT).derive_concept(name="score", concept_ref="demo.RefinedScore")assert node.kind == FieldKind.UNKNOWNassert node.refines == ["dep->other.Score"]@@ -114,7 +114,7 @@ class TestInputFormDeriverEscapeHatches:registry = get_class_registry()registry.register_class(SelfReferentialPayload)try:- node = InputFormDeriver(concepts=concepts).derive_concept(name="recursive", concept_ref="demo.Recursive")+ node = InputFormDeriver(concepts=concepts, position=FormPosition.INPUT).derive_concept(name="recursive", concept_ref="demo.Recursive")finally:registry.unregister_class(SelfReferentialPayload)@@ -132,7 +132,7 @@ class TestInputFormDeriverEscapeHatches:registry = get_class_registry()registry.register_class(RootBackedPayload)try:- node = InputFormDeriver(concepts=concepts).derive_concept(name="root_backed", concept_ref="demo.RootBacked")+ node = InputFormDeriver(concepts=concepts, position=FormPosition.INPUT).derive_concept(name="root_backed", concept_ref="demo.RootBacked")finally:registry.unregister_class(RootBackedPayload)@@ -150,7 +150,7 @@ class TestInputFormDeriverEscapeHatches:registry = get_class_registry()registry.register_class(RootBackedSlug)try:- node = InputFormDeriver(concepts=concepts).derive_concept(name="slug", concept_ref="demo.Slug")+ node = InputFormDeriver(concepts=concepts, position=FormPosition.INPUT).derive_concept(name="slug", concept_ref="demo.Slug")finally:registry.unregister_class(RootBackedSlug)@@ -166,7 +166,7 @@ class TestInputFormDeriverEscapeHatches:registry = get_class_registry()registry.register_class(RootBackedTagList)try:- node = InputFormDeriver(concepts=concepts).derive_concept(name="tag_list", concept_ref="demo.TagList")+ node = InputFormDeriver(concepts=concepts, position=FormPosition.INPUT).derive_concept(name="tag_list", concept_ref="demo.TagList")finally:registry.unregister_class(RootBackedTagList)diff --git a/tests/unit/pipelex/pipeline/test_input_form_hints.py b/tests/unit/pipelex/pipeline/test_input_form_hints.pyindex e4674b743..0bcf3bf6c 100644--- a/tests/unit/pipelex/pipeline/test_input_form_hints.py+++ b/tests/unit/pipelex/pipeline/test_input_form_hints.py@@ -5,7 +5,7 @@ duplication, and preserved-content riding.from pipelex.core.concepts.concept_blueprint import ConceptBlueprintfrom pipelex.core.concepts.concept_structure_blueprint import ConceptStructureBlueprint, ConceptStructureBlueprintFieldType-from pipelex.pipeline.input_form import FieldKind, InputFormDeriver, NumberField+from pipelex.pipeline.input_form import FieldKind, FormPosition, InputFormDeriver, NumberFieldfrom tests.helpers.input_form import as_kind, as_list, fields_by_name_CONCEPTS: dict[str, ConceptBlueprint | str] = {@@ -38,7 +38,7 @@ _CONCEPTS: dict[str, ConceptBlueprint | str] = {def _deriver() -> InputFormDeriver:- return InputFormDeriver(concepts=dict(_CONCEPTS))+ return InputFormDeriver(concepts=dict(_CONCEPTS), position=FormPosition.INPUT)class TestConceptEffectiveHints:@@ -115,6 +115,6 @@ class TestHintFreeByteIdentity:structure={"note": ConceptStructureBlueprint(description="a note", type=ConceptStructureBlueprintFieldType.TEXT)},)}- node = InputFormDeriver(concepts=concepts).derive_concept(name="plain", concept_ref="docs.Plain")+ node = InputFormDeriver(concepts=concepts, position=FormPosition.INPUT).derive_concept(name="plain", concept_ref="docs.Plain")assert "hints" not in node.model_dump()assert all("hints" not in field for field in node.model_dump()["fields"])diff --git a/tests/unit/pipelex/pipeline/test_input_form_list_items.py b/tests/unit/pipelex/pipeline/test_input_form_list_items.pyindex e94595c7c..abfeee461 100644--- a/tests/unit/pipelex/pipeline/test_input_form_list_items.py+++ b/tests/unit/pipelex/pipeline/test_input_form_list_items.py@@ -4,7 +4,7 @@ from __future__ import annotationsfrom pipelex.core.concepts.concept_blueprint import ConceptBlueprintfrom pipelex.core.concepts.concept_structure_blueprint import ConceptStructureBlueprint, ConceptStructureBlueprintFieldType-from pipelex.pipeline.input_form import InputFormDeriver, ObjectItem, TextItem+from pipelex.pipeline.input_form import FormPosition, InputFormDeriver, ObjectItem, TextItemfrom tests.helpers.input_form import as_list, as_object@@ -31,7 +31,7 @@ class TestDerivedListItemsAreNameless:},),}- post = InputFormDeriver(concepts=concepts).derive_concept(name="post", concept_ref="demo.Post")+ post = InputFormDeriver(concepts=concepts, position=FormPosition.INPUT).derive_concept(name="post", concept_ref="demo.Post")item = as_list(as_object(post).fields[0]).itemassert isinstance(item, TextItem), f"Expected the nameless text model, got '{type(item).__name__}'"@@ -53,7 +53,7 @@ class TestDerivedListItemsAreNameless:},),}- box = InputFormDeriver(concepts=concepts).derive_concept(name="box", concept_ref="demo.Box")+ box = InputFormDeriver(concepts=concepts, position=FormPosition.INPUT).derive_concept(name="box", concept_ref="demo.Box")item = as_list(as_object(box).fields[0]).itemassert isinstance(item, ObjectItem), f"Expected the nameless object model, got '{type(item).__name__}'"diff --git a/tests/unit/pipelex/pipeline/test_markdown_input_form_and_hints.py b/tests/unit/pipelex/pipeline/test_markdown_input_form_and_hints.pyindex 86ec32703..ece2a76ff 100644--- a/tests/unit/pipelex/pipeline/test_markdown_input_form_and_hints.py+++ b/tests/unit/pipelex/pipeline/test_markdown_input_form_and_hints.py@@ -5,7 +5,7 @@ from pipelex.core.domains.domain_blueprint import DomainBlueprintfrom pipelex.libraries.crate_qualification import qualify_cratefrom pipelex.libraries.library_crate import LibraryCratefrom pipelex.pipeline.hint_warnings import build_hint_warnings-from pipelex.pipeline.input_form import FieldKind, InputFormDeriver+from pipelex.pipeline.input_form import FieldKind, FormPosition, InputFormDeriver_CONCEPTS: dict[str, ConceptBlueprint | str] = {# A report refining native Markdown, which refines Text: text-valued, so `label` applies.@@ -18,7 +18,7 @@ _CONCEPTS: dict[str, ConceptBlueprint | str] = {class TestMarkdownInputFormAndHints:def test_native_markdown_is_prose(self):"""A Markdown input is typed as its source, like a Text one: a `prose` node."""- node = InputFormDeriver(concepts={}).derive_concept(name="report", concept_ref="native.Markdown")+ node = InputFormDeriver(concepts={}, position=FormPosition.INPUT).derive_concept(name="report", concept_ref="native.Markdown")assert node.kind is FieldKind.PROSEassert node.concept_ref == "native.Markdown"@@ -31,7 +31,7 @@ class TestMarkdownInputFormAndHints:)def test_markdown_chains_are_text_valued_sites(self, concept_ref: str, expected_kind: FieldKind):"""An intent word applies to a Markdown-backed concept, in the descriptor and in the lint alike."""- node = InputFormDeriver(concepts=dict(_CONCEPTS)).derive_concept(name="field", concept_ref=concept_ref)+ node = InputFormDeriver(concepts=dict(_CONCEPTS), position=FormPosition.INPUT).derive_concept(name="field", concept_ref=concept_ref)assert node.kind is expected_kindcrate = LibraryCrate(diff --git a/uv.lock b/uv.lockindex f8c980b0e..8d0c08afe 100644--- a/uv.lock+++ b/uv.lock@@ -2738,7 +2738,7 @@ wheels = [[[package]]name = "mthds"-version = "0.18.0"+version = "0.19.0"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "httpx" },@@ -2747,9 +2747,9 @@ dependencies = [{ name = "tomlkit" },{ name = "typing-extensions" },]-sdist = { url = "https://files.pythonhosted.org/packages/48/ba/a9b2a7902ccea184c4589f7c9eedeef66aa46a9bd1c8f099a7240669f833/mthds-0.18.0.tar.gz", hash = "sha256:589dfde53672966030b454f099979f91dcc1bd67958585c46ed6c8f89bf0e08c", size = 275816, upload-time = "2026-10-03T15:44:22.98Z" }+sdist = { url = "https://files.pythonhosted.org/packages/e7/dc/b793c0e03a1a7599bd35d876f46cb801dfe7d83f8f1685beb48672eb6a47/mthds-0.19.0.tar.gz", hash = "sha256:bf49afce9ae9302c524929b00ba4697959a3ffc8bc059d89d6de1e42ec60106a", size = 281433, upload-time = "2026-10-03T22:58:58.201Z" }wheels = [- { url = "https://files.pythonhosted.org/packages/44/b0/9868dba5ca03b23ba54b7636ebd194e8c16b2eb90a5631f8ad2cb19a5947/mthds-0.18.0-py3-none-any.whl", hash = "sha256:a2778e43b943b9aa3d3ab4f0422d57a6dc1245abe4ce84435c821f26a4d3f599", size = 111480, upload-time = "2026-10-03T15:44:21.441Z" },+ { url = "https://files.pythonhosted.org/packages/61/f6/332fc128ea66f91996bdd0de9cf1aa779604ec423a29c4bca9285cc89732/mthds-0.19.0-py3-none-any.whl", hash = "sha256:42e0894c063bf2f47b4695e63a4f80429beefe388f20e3d88ffc9d4485c60e0e", size = 111462, upload-time = "2026-10-03T22:58:56.838Z" },][[package]]@@ -3707,7 +3707,7 @@ requires-dist = [{ name = "mkdocs-meta-manager", marker = "extra == 'docs'", specifier = ">=1.1.0" },{ name = "mkdocs-redirects", marker = "extra == 'docs'", specifier = "==1.2.2" },{ name = "moto", extras = ["dynamodb", "s3"], marker = "extra == 'dev'", specifier = ">=5.0.0" },- { name = "mthds", specifier = "==0.18.0" },+ { name = "mthds", specifier = "==0.19.0" },{ name = "mypy", marker = "extra == 'dev'", specifier = "==1.19.1" },{ name = "networkx", specifier = ">=3.4.2" },{ name = "openai", specifier = ">=2.0.0" },