Skip to content

Fixed version format issue (v2 inconsistency)#286

Open
ritam-g wants to merge 1 commit intocohere-ai:mainfrom
ritam-g:fix-version-format
Open

Fixed version format issue (v2 inconsistency)#286
ritam-g wants to merge 1 commit intocohere-ai:mainfrom
ritam-g:fix-version-format

Conversation

@ritam-g
Copy link
Copy Markdown

@ritam-g ritam-g commented Apr 4, 2026

📌 Description

This PR fixes an inconsistency in the version format (v2) used in the repository.

🔧 Changes Made

  • Updated version format to match the current implementation
  • Fixed incorrect/inconsistent usage of v2 across files
  • Ensured consistency with existing standards

🎯 Why This Change?

The previous implementation had mismatched version formatting, which could lead to confusion and potential issues while using or extending the code.

✅ Result

  • Cleaner and consistent version usage
  • Improved readability and maintainability

🙌 Notes

This is my first contribution to this project. Let me know if any changes are needed.


Note

Medium Risk
Changes the HTTP path used by chatStream from v1 to v2, which can affect runtime behavior and compatibility if the server/API expectations differ. Scope is small and isolated to the streaming chat call site.

Overview
Updates the SDK’s streaming chat request (chatStream) to call the v2 Chat endpoint (POST v2/chat) instead of v1/chat, aligning the versioned route used for streaming chat with the intended API version.

Reviewed by Cursor Bugbot for commit 4b962a2. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 4b962a2. Configure here.

(await core.Supplier.get(this._options.environment)) ??
environments.CohereEnvironment.Production,
"v1/chat",
"v2/chat",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

V1 chat stream incorrectly routed to v2 endpoint

High Severity

The v1 chatStream method in CohereClient now sends requests to "v2/chat" while still using v1 types (Cohere.ChatStreamRequest), v1 serializers (serializers.ChatStreamRequest), v1 response types (Cohere.StreamedChatResponse), and v1 responseType: "streaming" instead of v2's "sse". The v2 endpoint expects a completely different request/response format (as seen in V2Client which uses V2ChatStreamRequest, V2ChatStreamResponse, and responseType: "sse"). This will break all callers of CohereClient.chatStream() at runtime. The non-streaming chat method in the same class still correctly uses "v1/chat", further confirming this is unintentional.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4b962a2. Configure here.

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