Skip to content

Conversation

@HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Jun 11, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced streaming chat responses with more detailed event types and properties.
    • Added support for new message content types, including text and image content.
  • Improvements

    • Updated API endpoint summaries to clearly indicate version information.
    • Refined parameter descriptions and property types for improved clarity.
    • Expanded enum options for chat finish reasons.
  • Bug Fixes

    • Resolved inconsistencies in schema references and message type naming across API documentation.
  • Documentation

    • Updated example code in multiple SDKs to reflect new message types and schemas.

@coderabbitai
Copy link

coderabbitai bot commented Jun 11, 2025

Walkthrough

The OpenAPI specification for the Cohere API was updated to generalize message and content types, enhance endpoint versioning in summaries, and expand streaming response schemas. Several schemas were renamed, replaced, or removed, and SDK example code was updated to use the new generalized types across multiple programming languages.

Changes

File(s) Change Summary
src/libs/Cohere/openapi.yaml Updated endpoint summaries with versioning, generalized message/content schemas, expanded streaming response schemas, renamed/replaced/removed multiple schemas, and revised SDK example code for Go and Java to use updated types.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant API
    participant Model

    Client->>API: Send /v2/chat request (with UserMessage, SystemMessage, etc.)
    API->>Model: Forward request with generalized message/content types
    Model-->>API: Stream response events (content-delta, tool-call-start, etc.)
    API-->>Client: Stream response with detailed event types and properties
Loading

Poem

In the warren, schemas hop and play,
Old V2 names now hop away.
Messages and content, fresh and new,
Streaming responses, detailed too.
With versioned paths and types so spry,
The API leaps—oh, how high!
🐇✨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 11f1083 and b06596a.

