Skip to content

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/Spi-table-lacks-request-check · L-261007-e54635 — SPI table lacks request-check symbols (#1369)

Louis Choqueleb532fbd8029
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 16a014d78..33b287110 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,7 +12,7 @@
- **A reasoning setting reaches a structured output**: a pipe whose model setting carries `reasoning_effort` or `reasoning_budget`, the deck's `$deep-analysis`, `$quick-reasoning` and `$retrieval-premium` presets included, now generates its structured output with that setting on every provider, where every language-model worker refused it with `LLMCapabilityError` "does not support reasoning parameters for structured generation". A model refuses a reasoning setting on a structured output only where it refuses it on text, or on Mistral where its structure method is not `instructor/mistral_tools`, whose JSON parsing cannot read a reasoning reply; a structured call on an Anthropic tool method with thinking on leaves the tool choice to the model, since a forced tool choice cannot carry thinking.
- **A manual thinking budget leaves room for the answer and stays in the model's range (Breaking)**: an Anthropic or Gemini thinking budget, resolved from an effort or set explicitly, is cut to leave a quarter of `max_tokens` for the answer, where it could take all but one token of it, and held within the range the model declares with the new `min_thinking_budget` and `max_thinking_budget` valued constraints. The kit's Anthropic models declare the API's minimum of 1,024 tokens, so the 512 that `minimal` maps to is raised to it, and its Gemini 2.5 models declare their ranges, so `max` effort's 65,536 tokens, which every Gemini 2.5 model refused, are cut to the model's maximum even without a `max_tokens`. A `max_tokens` too small to hold the model's minimum beside the answer reserve is refused with an `LLMCapabilityError` naming the numbers, where the request was sent, and a reasoning effort of `none` on a Gemini model that always thinks, which the kit marks with the new `thinking_cannot_be_disabled` listed constraint, is refused rather than sent as a budget of 0 that Gemini answers with a 400; a project that copied the kit's `anthropic.toml`, `bedrock.toml` or `google.toml` gets the bounds by declaring them in its copy.
- **Mistral reasoning is sent as `reasoning_effort`**: a reasoning effort on a Mistral model is sent as `reasoning_effort = "high"`, the only reasoning value Mistral's reasoning models accept, where it was sent as `prompt_mode = "reasoning"`, which every current Mistral model refuses, so any reasoning effort on Mistral failed. The `reasoning` level of `[inference.llm.mistral.effort_to_level_map]` is unchanged.
-- **A model setting its model refuses is refused when the method loads (Breaking)**: a `PipeLLM` or `PipeStructure` whose model setting the model it resolves to cannot take, such as a reasoning setting on a model declaring `thinking_mode = "none"`, a reasoning budget on an OpenAI or Mistral model, a thinking budget its `max_tokens` cannot hold, or a structured output on a Bedrock native model, is refused by `pipelex validate`, `POST /v1/validate` and a run's load as an item of the new `PipeValidationErrorType` value `llm_setting_refused_by_model` on its `model` or `model_to_structure` field, where it validated as runnable and failed at its first call. The check is the new `check_request` classmethod of the LLM workers, which `LLMWorkerAbstract` now runs before every provider call and which an LLM backend registers for validation through the new optional `check_llm_request` of `PluginRegistrar.add_inference_backend`; a backend registering none, an external plugin's included, is held to the rule every worker shares, that a model declaring `thinking_mode = "none"` takes no reasoning setting. The item names the model by its deck handle and is shown even under strict error disclosure, so an external plugin's refusal is shown as written only when the plugin raises it as caller-facing copy with `as_caller_fault()`, and by its title otherwise.
+- **A model setting its model refuses is refused when the method loads (Breaking)**: a `PipeLLM` or `PipeStructure` whose model setting the model it resolves to cannot take, such as a reasoning setting on a model declaring `thinking_mode = "none"`, a reasoning budget on an OpenAI or Mistral model, a thinking budget its `max_tokens` cannot hold, or a structured output on a Bedrock native model, is refused by `pipelex validate`, `POST /v1/validate` and a run's load as an item of the new `PipeValidationErrorType` value `llm_setting_refused_by_model` on its `model` or `model_to_structure` field, where it validated as runnable and failed at its first call. The check is the new `check_request` classmethod of the LLM workers, which `LLMWorkerAbstract` now runs before every provider call and which an LLM backend registers for validation through the new optional `check_llm_request` of `PluginRegistrar.add_inference_backend`, whose `CheckLLMRequestFn`, `LLMJobParams` and `LLMCapabilityError` the Inference SPI table publishes; a backend registering none, an external plugin's included, is held to the rule every worker shares, that a model declaring `thinking_mode = "none"` takes no reasoning setting. The item names the model by its deck handle and is shown even under strict error disclosure, so an external plugin's refusal is shown as written only when the plugin raises it as caller-facing copy with `as_caller_fault()`, and by its title otherwise.
- **A structured output on Google without a system prompt no longer fails**: a structured call on the `google` backend whose prompt has no system text failed with `TypeError` "generate_content() got an unexpected keyword argument 'system'", and is now sent with no system instruction.
- **A model listing `temperature_unsupported` gets no temperature on any SDK**: a model whose backend file lists the `temperature_unsupported` constraint is now called without a temperature on the OpenAI Responses, Google, Mistral and Bedrock-native SDKs too, where those sent one anyway and only the Anthropic and OpenAI chat-completions SDKs honoured the constraint. The model spec answers it as the new `accepts_temperature` property, and a Bedrock client's `chat` now takes `temperature=None` to send none.
- **A binding step survives a kajson round trip**: `BindingStepBlueprint` is encoded under `from`, the key it validates, where kajson wrote its field name `from_path`, which decoding refused as an extra field. A library crate holding a sequence with a binding step can now cross a process boundary, so a run of such a method no longer fails to start on a Temporal worker with "Could not instantiate pydantic BaseModel … BindingStepBlueprint".
diff --git a/docs/under-the-hood/inference-backend-plugins.md b/docs/under-the-hood/inference-backend-plugins.md
index 5ec167180..454154a8f 100644
--- a/docs/under-the-hood/inference-backend-plugins.md
+++ b/docs/under-the-hood/inference-backend-plugins.md
@@ -234,7 +234,7 @@ What an out-of-tree backend plugin imports *is* the contract. The published surf
|--------|--------|------|
| `PipelexPlugin`, `PLUGIN_API_VERSION` | `pipelex.plugins.contract` | the plugin protocol + version gate |
| `PluginRegistrar` | `pipelex.plugins.registrar` | the accumulator `register` writes into |
-| `InferenceFamily`, `MakeWorkerFn`, `require_sdk` | `pipelex.plugins.inference_backend_registry` | family enum, callable type, dependency guard |
+| `InferenceFamily`, `MakeWorkerFn`, `CheckLLMRequestFn`, `require_sdk` | `pipelex.plugins.inference_backend_registry` | family enum, the worker factory and LLM request check callable types, dependency guard |
| `ListModelsFn` | `pipelex.plugins.model_lister_registry` | the optional model-listing callable type |
| `ModelListingUnsupportedError` | `pipelex.cogt.exceptions` | soft signal a lister raises when its client variant cannot list |
| `ModelHandle` | `pipelex.plugins.model_handle` | the backend selector derived from a model spec |
@@ -251,6 +251,7 @@ What an out-of-tree backend plugin imports *is* the contract. The published surf
| `InferenceJobAbstract` | `pipelex.cogt.inference.inference_job_abstract` | the base of every job a worker serves |
| `LLMWorkerAbstract` | `pipelex.cogt.llm.llm_worker_abstract` | the LLM worker contract |
| `LLMJob` | `pipelex.cogt.llm.llm_job` | the LLM job |
+| `LLMJobParams` | `pipelex.cogt.llm.llm_job_components` | the LLM job's parameters, which an LLM request check reads |
| `ImgGenWorkerAbstract` | `pipelex.cogt.img_gen.img_gen_worker_abstract` | the image-generation worker contract |
| `ImgGenJob` | `pipelex.cogt.img_gen.img_gen_job` | the image-generation job |
| `ImgGenJobParams` | `pipelex.cogt.img_gen.img_gen_job_components` | the image-generation job's parameters |
@@ -271,6 +272,7 @@ What an out-of-tree backend plugin imports *is* the contract. The published surf
| `NbTokensByCategoryDict`, `TokenCategory` | `pipelex.cogt.usage.token_category` | the token usage a worker reports |
| `BaseModelTypeVar` | `pipelex.tools.typing.pydantic_utils` | the schema type variable of a structured-output signature |
| `CogtError`, `SdkTypeError`, `ImgGenGenerationError`, `ImgGenParameterError`, `InferenceErrorCategory` | `pipelex.cogt.exceptions` | the inference error bases and categories a worker raises with |
+| `LLMCapabilityError` | `pipelex.cogt.exceptions` | a request the model refuses, raised by an LLM request check |
**Building on an OpenAI- or Anthropic-compatible service**