Skip to content

Conversation

HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Aug 12, 2025

Summary by CodeRabbit

  • New Features

    • Chat responses now support an additional “thinking” content type, enabling richer context alongside regular text.
    • Streaming/delta updates may include a new optional “thinking” field in message content, allowing clients to display or handle model reasoning previews if desired.
  • Chores

    • Public API updated to include the new “thinking” content variant and corresponding field in chat message deltas.

Copy link

coderabbitai bot commented Aug 12, 2025

Walkthrough

Adds a new “thinking” variant to chat content type-discriminator and introduces a corresponding ChatThinkingContent mapping. Extends ChatContentDeltaEventDeltaMessageContent with an optional thinking string field, alongside the existing text field, in src/libs/Cohere/openapi.yaml.

Changes

Cohort / File(s) Summary of Changes
OpenAPI schema updates
src/libs/Cohere/openapi.yaml
- Added type-discriminator mapping: thinking → ChatThinkingContent alongside text → ChatTextContent.
- Extended ChatContentDeltaEventDeltaMessageContent with new property: thinking: string (in addition to text).

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant API (Cohere)
  participant Consumer (SDK/Server)

  Client->>API (Cohere): Send/receive Chat content
  API (Cohere)->>API (Cohere): Type-discriminate content (text | thinking)
  API (Cohere)-->>Consumer (SDK/Server): Emit content delta (text and/or thinking)
  Consumer (SDK/Server)->>Consumer (SDK/Server): Parse 'thinking' when present
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

A hop, a thump, a thought so bright,
New “thinking” whispers join the night.
Text and musings, side by side,
In YAML burrows, neatly tied.
I twitch my nose—schemas sing,
Content grows another wing. 🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bot/update-openapi_202508121834

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@HavenDV HavenDV enabled auto-merge (squash) August 12, 2025 18:35
@HavenDV HavenDV merged commit ceb5dd3 into main Aug 12, 2025
3 of 4 checks passed
@HavenDV HavenDV deleted the bot/update-openapi_202508121834 branch August 12, 2025 18:37
@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Add thinking chat content type, mapping, and optional thinking field Aug 12, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/libs/Cohere/openapi.yaml (1)

12425-12428: Unable to locate ChatThinkingContent schema

I wasn’t able to find ChatThinkingContent under components/schemas in src/libs/Cohere/openapi.yaml. Please verify that you have:

  • Defined a ChatThinkingContent schema:
    • Includes a type property (string) with enum thinking, and type listed in required
    • Sets additionalProperties: false
  • Updated the discriminator mapping to include
    thinking: #/components/schemas/ChatThinkingContent
  • (Optional) Added a brief description and example for ChatThinkingContent semantics
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 29c08f3 and 7e2b9d9.

⛔ Files ignored due to path filters (2)
  • src/libs/Cohere/Generated/Cohere.Models.AssistantMessageV2ContentVariant2ItemDiscriminatorType.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.ChatContentDeltaEventVariant2DeltaMessageContent.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/Cohere/openapi.yaml (2 hunks)
🔇 Additional comments (1)
src/libs/Cohere/openapi.yaml (1)

12585-12590: Delta schema: enforce exclusivity of thinking vs text
In src/libs/Cohere/openapi.yaml (lines 12586–12589) the ChatContentDeltaEventDeltaMessageContent object currently declares both text and thinking as plain strings with no validation or mutual-exclusion—whereas the full‐message payload (around lines 12390–12393) uses a discriminator to enforce oneOf between ChatTextContent and ChatThinkingContent.

Suggestions:
• If you intend that each delta carries either text or thinking (but never both), replace the flat properties block with a oneOf that mirrors the full‐payload schemas. For example:

oneOf:
  - $ref: '#/components/schemas/ChatTextContentDelta'
  - $ref: '#/components/schemas/ChatThinkingContentDelta'
additionalProperties: false

Then define each *Delta schema with a required text or thinking field and minLength: 1.

• If you intend to keep the current shape, at minimum tighten the new field in place:

- thinking:
-   type: string
+ thinking:
+   type: string
+   description: "Streaming delta of model thinking/rationale."
+   minLength: 1
+   # consider readOnly: true if response-only

Please also verify:
• That the full-message schemas (ChatTextContent, ChatThinkingContent) and any non-delta events consistently include a thinking branch.
• Whether SDKs should expose thinking by default or gate it behind a feature flag to avoid breaking existing clients.

Once you confirm the desired exclusivity and client expectations, I’ll update all affected OpenAPI blocks and add examples.

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