- 
                Notifications
    You must be signed in to change notification settings 
- Fork 240
          Add support for Message.Reasoning interactions across clients
          #943
        
          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
base: develop
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This pull request introduces support for Message.Reasoning interactions across multiple LLM clients to implement a new reasoning capability. The feature enables AI models to expose their internal thinking processes as structured messages.
- Adds a new Message.Reasoningmessage type with associatedThinkinginterface
- Updates all client implementations to handle reasoning messages appropriately
- Modifies serialization classes to use sealed interfaces with proper role discrimination
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description | 
|---|---|
| Message.kt | Adds new Reasoning message type and Thinking interface | 
| StreamFrameExt.kt | Extends stream frame handling to support reasoning content | 
| OpenAI clients | Implements reasoning support with proper conversion between internal types | 
| Google client | Adds reasoning handling for thought-enabled parts | 
| Anthropic clients | Updates message structure to sealed interfaces and adds reasoning support | 
| Bedrock clients | Implements reasoning for Anthropic models, throws NotImplementedError for others | 
| Ollama client | Throws NotImplementedError for reasoning (not supported) | 
| OpenTelemetry features | Updates event handling to include reasoning messages | 
| Memory features | Adds reasoning message formatting in conversation history | 
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
        
          
                ...penai-client/src/commonMain/kotlin/ai/koog/prompt/executor/clients/openai/OpenAILLMClient.kt
          
            Show resolved
            Hide resolved
        
              
          
                ...client/src/commonMain/kotlin/ai/koog/prompt/executor/clients/anthropic/AnthropicLLMClient.kt
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...client/src/commonMain/kotlin/ai/koog/prompt/executor/clients/anthropic/AnthropicLLMClient.kt
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...ompt/executor/clients/bedrock/modelfamilies/anthropic/BedrockAnthropicClaudeSerialization.kt
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...ompt/executor/clients/bedrock/modelfamilies/anthropic/BedrockAnthropicClaudeSerialization.kt
              
                Outdated
          
            Show resolved
            Hide resolved
        
      | Qodana for JVM17424 new problems were found 
 @@ Code coverage @@
+ 70% total lines covered
15921 lines analyzed, 11209 lines covered
# Calculated according to the filters of your coverage tool☁️ View the detailed Qodana report Contact Qodana teamContact us at [email protected] 
 | 
        
          
                prompt/prompt-model/src/commonMain/kotlin/ai/koog/prompt/message/Message.kt
              
                Outdated
          
            Show resolved
            Hide resolved
        
      f95cf54    to
    d704f74      
    Compare
  
    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.
Looks good for me. Open Telemetry does not have any special handling for such cases. The rest looks good from my side as well.
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.
Looks good now, thank you. A couple of small comments
        
          
                ...ompt/executor/clients/bedrock/modelfamilies/anthropic/BedrockAnthropicClaudeSerialization.kt
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                prompt/prompt-model/src/commonMain/kotlin/ai/koog/prompt/message/Message.kt
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                prompt/prompt-model/src/commonMain/kotlin/ai/koog/prompt/message/Message.kt
              
                Outdated
          
            Show resolved
            Hide resolved
        
      022356d    to
    1b0eef1      
    Compare
  
    Co-authored-by: Copilot <[email protected]>
…ssage type assertions
…tor `Message.Reasoning` constructor for multi-part content
1b0eef1    to
    fcc8c4c      
    Compare
  
    | public data class Reasoning( | ||
| public val id: String? = null, | ||
| public val encrypted: String? = null, | ||
| override val parts: List<ContentPart>, | 
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.
Let's limit it to the List<ContentPart.Text> since only text content is supported here
KG-432
KG-297
Motivation and Context
A new message type has been added:
ReasoningBreaking Changes
Yes,
The implementation of Anthropic messages has been modified for future support and schema compliance
Type of the changes
Checklist
developas the base branchAdditional steps for pull requests adding a new feature