feat(rust): add reasoning_content field to ChatMessage types#62
feat(rust): add reasoning_content field to ChatMessage types#62AnthonyRonning merged 1 commit intomasterfrom
Conversation
📝 WalkthroughWalkthroughAdds an optional Changes
Sequence Diagram(s)(Skipped — changes are type additions and test updates without a new multi-component control flow requiring visualization.) Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
Deploying opensecret-sdk with
|
| Latest commit: |
5f970f1
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://45afd2b8.opensecret-sdk.pages.dev |
| Branch Preview URL: | https://add-reasoning-content.opensecret-sdk.pages.dev |
Greptile OverviewGreptile SummaryAdded optional Key changes:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as Rust SDK Client
participant API as OpenSecret API
participant Model as AI Model (e.g., Kimi K2)
Client->>API: ChatCompletionRequest (with messages)
API->>Model: Forward request
alt Streaming Response
loop For each token
Model-->>API: ChatCompletionChunk with delta
Note over Model,API: delta.reasoning_content (if available)<br/>delta.content (response text)
API-->>Client: Encrypted ChatCompletionChunk
Client->>Client: Deserialize with reasoning_content field
end
else Non-Streaming Response
Model-->>API: ChatCompletionResponse
Note over Model,API: message.reasoning_content (if available)<br/>message.content (response text)
API-->>Client: Encrypted ChatCompletionResponse
Client->>Client: Deserialize with reasoning_content field
end
|
7b22506 to
5f970f1
Compare
Add optional reasoning_content field to ChatMessage and ChatMessageDelta structs to support models that expose their reasoning/thinking process (e.g., Kimi K2 thinking model via vLLM). Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Summary
Add optional
reasoning_contentfield toChatMessageandChatMessageDeltastructs in the Rust SDK.Motivation
Models like Kimi K2 (via vLLM/Tinfoil) can expose their reasoning/thinking process through a
reasoning_contentfield in the response. Without this field in the SDK types, the reasoning content is silently dropped during deserialization.Changes
reasoning_content: Option<String>toChatMessage(for non-streaming responses)reasoning_content: Option<String>toChatMessageDelta(for streaming responses)#[serde(skip_serializing_if = "Option::is_none")]to avoid serializing when not presentTesting
cargo checkpassesSummary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.