-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat:Deprecate OpenAPI paths and responses and update Images comments #298
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds deprecated: true flags to multiple OpenAPI paths and responses and updates inline comments in sample code blocks (Images section) within the same OpenAPI file. No functional API behavior or signatures are changed. Changes
Sequence Diagram(s)Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests
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. Comment |
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: 2
🧹 Nitpick comments (2)
src/libs/Cohere/openapi.yaml (2)
168-174
: Set the declared default in schema to match docs.Description says “Defaults to false” but there’s no
default
. Add it and (optionally) a rationale.search_queries_only: type: boolean description: "Defaults to `false`...." + default: false deprecated: true + x-deprecation-reason: "Replaced by tools-first flows."
1004-1010
: Operation-level deprecation is good; add a Sunset and reason to guide migration.Consider adding a target removal date and replacement to each deprecated operation for clearer client guidance.
Minimal example:
responses: '200': ... - deprecated: true + deprecated: true + x-deprecation-reason: "Superseded by /v2/chat." + x-sunset: "2025-12-31" + # Optionally surface the HTTP Sunset header: + # responses: + # '200': + # headers: + # Sunset: + # description: "This endpoint will be removed on 2025-12-31." + # schema: { type: string }If you prefer standards, keep
x-sunset
as metadata and document the HTTP Sunset header in a sharedcomponents.headers.Sunset
and reference it.Also applies to: 1128-1134, 1198-1204, 1271-1277, 1343-1349, 1421-1427, 1501-1507, 6623-6629, 7178-7184
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (21)
src/libs/Cohere/Generated/Cohere.CohereClient.Chat.g.cs
is excluded by!**/generated/**
src/libs/Cohere/Generated/Cohere.CohereClient.Classify.g.cs
is excluded by!**/generated/**
src/libs/Cohere/Generated/Cohere.CohereClient.Generate.g.cs
is excluded by!**/generated/**
src/libs/Cohere/Generated/Cohere.CohereClient.Summarize.g.cs
is excluded by!**/generated/**
src/libs/Cohere/Generated/Cohere.ConnectorsClient.CreateConnector.g.cs
is excluded by!**/generated/**
src/libs/Cohere/Generated/Cohere.ConnectorsClient.DeleteConnector.g.cs
is excluded by!**/generated/**
src/libs/Cohere/Generated/Cohere.ConnectorsClient.GetConnector.g.cs
is excluded by!**/generated/**
src/libs/Cohere/Generated/Cohere.ConnectorsClient.ListConnectors.g.cs
is excluded by!**/generated/**
src/libs/Cohere/Generated/Cohere.ConnectorsClient.OAuthAuthorizeConnector.g.cs
is excluded by!**/generated/**
src/libs/Cohere/Generated/Cohere.ConnectorsClient.UpdateConnector.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.Classify.g.cs
is excluded by!**/generated/**
src/libs/Cohere/Generated/Cohere.ICohereClient.Generate.g.cs
is excluded by!**/generated/**
src/libs/Cohere/Generated/Cohere.ICohereClient.Summarize.g.cs
is excluded by!**/generated/**
src/libs/Cohere/Generated/Cohere.IConnectorsClient.CreateConnector.g.cs
is excluded by!**/generated/**
src/libs/Cohere/Generated/Cohere.IConnectorsClient.DeleteConnector.g.cs
is excluded by!**/generated/**
src/libs/Cohere/Generated/Cohere.IConnectorsClient.GetConnector.g.cs
is excluded by!**/generated/**
src/libs/Cohere/Generated/Cohere.IConnectorsClient.ListConnectors.g.cs
is excluded by!**/generated/**
src/libs/Cohere/Generated/Cohere.IConnectorsClient.OAuthAuthorizeConnector.g.cs
is excluded by!**/generated/**
src/libs/Cohere/Generated/Cohere.IConnectorsClient.UpdateConnector.g.cs
is excluded by!**/generated/**
src/libs/Cohere/Generated/Cohere.Models.ChatRequest.g.cs
is excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/Cohere/openapi.yaml
(12 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test / Build, test and publish
items: | ||
$ref: '#/components/schemas/ChatConnector' | ||
description: "Accepts `{\"id\": \"web-search\"}`, and/or the `\"id\"` for a custom [connector](https://docs.cohere.com/docs/connectors), if you've [created](https://docs.cohere.com/v1/docs/creating-and-deploying-a-connector) one.\n\nWhen specified, the model's reply will be enriched with information found by querying each of the connectors (RAG).\n\nCompatible Deployments: Cohere Platform\n" | ||
deprecated: true | ||
x-fern-audiences: | ||
- public | ||
conversation_id: |
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.
🛠️ Refactor suggestion
❓ Verification inconclusive
Avoid siblings alongside $ref in Schema (OAS 3.0); wrap with allOf or move deprecation to the referenced schema/property.
Placing deprecated: true
next to $ref
under items
is ignored in OpenAPI 3.0.x. If this spec is 3.1, it’s fine; otherwise, please refactor.
Option A (works in 3.0.x): wrap with allOf
so deprecated
applies on the same Schema Object as the $ref
.
- items:
- $ref: '#/components/schemas/ChatConnector'
- description: "Accepts {\"id\": \"web-search\"}..."
- deprecated: true
+ items:
+ allOf:
+ - $ref: '#/components/schemas/ChatConnector'
+ description: "Accepts {\"id\": \"web-search\"}..."
+ deprecated: true
Option B: mark the array property’s Schema (not the referenced item) as deprecated, or set deprecated: true
inside #/components/schemas/ChatConnector
itself.
Add a brief reason where possible (e.g., x-deprecation-reason
), to help SDK consumers.
Wrap $ref siblings with allOf or move the deprecation into the referenced schema (OpenAPI 3.0).
OpenAPI 3.0 Reference Objects with $ref cannot be extended — sibling properties (e.g., deprecated) are ignored. (spec.openapis.org) OpenAPI 3.1 allows schema $ref siblings (JSON Schema 2020‑12 behavior). (spec.openapis.org)
File: src/libs/Cohere/openapi.yaml (lines 63–69)
Option A (works in 3.0.x): wrap the $ref with allOf so description/deprecated apply to the item:
- items:
- $ref: '#/components/schemas/ChatConnector'
- description: "Accepts {\"id\": \"web-search\"}..."
- deprecated: true
+ items:
+ allOf:
+ - $ref: '#/components/schemas/ChatConnector'
+ description: "Accepts {\"id\": \"web-search\"}..."
+ deprecated: true
(Using allOf as a workaround is standard guidance). (redocly.com)
Option B: mark the array property’s schema (the items container) as deprecated, or set deprecated: true inside components/schemas/ChatConnector.
Add an x-deprecation-reason annotation where possible.
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In src/libs/Cohere/openapi.yaml around lines 63 to 69, the schema uses a $ref
with sibling properties (e.g., deprecated/description) which OpenAPI 3.0
ignores; fix by either wrapping the $ref in an allOf and place the
deprecated/description alongside the allOf entry so they apply, or move the
deprecated: true (and optional description) into the referenced
components/schemas/ChatConnector itself, or mark the array property's items
container schema as deprecated; also add an x-deprecation-reason annotation
where appropriate.
type: message-end | ||
event: message-end | ||
- code-samples: | ||
- code: "const { CohereClientV2 } = require('cohere-ai');\n\nconst cohere = new CohereClientV2({});\n\n(async () => {\n const response = await cohere.chat({\n model: 'command-a-vision-07-2025',\n messages: [\n {\n role: 'user',\n content: [\n { type: 'text', text: 'Describe the logo!' },\n {\n type: 'image_url',\n imageUrl: {\n url: 'https://cohere.com/favicon-32x32.png',\n detail: 'auto',\n },\n },\n ],\n },\n ],\n });\n console.log(response.message.content[0].text);\n})();\n" | ||
- code: "const { CohereClientV2 } = require('cohere-ai');\n\nconst cohere = new CohereClientV2({});\n\n(async () => {\n const response = await cohere.chat({\n model: 'command-a-vision-07-2025',\n messages: [\n {\n role: 'user',\n content: [\n { type: 'text', text: 'Describe the logo!' },\n {\n type: 'image_url',\n imageUrl: {\n // Can be either a base64 data URI or a web URL.\n url: 'https://cohere.com/favicon-32x32.png',\n detail: 'auto',\n },\n },\n ],\n },\n ],\n });\n console.log(response.message.content[0].text);\n})();\n" | ||
name: Images | ||
sdk: typescript | ||
- code: "import cohere\n\nco = cohere.ClientV2()\n\nresponse = co.chat(\n model=\"command-a-vision-07-2025\",\n messages=[\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Describe the logo!\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://cohere.com/favicon-32x32.png\",\n \"detail\": \"auto\"\n }\n }\n ]\n \n }\n ]\n)\n\nprint(response)" | ||
- code: "import cohere\n\nco = cohere.ClientV2()\n\nresponse = co.chat(\n model=\"command-a-vision-07-2025\",\n messages=[\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Describe the logo!\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n # Can be either a base64 data URI or a web URL.\n \"url\": \"https://cohere.com/favicon-32x32.png\",\n \"detail\": \"auto\"\n }\n }\n ]\n \n }\n ]\n)\n\nprint(response)" | ||
name: Images | ||
sdk: python | ||
- code: "/* (C)2024 */\npackage chatv2post;\n\nimport java.util.List;\n\nimport com.cohere.api.Cohere;\nimport com.cohere.api.resources.v2.requests.V2ChatRequest;\nimport com.cohere.api.types.ChatMessageV2;\nimport com.cohere.api.types.ChatResponse;\nimport com.cohere.api.types.Content;\nimport com.cohere.api.types.ImageContent;\nimport com.cohere.api.types.ImageUrl;\nimport com.cohere.api.types.TextContent;\nimport com.cohere.api.types.UserMessage;\nimport com.cohere.api.types.UserMessageContent;\n\npublic class Image {\n\n public static void main(String[] args) {\n Cohere cohere = Cohere.builder().clientName(\"snippet\").build();\n\n ChatResponse response\n = cohere\n .v2()\n .chat(\n V2ChatRequest.builder()\n .model(\"command-a-vision-07-2025\")\n .messages(\n List.of(\n ChatMessageV2.user(\n UserMessage.builder()\n .content(\n UserMessageContent.of(\n List.of(\n Content.text(\n TextContent.builder()\n .text(\"Describe the logo!\")\n .build()),\n Content.imageUrl(\n ImageContent.builder()\n .imageUrl(\n ImageUrl.builder()\n .url(\n \"https://cohere.com/favicon-32x32.png\")\n .build())\n .build()))))\n .build())))\n .build());\n System.out.println(response);\n }\n}\n" | ||
- code: "/* (C)2024 */\npackage chatv2post;\n\nimport java.util.List;\n\nimport com.cohere.api.Cohere;\nimport com.cohere.api.resources.v2.requests.V2ChatRequest;\nimport com.cohere.api.types.ChatMessageV2;\nimport com.cohere.api.types.ChatResponse;\nimport com.cohere.api.types.Content;\nimport com.cohere.api.types.ImageContent;\nimport com.cohere.api.types.ImageUrl;\nimport com.cohere.api.types.TextContent;\nimport com.cohere.api.types.UserMessage;\nimport com.cohere.api.types.UserMessageContent;\n\npublic class Image {\n\n public static void main(String[] args) {\n Cohere cohere = Cohere.builder().clientName(\"snippet\").build();\n\n ChatResponse response\n = cohere\n .v2()\n .chat(\n V2ChatRequest.builder()\n .model(\"command-a-vision-07-2025\")\n .messages(\n List.of(\n ChatMessageV2.user(\n UserMessage.builder()\n .content(\n UserMessageContent.of(\n List.of(\n Content.text(\n TextContent.builder()\n .text(\"Describe the logo!\")\n .build()),\n Content.imageUrl(\n ImageContent.builder()\n .imageUrl(\n ImageUrl.builder()\n // Can be either a base64 data URI or a web URL.\n .url(\n \"https://cohere.com/favicon-32x32.png\")\n .build())\n .build()))))\n .build())))\n .build());\n System.out.println(response);\n }\n}\n" | ||
name: Images | ||
sdk: java | ||
- code: "package main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"os\"\n\n\tcohere \"github.com/cohere-ai/cohere-go/v2\"\n\tclient \"github.com/cohere-ai/cohere-go/v2/client\"\n)\n\nfunc main() {\n\tco := client.NewClient(client.WithToken(os.Getenv(\"CO_API_KEY\")))\n\n\tresp, err := co.V2.Chat(\n\t\tcontext.TODO(),\n\t\t&cohere.V2ChatRequest{\n\t\t\tModel: \"command-a-03-2025\",\n\t\t\tMessages: cohere.ChatMessages{\n\t\t\t\t{\n\t\t\t\t\tRole: \"user\",\n\t\t\t\t\tUser: &cohere.UserMessageV2{Content: &cohere.UserMessageV2Content{\n\t\t\t\t\t\tContentList: []*cohere.Content{\n\t\t\t\t\t\t\t{Type: \"text\", Text: &cohere.ChatTextContent{Text: \"Describe the logo!\"}},\n\t\t\t\t\t\t\t{Type: \"image_url\", ImageUrl: &cohere.ImageContent{\n\t\t\t\t\t\t\t\tImageUrl: &cohere.ImageUrl{\n\t\t\t\t\t\t\t\t\tUrl: \"https://cohere.com/favicon-32x32.png\",\n\t\t\t\t\t\t\t\t\tDetail: cohere.ImageUrlDetailAuto.Ptr(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}},\n\t\t\t\t\t\t}}},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"%+v\", resp)\n}\n" | ||
- code: "package main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"os\"\n\n\tcohere \"github.com/cohere-ai/cohere-go/v2\"\n\tclient \"github.com/cohere-ai/cohere-go/v2/client\"\n)\n\nfunc main() {\n\tco := client.NewClient(client.WithToken(os.Getenv(\"CO_API_KEY\")))\n\n\tresp, err := co.V2.Chat(\n\t\tcontext.TODO(),\n\t\t&cohere.V2ChatRequest{\n\t\t\tModel: \"command-a-03-2025\",\n\t\t\tMessages: cohere.ChatMessages{\n\t\t\t\t{\n\t\t\t\t\tRole: \"user\",\n\t\t\t\t\tUser: &cohere.UserMessageV2{Content: &cohere.UserMessageV2Content{\n\t\t\t\t\t\tContentList: []*cohere.Content{\n\t\t\t\t\t\t\t{Type: \"text\", Text: &cohere.ChatTextContent{Text: \"Describe the logo!\"}},\n\t\t\t\t\t\t\t{Type: \"image_url\", ImageUrl: &cohere.ImageContent{\n\t\t\t\t\t\t\t\tImageUrl: &cohere.ImageUrl{\n\t\t\t\t\t\t\t\t\t// Can be either a base64 data URI or a web URL.\n\t\t\t\t\t\t\t\t\tUrl: \"https://cohere.com/favicon-32x32.png\",\n\t\t\t\t\t\t\t\t\tDetail: cohere.ImageUrlDetailAuto.Ptr(),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}},\n\t\t\t\t\t\t}}},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"%+v\", resp)\n}\n" | ||
name: Images | ||
sdk: go | ||
- code: "curl --request POST \\\n --url https://api.cohere.com/v2/chat \\\n --header 'accept: application/json' \\\n --header 'content-type: application/json' \\\n --header \"Authorization: bearer $CO_API_KEY\" \\\n --data '{\n \"model\": \"command-a-vision-07-2025\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Describe the logo!\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://cohere.com/favicon-32x32.png\",\n \"detail\": \"auto\"\n }\n }\n ]\n }\n ]\n }'\n" |
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.
🧩 Analysis chain
Fix Go sample: non‑vision model used with image_url content.
The Go snippet uses command-a-03-2025
while sending image content; that model likely won’t accept images. Align with the other samples.
- Model: "command-a-03-2025",
+ Model: "command-a-vision-07-2025",
Also, please verify the TS SDK init and field casing compile cleanly with the current v2 types. If the SDK doesn’t auto-read CO_API_KEY
, make the token explicit for consistency across samples.
-const cohere = new CohereClientV2({});
+const cohere = new CohereClientV2({ token: process.env.CO_API_KEY });
Finally, confirm imageUrl
vs image_url
property names match the v2 SDK typings for TypeScript; the JSON API uses image_url
, but the TS SDK may camelCase.
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== Searching for Cohere model strings ==="
rg -n --hidden --no-ignore-vcs "command-a-03-2025|command-a-vision-07-2025" -S || true
echo
echo "=== Searching for TS SDK usage (CohereClientV2) ==="
rg -n --hidden --no-ignore-vcs "CohereClientV2|new CohereClientV2" -S || true
echo
echo "=== Searching for API key env / constructor token usage ==="
rg -n --hidden --no-ignore-vcs "CO_API_KEY|COHERE_API_KEY|process.env.CO_API_KEY|process.env.COHERE_API_KEY|token:" -S || true
echo
echo "=== Searching for image property names ==="
rg -n --hidden --no-ignore-vcs "image_url|imageUrl" -S || true
echo
echo "=== Showing src/libs/Cohere/openapi.yaml snippet (if present) ==="
if [ -f src/libs/Cohere/openapi.yaml ]; then
sed -n '8758,8789p' src/libs/Cohere/openapi.yaml || true
else
echo "src/libs/Cohere/openapi.yaml not found"
fi
Length of output: 183386
Fix Go image example to use vision model; verify TS client init & image field casing
- Go sample (src/libs/Cohere/openapi.yaml — Images block, ~lines 8775–8787) uses a non‑vision model while sending image content; change model to the vision variant to match other samples.
- Model: "command-a-03-2025",
+ Model: "command-a-vision-07-2025",
- Make the TypeScript client token explicit if the SDK does not auto-read the env var (samples currently use an empty config).
-const cohere = new CohereClientV2({});
+const cohere = new CohereClientV2({ token: process.env.CO_API_KEY });
- Confirm TypeScript v2 typings expect camelCase imageUrl (TS sample uses imageUrl) vs the JSON API snake_case image_url; update the TS sample to match the SDK typings if they differ.
Committable suggestion skipped: line range outside the PR's diff.
Summary by CodeRabbit