feat:Add deprecation flags in OpenAPI spec; clarify image_url input#292
feat:Add deprecation flags in OpenAPI spec; clarify image_url input#292
Conversation
WalkthroughDeprecated flags were added to multiple paths and responses in the OpenAPI spec. Documentation code samples were updated to clarify that image_url accepts base64 data URIs or web URLs across several languages. No API signatures were changed. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ 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.
Actionable comments posted: 2
🧹 Nitpick comments (10)
src/libs/Cohere/openapi.yaml (10)
171-171: Schema-level deprecation: OK — add guidance to consumers.
deprecated: trueon thesearch_queries_onlyboolean is valid. Add a short note in the propertydescriptionwith migration guidance (what to use instead) to help client generators and users.- description: "Defaults to `false`.\n\nWhen `true`, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's `message` will be generated.\n\nCompatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments\n" + description: "Defaults to `false`.\n\nWhen `true`, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's `message` will be generated.\n\nDeprecated: use <replacement-flag> instead. This field will be removed after the sunset date.\n\nCompatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments\n"
1007-1007: Operation deprecation: add replacement pointer and (optional) sunset metadata.Marking the operation as deprecated is fine. Add a one-line
descriptionwith the replacement path and consider an extension likex-sunset: 2025-12-31orx-deprecation-reason.deprecated: true + description: "Deprecated. Use <new-endpoint> instead." + x-deprecation-reason: "Consolidated into <new-endpoint>." + x-sunset: "2025-12-31"
1131-1131: Same as above: document the migration path.Repeat the replacement pointer and optional sunset fields for consistency across deprecated operations.
deprecated: true + description: "Deprecated. Use <new-endpoint> instead." + x-deprecation-reason: "Consolidated into <new-endpoint>." + x-sunset: "2025-12-31"
1201-1201: Add deprecation rationale and successor endpoint.deprecated: true + description: "Deprecated. Use <new-endpoint> instead." + x-deprecation-reason: "Replaced by <new-endpoint> for performance and consistency." + x-sunset: "2025-12-31"
1274-1274: Consistent deprecation metadata.deprecated: true + description: "Deprecated. Use <new-endpoint> instead." + x-deprecation-reason: "Unified behavior under <new-endpoint>." + x-sunset: "2025-12-31"
1346-1346: Consistent deprecation metadata.deprecated: true + description: "Deprecated. Use <new-endpoint> instead." + x-deprecation-reason: "Superseded by <new-endpoint>." + x-sunset: "2025-12-31"
1424-1424: Consistent deprecation metadata.deprecated: true + description: "Deprecated. Use <new-endpoint> instead." + x-deprecation-reason: "API surface cleanup." + x-sunset: "2025-12-31"
1504-1504: Consistent deprecation metadata.deprecated: true + description: "Deprecated. Use <new-endpoint> instead." + x-deprecation-reason: "Functionality moved." + x-sunset: "2025-12-31"
6626-6626: Consistent deprecation metadata.deprecated: true + description: "Deprecated. Use <new-endpoint> instead." + x-deprecation-reason: "Consolidation." + x-sunset: "2025-12-31"
7181-7181: Consistent deprecation metadata.deprecated: true + description: "Deprecated. Use <new-endpoint> instead." + x-deprecation-reason: "Consolidation." + x-sunset: "2025-12-31"
📜 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.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.CohereClient.Classify.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.CohereClient.Generate.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.CohereClient.Summarize.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.ConnectorsClient.CreateConnector.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.ConnectorsClient.DeleteConnector.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.ConnectorsClient.GetConnector.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.ConnectorsClient.ListConnectors.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.ConnectorsClient.OAuthAuthorizeConnector.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.ConnectorsClient.UpdateConnector.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.ICohereClient.Chat.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.ICohereClient.Classify.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.ICohereClient.Generate.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.ICohereClient.Summarize.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.IConnectorsClient.CreateConnector.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.IConnectorsClient.DeleteConnector.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.IConnectorsClient.GetConnector.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.IConnectorsClient.ListConnectors.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.IConnectorsClient.OAuthAuthorizeConnector.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.IConnectorsClient.UpdateConnector.g.csis excluded by!**/generated/**src/libs/Cohere/Generated/Cohere.Models.ChatRequest.g.csis 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 |
There was a problem hiding this comment.
Deprecation should be on the property, not the array items.
Placing deprecated: true under items deprecates each element’s schema (ChatConnector), not the connectors parameter/property itself. If the whole connectors field is deprecated, move deprecated: true up one level (sibling to items).
Apply this diff (adjust indentation to your YAML structure):
- deprecated: true
+ deprecated: trueCommittable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In src/libs/Cohere/openapi.yaml around line 66, the `deprecated: true` was
placed under `items` which deprecates each element schema instead of the entire
`connectors` property; remove the `deprecated` key from the `items` block and
add `deprecated: true` as a sibling to `items` on the `connectors` property
level (i.e., move `deprecated: true` up one indentation so it sits next to
`items` under the `connectors` field).
| - 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.
🧩 Analysis chain
Code samples: unify model names and verify SDK field casing.
- Use a consistent model across TS/Python/Java/Go/cURL (currently mixes
command-a-vision-07-2025andcommand-a-03-2025). - Confirm per-SDK casing for the image URL field: TS uses
imageUrl, Python usesimage_url, Go usesImageUrlstruct — these must match each SDK’s types. - Consider adding a data URI example alongside the web URL.
Proposed tweaks (illustrative):
- model: 'command-a-vision-07-2025',
+ model: 'command-a-vision-07-2025',
@@
- // Can be either a base64 data URI or a web URL.
+ // Can be either a base64 data URI (e.g., "data:image/png;base64,....") or a web URL.To verify SDK field casing and client names, please confirm with current SDK docs:
🌐 Web query:
Cohere Node SDK v2: confirm client name (`CohereClientV2`) and image content field casing (`imageUrl.url` vs alternatives). Also verify Python SDK v2 uses `ClientV2()` and `image_url.url`.
💡 Result:
Short answers:
- Cohere Node/TypeScript SDK v2 client class is CohereClientV2. [1][2]
- Image content uses snake_case image_url with a nested url field (e.g. image_url: { url: "..." }); you should not use camelCase imageUrl.url. (Docs show the image content block as "type": "image_url" and "image_url": {"url": ...}). [3]
- Cohere Python SDK v2 uses cohere.ClientV2() (and image content uses image_url with image_url["url"]). [4]
Sources:
- Cohere TypeScript SDK repo / npm usage (CohereClientV2).
- Cohere API reference / TypeScript examples (CohereClientV2).
- Cohere Image Inputs / Command A Vision docs showing "image_url": {"url": "..."} (snake_case).
- Cohere docs “Creating a client” and Python examples showing cohere.ClientV2().
If you want, I can paste the exact code snippets for Node and Python.
Unify model names and correct SDK image field casing
- TS: use CohereClientV2 and send image content as snake_case image_url: { url: "..." } — do not use imageUrl.url.
- Python: use cohere.ClientV2() and image_url["url"].
- Go/Java/cURL: ensure language-specific types/JSON tags serialize to image_url (e.g., Go struct json:"image_url").
- Unify the model string across all samples (currently mixes "command-a-vision-07-2025" and "command-a-03-2025").
- Add a data URI example (e.g., "data:image/png;base64,...") alongside the web-URL example.
Location: src/libs/Cohere/openapi.yaml (around lines 8775–8787).
🤖 Prompt for AI Agents
In src/libs/Cohere/openapi.yaml around lines 8775 to 8787, example snippets use
inconsistent model names and incorrect image field casing and client names
across languages; update TypeScript to use CohereClientV2 and send images as
snake_case image_url: { url: "..." } (replace any imageUrl.url usage), update
Python to use cohere.ClientV2() and image_url["url"], ensure Go/Java/cURL
types/JSON tags serialize to image_url (e.g., Go struct json:"image_url"), unify
the model string across all samples to a single model identifier (pick one,
e.g., "command-a-vision-07-2025") and add an additional image example using a
data URI ("data:image/png;base64,...") alongside the existing web URL example.
Summary by CodeRabbit