generated from amazon-archives/__template_Apache-2.0
    
        
        - 
                Notifications
    You must be signed in to change notification settings 
- Fork 453
models - litellm - start and stop reasoning #947
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
      
      
    
                
     Merged
            
            
          Conversation
  
    
      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
    
  
  
    
    
              
                    zastrowm
  
              
              previously approved these changes
              
                  
                    Sep 30, 2025 
                  
              
              
            
            
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would an integ test be helpful here? Ensuring that we get back reasoning content and normal content in the stream?
              
                    Unshure
  
              
              reviewed
              
                  
                    Sep 30, 2025 
                  
              
              
            
            
afa31f7    to
    40bd6ff      
    Compare
  
    
              
                    pgrayy
  
              
              commented
              
                  
                    Sep 30, 2025 
                  
              
              
            
            
…nto tool-validation
| Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! | 
              
                    pgrayy
  
              
              commented
              
                  
                    Oct 21, 2025 
                  
              
              
            
            
              
                    Unshure
  
              
              approved these changes
              
                  
                    Oct 21, 2025 
                  
              
              
            
            
              
                    dbschmigelski
  
              
              approved these changes
              
                  
                    Oct 21, 2025 
                  
              
              
            
            
  
    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.
  
    
  
    
Description
We need to explicitly mark the start and stop of the reasoning content stream in the litellm model provider. With these changes, users can now do the following:
The result of the above script will look something like:
{ "role": "assistant", "content": [ { "reasoningContent": { "reasoningText": { "text": "This is a very basic addition problem. Let me think through it step by step as requested.\n\n2 + 2\n\nI can think of this in several ways:\n\n1. Counting: If I have 2 objects, and I add 2 more objects, I can count them: 1, 2, 3, 4. So 2 + 2 = 4.\n\n2. Using the definition of addition: Addition means combining quantities. So if I have a quantity of 2, and I combine it with another quantity of 2, I get a total quantity of 4.\n\n3. Using basic arithmetic facts: This is one of the fundamental addition facts that 2 + 2 = 4.\n\nThe answer is 4." } } }, { "text": "I'll work through this basic addition problem step by step:\n\n**Step 1: Understand what we're adding**\n- We have the number 2\n- We're adding another 2 to it\n- This can be written as: 2 + 2\n\n**Step 2: Think about what addition means**\n- Addition means combining or putting together quantities\n- We're combining a group of 2 with another group of 2\n\n**Step 3: Count or calculate**\n- We can count: 1, 2 (first group) + 1, 2 (second group) = 1, 2, 3, 4 total\n- Or we can recall that 2 + 2 is a basic math fact\n\n**Answer: 2 + 2 = 4**" } ] }Related Issues
#523
Documentation PR
N/A
Type of Change
Bug fix
Testing
How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli
hatch run prepare: Updated the unit tests.hatch test tests_integ/models/test_model_litellm.py: Wrote new integ test.Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.