-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Support raw CoT reasoning from LM Studio and other OpenAI Responses-compatible APIs #3559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
DouweM
merged 25 commits into
pydantic:main
from
dsfaccini:lm-studio-openai-responses-with-gpt-oss
Dec 5, 2025
Merged
Changes from 16 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
473623b
support rae cot 1
dsfaccini ff4d45b
include live gpt-oss streaming test and remove computer-use model
dsfaccini 9c8007f
simplify filter
dsfaccini 88de1ed
note about test flakiness
dsfaccini 364b711
re-add computer use names
dsfaccini 4afd4b7
handle raw cot in parts manager
dsfaccini 50bc7fa
Merge branch 'main' into lm-studio-openai-responses-with-gpt-oss
dsfaccini ddd7df4
Merge branch 'main' into lm-studio-openai-responses-with-gpt-oss
dsfaccini 65ae9a5
refactor parts manager
dsfaccini d0c7d77
add defensive handling of potential summary after rawCoT
dsfaccini 8d52d65
Clarify usage of agent factories
dsfaccini 99812f8
migrate to callback
dsfaccini 0a245b6
dont emit empty events
dsfaccini 3128b4a
Merge branch 'pydantic:main' into main
dsfaccini dc7aa6a
Merge branch 'main' into lm-studio-openai-responses-with-gpt-oss
dsfaccini 3b6013f
complex testcase
dsfaccini f87896a
improvde dostring
dsfaccini 2c3d767
narrow docstring
dsfaccini e69a7c2
Clarify agent instantiation options in documentation
dsfaccini bc2e31e
address review points
dsfaccini d4a6c8b
Merge remote-tracking branch 'origin/main' into lm-studio-openai-resp…
dsfaccini d5f6503
Merge upstream/main into lm-studio-openai-responses-with-gpt-oss
dsfaccini c7d43bd
Merge branch 'main' into lm-studio-openai-responses-with-gpt-oss
dsfaccini 85636a8
chain callables or dict mergings
dsfaccini 53579d0
Merge branch 'main' into lm-studio-openai-responses-with-gpt-oss
dsfaccini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -639,7 +639,8 @@ async def _get_event_iterator(self) -> AsyncIterator[ModelResponseStreamEvent]: | |
| content = choice.delta.content | ||
| text, thinking = _map_content(content) | ||
| for thought in thinking: | ||
| self._parts_manager.handle_thinking_delta(vendor_part_id='thinking', content=thought) | ||
| for event in self._parts_manager.handle_thinking_delta(vendor_part_id='thinking', content=thought): | ||
| yield event | ||
|
Comment on lines
-642
to
+643
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure if this was a bug or this call was meant so simply update the parts manager, do you know @DouweM ? I ran the mistral tests against the API to double check it doesn't break. |
||
| if text: | ||
| # Attempt to produce an output tool call from the received text | ||
| output_tools = {c.name: c for c in self.model_request_parameters.output_tools} | ||
|
|
@@ -655,9 +656,8 @@ async def _get_event_iterator(self) -> AsyncIterator[ModelResponseStreamEvent]: | |
| tool_call_id=maybe_tool_call_part.tool_call_id, | ||
| ) | ||
| else: | ||
| maybe_event = self._parts_manager.handle_text_delta(vendor_part_id='content', content=text) | ||
| if maybe_event is not None: # pragma: no branch | ||
| yield maybe_event | ||
| for event in self._parts_manager.handle_text_delta(vendor_part_id='content', content=text): | ||
| yield event | ||
|
|
||
| # Handle the explicit tool calls | ||
| for index, dtc in enumerate(choice.delta.tool_calls or []): | ||
|
|
||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.