Skip to content

Stream thinking chunks via reasoning_content and fix eaten tokens - #10

Closed
akachiina wants to merge 2 commits into
sums001:mainfrom
akachiina:fix-thinking-stream
Closed

Stream thinking chunks via reasoning_content and fix eaten tokens#10
akachiina wants to merge 2 commits into
sums001:mainfrom
akachiina:fix-thinking-stream

Conversation

@akachiina

Copy link
Copy Markdown

This PR fixes thinking and search stream behavior: 1. Avoids eating the 1st token of thinking/response fragments. 2. Exposes thinking tokens under reasoning_content instead of content for OpenAI compatibility.

- Added tool_calls, tool_call_id, name fields to ChatMessage schema
- Added tools and tool_choice to ChatCompletionRequest schema
- messages_to_prompt now formats history with tool_calls and tool responses
- Injects tool definitions into system prompt
- Added extract_tool_calls_and_clean_text parser for XML/JSON tool calls
- Responses now include tool_calls with finish_reason='tool_calls'
- Streaming supports tool calls via delta.tool_calls
- Added unit tests for validation
@akachiina akachiina closed this by deleting the head repository Aug 10, 2026
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.

1 participant