-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat:Update k parameter type to integer in /v1/chat and /v2/chat endpoints #198
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
Conversation
WalkthroughThe OpenAPI specification for the Cohere API was updated to change the data type of the Changes
Poem
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
src/libs/Cohere/Generated/Cohere.CohereClient.Chatv2.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.ICohereClient.Chatv2.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.Models.Chatv2Request.g.csis excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/Cohere/openapi.yaml(1 hunks)
| k: | ||
| maximum: 500 | ||
| minimum: 0 | ||
| type: number | ||
| type: integer | ||
| description: "Ensures that only the top `k` most likely tokens are considered for generation at each step. When `k` is set to `0`, k-sampling is disabled.\nDefaults to `0`, min value of `0`, max value of `500`.\n" | ||
| format: float | ||
| default: 0 | ||
| x-fern-audiences: | ||
| - public |
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.
💡 Verification agent
🧩 Analysis chain
Replace deprecated float type with integer
This update breaks clients that pass non‐integer values for k. Ensure the old type: number and format: float attributes are fully removed to avoid schema conflicts and treat k exclusively as an integer. Also document this as a breaking change (e.g., bump the API version or note it in the changelog).
Apply this patch if the old definitions still exist above this hunk:
- type: number
- format: float
+ type: integer🏁 Script executed:
#!/bin/bash
# Check for any remaining 'type: number' or 'format: float' in the Cohere OpenAPI spec
rg -n "type: number" src/libs/Cohere/openapi.yaml || echo "No occurrences of 'type: number'"
rg -n "format: float" src/libs/Cohere/openapi.yaml || echo "No occurrences of 'format: float'"Length of output: 2811
Ensure k uses only integer and document breaking change
The OpenAPI spec still defines k with the deprecated type: number and format: float immediately above the new integer schema (lines 7407–7409), which conflicts with the type: integer at lines 7412–7419 and will break clients sending floats. Remove the old attributes so k is strictly an integer, and note this as a breaking change (bump the API version or add to the changelog).
Affected file: src/libs/Cohere/openapi.yaml
Location: around lines 7407–7409
Apply this patch:
- type: number
- format: float
+ type: integerCommittable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In src/libs/Cohere/openapi.yaml around lines 7407 to 7409, remove the deprecated
'type: number' and 'format: float' attributes for the 'k' parameter to avoid
conflicts with the integer type defined at lines 7412 to 7419. Ensure 'k' is
strictly defined as an integer with the constraints already present.
Additionally, document this as a breaking change by either bumping the API
version or adding a note in the changelog to inform clients about the change in
accepted value types.
Summary by CodeRabbit
kparameter in chat endpoints only accepts integer values, improving input validation and consistency.