feat(chat): enhance reasoning and response handling - #659
Conversation
Refined handling of Anthropic responses to extract and map reasoning content. Introduced support for streaming and budgeted reasoning tokens. Updated tests and request logic for improved reasoning support.
Added validation to ensure the max_tokens value does not exceed the maximum allowed by the provider mapping for the selected model. Updated token calculation logic to dynamically adjust thinking budgets based on reasoning effort levels.
Updated the token calculation for "low" effort levels from 1000 to 1024 to align with Anthropic's minimum token requirements. Added a clarifying comment.
Updated test cases to use only models with streaming-enabled providers. Added logic to determine streaming availability at both the model and provider levels. Improved filtering to ensure accurate test coverage for streaming use cases.
Added support for OpenAI's responses API with reasoning capability. Improved transformation of responses and streaming formats for reasoning and tool calls. Refined reasoning content extraction and token calculations for consistency. Updated handling for OpenAI delta and completions formats. Introduced tests for enhanced reasoning support.
Enhanced parsing of OpenAI's streaming API with expanded event type handling. Improved transformations for reasoning and content deltas. Added support for token use tracking in final responses.
Refactored tool call extraction to support `function_call` updates in OpenAI responses. Improved status mapping by differentiating function call-based flow. Added `tool_choice` and enhanced tool transformation logic for Responses API format, enabling tool handling with reasoning models.
|
Warning Rate limit exceeded@steebchen has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 34 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (4)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Handle missing OpenAI required fields by normalizing response data. Ensure `role` and `object` attributes are set correctly in streaming responses. Normalize `reasoning` to `reasoning_content` for consistency.
Created `transformStandardOpenAIStreaming` to refactor and centralize logic for transforming OpenAI streaming responses. Ensures consistency by normalizing `reasoning` to `reasoning_content` and applying default values for required fields across all usages. Simplified existing handlers to use the helper function.
Added comprehensive end-to-end test cases to validate reasoning combined with tool calls. Ensured correct output structure, tool call validation, reasoning content, logs, and token usage.
fd6b1a3 to
2c5ceb5
Compare
No description provided.