⛔ Files ignored due to path filters (79)
  • src/libs/Cohere/Generated/Cohere..JsonSerializerContext.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.CohereClient.Chat.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.CohereClient.Chatv2.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.CohereClient.Embed.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.CohereClient.Embedv2.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.CohereClient.Rerank.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.CohereClient.Rerankv2.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.ICohereClient.Chat.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.ICohereClient.Chatv2.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.ICohereClient.Embed.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.ICohereClient.Embedv2.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.ICohereClient.Rerank.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.ICohereClient.Rerankv2.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonConverters.ChatMessageV2.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonConverters.Content2.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonConverters.ContentDiscriminatorType.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonConverters.ContentDiscriminatorTypeNullable.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonConverters.ContentItem.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonConverters.ContentVariant2Item.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonConverters.ContentVariant2Item2.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonConverters.Message.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonConverters.ResponseFormat.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonConverters.ResponseFormatV2.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonConverters.Source.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonConverters.SystemMessageContentVariant2ItemDiscriminatorType.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonConverters.SystemMessageContentVariant2ItemDiscriminatorTypeNullable.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonConverters.SystemMessageRole.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonConverters.SystemMessageRoleNullable.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonConverters.TextContentType.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonConverters.TextContentTypeNullable.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonConverters.ToolContent.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonConverters.UserMessageRole.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonConverters.UserMessageRoleNullable.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.JsonSerializerContextTypes.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.ChatDocumentSourceDocument.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.ChatMessageV2.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.ChatTextResponseFormatV2.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.ChatToolSourceToolOutput.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.Content2.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.Content2.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.ContentDiscriminator.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.ContentDiscriminator.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.ContentDiscriminatorType.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.ContentItem.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.ContentVariant2Item.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.ContentVariant2Item2.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.DocumentSource.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.DocumentSource.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.DocumentSourceDocument.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.DocumentSourceDocument.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.EmbedByTypeResponse.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.Message.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.MessageContentDiscriminator.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.ResponseFormat.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.ResponseFormatV2.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.Source.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.SystemMessage.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.SystemMessage.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.SystemMessageContentVariant2ItemDiscriminator.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.SystemMessageContentVariant2ItemDiscriminator.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.SystemMessageContentVariant2ItemDiscriminatorType.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.SystemMessageRole.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.TextContent.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.TextContent.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.TextContentType.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.TextResponseFormat.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.TextResponseFormat.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.TextResponseFormatV2.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.TextResponseFormatV2.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.ToolContent.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.ToolMessage.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.ToolMessage.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.ToolSource.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.ToolSource.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.ToolSourceToolOutput.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.ToolSourceToolOutput.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.UserMessage.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.UserMessage.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.UserMessageRole.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/Cohere/openapi.yaml (25 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Test / Build, test and publish
🔇 Additional comments (29)
src/libs/Cohere/openapi.yaml (29)

20-20: Version the /v1/chat summary.
The endpoint summary now clearly indicates “Chat V1 API.”


2148-2148: Version the /v1/embed summary.
The summary is updated to “Embed V1 API.”


6856-6856: Version the /v1/rerank summary.
The summary is updated to “Rerank V1 API.”


7382-7382: Version the /v2/chat summary.
The summary now reads “Chat V2 API.”


7558-7558: Update Go SDK example to use general message types.
Replaced V2-specific content types with the unified UserMessage and UserMessageContent.


7561-7561: Update Java SDK example to use general message types.
Swapped out ChatMessageV2 variants for the new UserMessage/AssistantMessage types.


7596-7596: Update Java “Documents” example for V2.
Now uses the new V2ChatRequestDocumentsItem and general message schemas.


7599-7599: Update Go “Documents” example for V2.
Adopted the unified ChatMessages and updated document payload shape.


7738-7738: Update Java streaming example to V2 pattern.
Adjusted to use V2ChatStreamRequest and StreamedChatResponseV2.


7743-7743: Update Go streaming example to handle stream closure.
Added defer resp.Close() and proper io.EOF handling.


7869-7869: Update Java “Tools” example to reflect new ToolSource schema.
Switched from V2-specific tool message types to the generic ToolV2/ToolSource.


7938-7982: Expand /v1/chat streaming response schema.
Added explicit id, finish_reason, logprobs, message, usage properties and a detailed event discriminator for multiple stream event types.


7988-7988: Version the /v2/embed summary.
Updated summary to “Embed V2 API.”


11275-11275: Version the /v2/rerank summary.
Changed summary to “Rerank V2 API.”


11535-11539: Generalize content array to use TextContent.
Replaced the inline text schema with a reference to the new TextContent union.


11566-11570: Generalize content array (alternate) to use TextContent.
Aligned both chat and tool messages under the Content discriminator.


11905-11907: Extend ChatMessageV2 to include UserMessage and SystemMessage.
Updated both the oneOf and discriminator mappings accordingly.

Also applies to: 11914-11916


12549-12559: Add Content union schema for text and image.
Defines a top-level discriminator between TextContent and ImageContent.


12988-12998: Add DocumentSource schema.
Introduces a generic document source object with id and document fields.


16314-16320: Extend Message union to include ToolMessage.
Allows tool-based replies in the generic message payload.


16492-16499: Add TextResponseFormat to ResponseFormat.
Includes the new text formatting option in the output configuration union.


16521-16528: Add TextResponseFormatV2 to ResponseFormatV2.
Ensures V2 models can also use the unified text response format.


16624-16628: Generalize Source union to ToolSource and DocumentSource.
Replaced V2-specific schemas with the generic source definitions.


16711-16714: Add SystemMessage schema.
Defines the system role message structure under the new generic message model.


16724-16769: Define TextContent, TextResponseFormat, and TextResponseFormatV2.
Added core text content and response format schemas, and integrated them into SystemMessage.


16887-16907: Generalize ToolContent and add ToolMessage.
Unified tool result content under TextContent/DocumentContent and introduced the ToolMessage schema.


16947-16957: Add ToolSource schema.
Defines a generic tool output source with id and tool_output properties.


17143-17146: Add UserMessage schema.
Defines the user role message in the new generic chat model.


17157-17164: Update UserMessage to use the Content union.
Switched the content field to accept either a string or a Content block.

✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch bot/update-openapi_202506111831
  • Post Copyable Unit Tests in Comment

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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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) June 11, 2025 18:32
@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Update OpenAPI spec to generalize types and enhance endpoint versioning Jun 11, 2025
@HavenDV HavenDV closed this Jun 11, 2025
auto-merge was automatically disabled June 11, 2025 22:46

Pull request was closed

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.

2 participants