Skip to content

feat: add reasoning support across all providers#81

Merged
jpr5 merged 10 commits into
mainfrom
feat/reasoning-all-providers
Apr 6, 2026
Merged

feat: add reasoning support across all providers#81
jpr5 merged 10 commits into
mainfrom
feat/reasoning-all-providers

Conversation

@AlemTuzlak

Copy link
Copy Markdown
Contributor

Summary

  • Add reasoning/thinking output to every provider that previously lacked it
  • OpenAI Chat Completions: reasoning_content field on message + streaming deltas
  • Gemini: thought: true text parts before answer parts
  • Bedrock InvokeModel: Anthropic-style thinking content blocks
  • Bedrock Converse: reasoningContent blocks in Converse format
  • Ollama: reasoning_content on both /api/chat and /api/generate (streaming + non-streaming)

Existing TextResponse.reasoning fixture field now produces correct provider-native reasoning output on all endpoints. No fixture format changes, no router changes, no new types.

Test plan

  • 22 new tests in reasoning-all-providers.test.ts covering all 5 providers
  • Each provider tested for streaming + non-streaming with reasoning present and absent
  • Unit tests for buildBedrockStreamTextEvents reasoning event structure
  • Full test suite passes (2048 tests, 0 failures)
  • Lint and format clean

🤖 Generated with Claude Code

Adds optional reasoning_content field to non-streaming ChatCompletion
messages and SSE streaming deltas when a fixture includes reasoning.
@pkg-pr-new

pkg-pr-new Bot commented Apr 6, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/CopilotKit/aimock/@copilotkit/aimock@81

commit: a482f2d

@AlemTuzlak
AlemTuzlak force-pushed the feat/reasoning-all-providers branch from bf3e85d to e900e5e Compare April 6, 2026 15:54
AlemTuzlak and others added 4 commits April 6, 2026 18:02
Change `if (reasoning !== undefined)` to `if (reasoning)` in helpers.ts
and ollama.ts for consistency with the fixture-loader convention where
empty string means no reasoning.
All tests use the same fixtures, so share a single server instance
across the entire file instead of creating one per test. Update the
post() helper to use a shared baseUrl instead of accepting a full URL.
Add integration tests for invoke-with-response-stream and converse-stream
endpoints that verify thinking block events appear before text content
events when reasoning is present. Includes a binary event stream frame
decoder for parsing the AWS Event Stream wire format in tests.
@jpr5
jpr5 force-pushed the feat/reasoning-all-providers branch from dd722a9 to a482f2d Compare April 6, 2026 17:07
@jpr5
jpr5 merged commit 6c1086f into main Apr 6, 2026
18 checks passed
@jpr5
jpr5 deleted the feat/reasoning-all-providers branch April 6, 2026 17:11
@jpr5 jpr5 mentioned this pull request Apr 6, 2026
jpr5 added a commit that referenced this pull request Apr 6, 2026
## v1.8.0

### Features
- `requestTransform` — deterministic matching and recording (#79, based
on @iskhakovt's #63)
- Reasoning/thinking for OpenAI Chat Completions (#62 by @erezcor)
- Reasoning for Gemini, Bedrock, Bedrock Converse, Ollama (#81)
- Web search events for OpenAI Responses API (#62)

### Fixes
- Migration page health checks (#80)
- Stream collapse reasoning event handling
- GitHub URLs, OG image, drift docs reframe

### Versions bumped
- `package.json` → 1.8.0
- `plugin.json` → 1.8.0
- `marketplace.json` → ^1.8.0
- `Chart.yaml` appVersion → 1.8.0
- `aimock-pytest/_version.py` AIMOCK_VERSION → 1.8.0
- `CHANGELOG.md` — full v1.8.0 + retroactive v1.7.0 entries

2,090 tests across 59 files. Build clean.
jpr5 added a commit that referenced this pull request Jul 15, 2026
## Summary

- Add reasoning/thinking output to every provider that previously lacked
it
- OpenAI Chat Completions: `reasoning_content` field on message +
streaming deltas
- Gemini: `thought: true` text parts before answer parts
- Bedrock InvokeModel: Anthropic-style `thinking` content blocks
- Bedrock Converse: `reasoningContent` blocks in Converse format
- Ollama: `reasoning_content` on both `/api/chat` and `/api/generate`
(streaming + non-streaming)

Existing `TextResponse.reasoning` fixture field now produces correct
provider-native reasoning output on all endpoints. No fixture format
changes, no router changes, no new types.

## Test plan

- [ ] 22 new tests in `reasoning-all-providers.test.ts` covering all 5
providers
- [ ] Each provider tested for streaming + non-streaming with reasoning
present and absent
- [ ] Unit tests for `buildBedrockStreamTextEvents` reasoning event
structure
- [ ] Full test suite passes (2048 tests, 0 failures)
- [ ] Lint and format clean

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants