Fixed version format issue (v2 inconsistency)#286
Fixed version format issue (v2 inconsistency)#286ritam-g wants to merge 1 commit intocohere-ai:mainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 4b962a2. Configure here.
| (await core.Supplier.get(this._options.environment)) ?? | ||
| environments.CohereEnvironment.Production, | ||
| "v1/chat", | ||
| "v2/chat", |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 4b962a2. Configure here.


📌 Description
This PR fixes an inconsistency in the version format (v2) used in the repository.
🔧 Changes Made
🎯 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
🙌 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
chatStreamfromv1tov2, 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 thev2Chat endpoint (POST v2/chat) instead ofv1/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.