language-models: worked example and provider message-model comparison in LANGUAGE-MODELS.md section 3 (step of #88) #741

Closed
opened 2026-11-13 11:29:10 +00:00 by orion · 4 comments
Collaborator

Goal

Write the worked example and the provider comparison that docs/design/LANGUAGE-MODELS.md section 3 ("Before it is built") only announces, so the protocol of std/language-model is shown to fit every provider before the first client exists. Docs only: one PR, one Conventional Commit docs(language-models): worked example and provider message models. Step of #88 (the PR says Refs #88, not Closes).

Design record

docs/design/LANGUAGE-MODELS.md section 1 (one protocol, streaming first as a Source, typed tools, clients for Anthropic, OpenAI and compatible APIs, Google, Mistral). Reuse decided records, do not reopen them: STREAMS.md, CONCURRENCY.md, ENCODING.md (Encode/Decode), docs/design/FRAMEWORK.md section 3 for how the sibling worked example is laid out.

Seed

Does not touch the seed: no syntax change, no new native, no driver flag, no std name looked up by string, no std or compiler change.

What the PR delivers

  1. LANGUAGE-MODELS.md section 3 is renamed "The worked example and the provider comparison" (the stub text is replaced; the status line says the example exists and the packages are still planned).
  2. One conversation through every layer: a thread in which the user asks a question, the model answers with a tool call (typed tool, JSON Schema derived from the type), the tool result is appended, and the answer streams. The first turn is streamed from provider A (Anthropic), the thread is then continued with provider B (OpenAI) by changing one value. Shown as TorbScript code in the style of CLAUDE.md (no semicolons, lines <= 120) plus the wire message each provider receives, side by side.
  3. A comparison table of the message models: Anthropic Messages, OpenAI (Chat Completions and Responses), Google Gemini, Mistral, and OpenAI-compatible local servers. Rows: roles and system prompt placement, content blocks, tool call and tool result representation (ids, argument encoding as object or JSON string), reasoning blocks and whether they must be sent back, images and documents, streaming event shapes, usage and stop reasons. Each row cites the provider's public API documentation (link) and states the date it was read.
  4. Findings: every place where the protocol of section 1 cannot be translated losslessly in both directions (for example provider-specific reasoning signatures, tool-call id formats, system prompt as a message or a field) with the decision the record takes (field kept opaque, dropped on switch, mapped) and the cost. Contradictions with section 1 are listed as findings, not silently fixed.

Done when

  • docs/design/LANGUAGE-MODELS.md section 3 has the worked example with a tool call, streamed from one provider and continued with another, covering: the typed tool, the stream of events as a Source, the appended tool result, and the switch of provider by one value.
  • The section has a comparison table with at least Anthropic, OpenAI, Google, Mistral and an OpenAI-compatible server, covering every row named above, each with a documentation link.
  • A "Findings" list names every non-lossless translation with its decision; the section ends by stating that no code exists yet.
  • Every code block in the section is TorbScript that follows CLAUDE.md style, or is marked "does not check yet: " and listed as a gap; no private links, no chat quotes.
  • Only docs/design/LANGUAGE-MODELS.md (and, if the docs skill gate reports drift, the regenerated skills/ per CLAUDE.md) changes; forge CI is green (sh tools/gates.sh a; do not build locally); tools/check-commits.sh clean.

Sign-off (second acceptance criterion of #88)

As in #87 (decision comment 10788, orion/infra#2731): the sign-off on the worked example is an approval of our own work, not an owner question. No question_ask. Merging the PR by the merge gate is the approval; #88 is closed after the merge with the link. The owner can iterate on the record later. Building the clients is filed as its own items just in time, not here.

Worker

model: sonnet, thinking: medium (docs; Opus only if a Sonnet attempt fails).

## Goal Write the worked example and the provider comparison that `docs/design/LANGUAGE-MODELS.md` section 3 ("Before it is built") only announces, so the protocol of `std/language-model` is shown to fit every provider before the first client exists. Docs only: one PR, one Conventional Commit `docs(language-models): worked example and provider message models`. Step of #88 (the PR says `Refs #88`, not `Closes`). ## Design record `docs/design/LANGUAGE-MODELS.md` section 1 (one protocol, streaming first as a `Source`, typed tools, clients for Anthropic, OpenAI and compatible APIs, Google, Mistral). Reuse decided records, do not reopen them: `STREAMS.md`, `CONCURRENCY.md`, `ENCODING.md` (`Encode`/`Decode`), `docs/design/FRAMEWORK.md` section 3 for how the sibling worked example is laid out. ## Seed Does not touch the seed: no syntax change, no new native, no driver flag, no std name looked up by string, no `std` or compiler change. ## What the PR delivers 1. `LANGUAGE-MODELS.md` section 3 is renamed "The worked example and the provider comparison" (the stub text is replaced; the status line says the example exists and the packages are still planned). 2. **One conversation through every layer**: a thread in which the user asks a question, the model answers with a tool call (typed tool, JSON Schema derived from the type), the tool result is appended, and the answer streams. The first turn is streamed from provider A (Anthropic), the thread is then continued with provider B (OpenAI) by changing one value. Shown as TorbScript code in the style of CLAUDE.md (no semicolons, lines <= 120) plus the wire message each provider receives, side by side. 3. **A comparison table of the message models**: Anthropic Messages, OpenAI (Chat Completions and Responses), Google Gemini, Mistral, and OpenAI-compatible local servers. Rows: roles and system prompt placement, content blocks, tool call and tool result representation (ids, argument encoding as object or JSON string), reasoning blocks and whether they must be sent back, images and documents, streaming event shapes, usage and stop reasons. Each row cites the provider's public API documentation (link) and states the date it was read. 4. **Findings**: every place where the protocol of section 1 cannot be translated losslessly in both directions (for example provider-specific reasoning signatures, tool-call id formats, system prompt as a message or a field) with the decision the record takes (field kept opaque, dropped on switch, mapped) and the cost. Contradictions with section 1 are listed as findings, not silently fixed. ## Done when - [ ] `docs/design/LANGUAGE-MODELS.md` section 3 has the worked example with a tool call, streamed from one provider and continued with another, covering: the typed tool, the stream of events as a `Source`, the appended tool result, and the switch of provider by one value. - [ ] The section has a comparison table with at least Anthropic, OpenAI, Google, Mistral and an OpenAI-compatible server, covering every row named above, each with a documentation link. - [ ] A "Findings" list names every non-lossless translation with its decision; the section ends by stating that no code exists yet. - [ ] Every code block in the section is TorbScript that follows CLAUDE.md style, or is marked "does not check yet: <what is missing>" and listed as a gap; no private links, no chat quotes. - [ ] Only `docs/design/LANGUAGE-MODELS.md` (and, if the docs skill gate reports drift, the regenerated `skills/` per CLAUDE.md) changes; forge CI is green (`sh tools/gates.sh a`; do not build locally); `tools/check-commits.sh` clean. ## Sign-off (second acceptance criterion of #88) As in #87 (decision comment 10788, orion/infra#2731): the sign-off on the worked example is an approval of our own work, not an owner question. No `question_ask`. Merging the PR by the merge gate is the approval; #88 is closed after the merge with the link. The owner can iterate on the record later. Building the clients is filed as its own items just in time, not here. ## Worker model: sonnet, thinking: medium (docs; Opus only if a Sonnet attempt fails).
Author
Collaborator

[loop:torbscript] claim implement by session:loop-torbscript-20261113 until 2026-11-13T19:15Z

[loop:torbscript] claim implement by session:loop-torbscript-20261113 until 2026-11-13T19:15Z
Author
Collaborator

[loop:torbscript] implement: checkpoint, worktree loop/741-language-models-example created, provider docs being read (Anthropic, OpenAI, Gemini, Mistral, Ollama), next: write section 3

[loop:torbscript] implement: checkpoint, worktree loop/741-language-models-example created, provider docs being read (Anthropic, OpenAI, Gemini, Mistral, Ollama), next: write section 3
Author
Collaborator

[loop:torbscript] release implement: PR #759 is open on 7fef36d (docs-only, section 3 of LANGUAGE-MODELS.md), but all four CI statuses (commit messages, what the change touches, gates, pdisc) stayed pending for about 35 minutes and the blocking ci-wait was terminated at its timeout. CI is not green yet; local pdisc check and check-commits are clean. Next: re-check CI on 7fef36d, then review (Argus).

[loop:torbscript] release implement: PR #759 is open on 7fef36d (docs-only, section 3 of LANGUAGE-MODELS.md), but all four CI statuses (commit messages, what the change touches, gates, pdisc) stayed pending for about 35 minutes and the blocking ci-wait was terminated at its timeout. CI is not green yet; local pdisc check and check-commits are clean. Next: re-check CI on 7fef36d, then review (Argus).
argus closed this issue 2026-11-13 16:04:35 +00:00
Author
Collaborator

status (orion): PR #759 merged to main (c1cadce), docs/design/LANGUAGE-MODELS.md live on main (verified: file on main carries the findings and gaps). Stale loop and ready labels removed: the issue is done.

Next step, not done in this run: the change ships with the next x.y.z release. The release is a version-bump PR (chore(release), reviewer argus) and then the tag, which needs argus to merge first. Owner: orion. Resume: cut the next release after that PR merges.

**status** (orion): PR #759 merged to main (c1cadce), docs/design/LANGUAGE-MODELS.md live on main (verified: file on main carries the findings and gaps). Stale loop and ready labels removed: the issue is done. Next step, not done in this run: the change ships with the next x.y.z release. The release is a version-bump PR (chore(release), reviewer argus) and then the tag, which needs argus to merge first. Owner: orion. Resume: cut the next release after that PR merges.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language#741
No description provided.