Skip to content

Conversation

HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Sep 21, 2025

Summary by CodeRabbit

  • Documentation
    • Marked multiple API endpoints and response codes as deprecated in the OpenAPI specification to surface deprecation status in docs and compatible tooling.
    • Updated image-related sample code across TypeScript, Java, Python, and Go to clarify that image_url can be a base64 data URI or a web URL, with added inline comments.
    • No changes to request/response shapes or usage; updates are strictly documentation and metadata improvements.

Copy link

coderabbitai bot commented Sep 21, 2025

Walkthrough

Adds 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

Cohort / File(s) Summary
OpenAPI deprecations
src/libs/Cohere/openapi.yaml
Inserted deprecated: true across numerous path operations and response entries (including 504 GatewayTimeout references).
Sample comment refinements
src/libs/Cohere/openapi.yaml (samples under Images; TypeScript, Java, Python, Go)
Replaced/expanded sample snippets to include comments clarifying that image_url can be a base64 data URI or web URL; no semantic changes to usage.

Sequence Diagram(s)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

A rabbit with specs in paw, takes note: “deprecated.”
Nibbles through YAML, each path clearly annotated.
Samples get whispers: “URLs or base64, you choose.”
No code hops changed, just clearer views.
Thump-thump—documentation groomed, carrots approved. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The title "feat:@coderabbitai" is a short token/handle that does not describe the actual changes in this PR; the diff mainly adds deprecated: true markers across many API path items and responses in src/libs/Cohere/openapi.yaml and updates example comments in public API samples. Because the title contains no clear scope or summary of these modifications, it is misleading for reviewers scanning the commit history and does not highlight the primary change. This fails the requirement that the title concisely summarize the main change. Please rename the PR to a concise, descriptive title such as "chore(openapi): mark deprecated endpoints in Cohere openapi.yaml and update sample comments" or "docs(openapi): add deprecated flags to Cohere/openapi.yaml", then update the PR description if needed so reviewers can quickly understand the intent.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bot/update-openapi_202509210629

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@HavenDV HavenDV enabled auto-merge (squash) September 21, 2025 06:30
@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Deprecate OpenAPI paths and responses and update Images comments Sep 21, 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: 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 shared components.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

📥 Commits

Reviewing files that changed from the base of the PR and between 111c2a6 and 0cd06f0.

⛔ 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

Comment on lines 63 to 69
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:
Copy link

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.

Comment on lines 8772 to 8787
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"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

🧩 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.

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