Repository navigation
docs(examples): add chat reasoningEffort examples - #214
Merged
Merged
Conversation
louis-sanna-dev
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds four runnable examples in
examples/src/demonstratingreasoningEffortonmistral-medium-3-5. The SDK already supports the parameter and theThinkChunk/TextChunktypes, but there were no examples showing how to use them. TypeScript port of mistralai/client-python#511.Files
reasoning_response_shape.ts— first stop. Calls the API once withreasoningEffort: "high"and once with"none", then dumps the rawmessage.contentso the reader can see theThinkChunk/TextChunkJSON before consuming it.reasoning.ts— single-turn call. Iteratesmessage.contentand discriminates onchunk.type === "thinking" | "text". Notes thatreasoningEffort: "none"returns a plainstring.reasoning_with_streaming.ts— the streaming version. Handles the three shapes that arrive ondelta.content:ThinkChunkarrays during the thinking phase, a transition array containing both a closingThinkChunkand the firstTextChunk, and plain string fragments after thinking ends.reasoning_multi_turn.ts— 3-turn math chain (17 × 23 → × 3 → −100). Replays the assistant turn back intomessageswithThinkChunks intact and prints per-turn token usage so the cost difference is visible.Notes
{ timeoutMs: 300_000 }because reasoning runs routinely exceed the default 30s timeout.mistral-medium-3-5(the model docs explicitly list as supportingreasoningEffort).Test plan