Skip to content

feat:Update Cohere OpenAPI: shorten stream, remove texts, add embed schemas #168

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 1 commit into from
Apr 2, 2025

Conversation

HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Apr 2, 2025

Summary by CodeRabbit

  • New Features
    • Expanded API capabilities with enhanced input options for handling diverse content types such as text and images.
    • Introduced a configurable output parameter to improve response structuring.
    • Refined streaming descriptions and updated validation requirements for a more robust and flexible API experience.

@HavenDV HavenDV enabled auto-merge April 2, 2025 15:23
@HavenDV HavenDV merged commit 3cfd6b8 into main Apr 2, 2025
3 checks passed
@HavenDV HavenDV deleted the bot/update-openapi_202504021522 branch April 2, 2025 15:25
Copy link

coderabbitai bot commented Apr 2, 2025

Walkthrough

The pull request updates the OpenAPI specification in src/libs/Cohere/openapi.yaml. It truncates the stream property's description, removes texts from required fields, and introduces new properties — inputs (an array of EmbedInput) and output_dimension (an integer). Additionally, several new schemas are added (including EmbedContent, EmbedContentType, EmbedImage, EmbedImageProperties, EmbedInput, and EmbedText) to support structured handling of both image and text content.

Changes

File(s) Change Summary
src/.../Cohere/openapi.yaml Modified stream description by removing the "Compatible Deployments" mention; removed the texts property from required fields; added new properties: inputs (array of EmbedInput) and output_dimension (integer); introduced new schemas (EmbedContent, EmbedContentType, EmbedImage, EmbedImageProperties, EmbedInput, EmbedText).

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant API
    Client->>API: Send request with inputs (array of EmbedInput)
    Note right of API: Validate against new schemas<br/>(EmbedContent, EmbedImage, EmbedText, etc.)
    API-->>Client: Respond with output_dimension and embedded content details
Loading

Possibly related PRs

Poem

Hop, hop, tap, tap—I'm the bunny of the code,
Leaping through schema fields on a joyous road.
Inputs and outputs, neatly arrayed,
Image and text in a structured parade.
With carrots and code, my heart's in flight—
Celebrating these changes from morning till night! 🥕


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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Update Cohere OpenAPI: shorten stream, remove texts, add embed schemas Apr 2, 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 (3)
src/libs/Cohere/openapi.yaml (3)

7451-7457: Stream Property Description Truncation Review
The updated description for the stream property is now more concise. Please verify that the removal of references (e.g. to “Compatible Deployments”) does not confuse users who might rely on that detail. Review your external documentation and error messages to ensure consistency.


15237-15291: Definition of EmbedImage, EmbedImageProperties, EmbedInput, and EmbedInputType Schemas
The schemas for EmbedImage and its nested properties are defined in detail. A couple of points for consideration:

  • The properties such as bit_depth, height, and width are specified as type number with a format of int64. If these values are strictly integers, it might be clearer to use type integer.
  • The EmbedInput schema now requires a content property that is an array referencing EmbedContent, which aligns with the new structured input design.

Ensure that the type choices align with the expected data (especially regarding integer vs. number distinction).


15358-15374: Addition of EmbedText and EmbeddingType Schemas
The EmbedText schema is now defined with both a text string and a type property (referencing EmbedContentType), which is consistent with the discriminated union approach. The EmbeddingType enum currently only includes float—please confirm that this is intentional and that additional embedding types won’t be required soon.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 94557e8 and 888487b.

⛔ Files ignored due to path filters (28)
  • src/libs/Cohere/Generated/Cohere.CohereClient.Chatv2.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.CohereClient.Embedv2.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.Embedv2.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.Chatv2Request.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.EmbedContent.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.EmbedContent.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.EmbedContentDiscriminator.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.EmbedContentDiscriminator.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.EmbedContentDiscriminatorType.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.EmbedContentType.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.EmbedImage.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.EmbedImage.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.EmbedImageProperties.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.EmbedImageProperties.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.EmbedInput.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.EmbedInput.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.EmbedText.Json.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.EmbedText.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/Cohere.Models.Embedv2Request.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/JsonConverters.EmbedContent.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/JsonConverters.EmbedContentDiscriminatorType.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/JsonConverters.EmbedContentDiscriminatorTypeNullable.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/JsonConverters.EmbedContentType.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/JsonConverters.EmbedContentTypeNullable.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/JsonSerializerContext.g.cs is excluded by !**/generated/**
  • src/libs/Cohere/Generated/JsonSerializerContextTypes.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/Cohere/openapi.yaml (5 hunks)
🔇 Additional comments (2)
src/libs/Cohere/openapi.yaml (2)

7994-8015: Addition of New Properties: inputs and output_dimension
The new inputs property (an array referencing EmbedInput) and the output_dimension property (type integer) appear correctly added to the schema. Verify that these additions reflect the intended data model and that related validations (if any) are updated accordingly. Also, note that the existing texts property is still present; ensure it’s now optional if it has been removed from the required fields.


14132-14154: Introduction of EmbedContent & EmbedContentType Schemas
The new EmbedContent schema uses a oneOf construct with a discriminator based on the type field, and the EmbedContentType schema correctly enumerates the allowed values (text and image_url). Confirm that the downstream consumers of this API are updated to correctly handle the discriminator mapping and that both referenced schemas (EmbedImage and EmbedText) provide a compatible type field.

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