Skip to content

Commit 38fd139

Browse files
committed
pass stream in the body instead of the path
1 parent 07ad240 commit 38fd139

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

packages/openai-adapters/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/openai-adapters/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@continuedev/openai-adapters",
3-
"version": "1.0.33",
3+
"version": "1.0.34",
44
"description": "",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

packages/openai-adapters/src/apis/WatsonX.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class WatsonXApi implements BaseLlmApi {
134134
}
135135

136136
private getEndpoint(endpoint: string): string {
137-
return `${this.apiBase}ml/v1/${this.deploymentId ? `deployments/${this.deploymentId}/` : ""}text/${endpoint}_stream?version=${this.apiVersion}`;
137+
return `${this.apiBase}ml/v1/${this.deploymentId ? `deployments/${this.deploymentId}/` : ""}text/${endpoint}?version=${this.apiVersion}`;
138138
}
139139

140140
private _convertBody(oaiBody: ChatCompletionCreateParams) {
@@ -174,6 +174,10 @@ export class WatsonXApi implements BaseLlmApi {
174174
}
175175
}
176176

177+
if (oaiBody.stream) {
178+
payload.stream = oaiBody.stream;
179+
}
180+
177181
return payload;
178182
}
179183

@@ -216,7 +220,12 @@ export class WatsonXApi implements BaseLlmApi {
216220
): AsyncGenerator<ChatCompletionChunk, any, unknown> {
217221
const url = this.getEndpoint("chat");
218222
const headers = await this.getHeaders();
219-
const stringifiedBody = JSON.stringify(this._convertBody(body));
223+
const stringifiedBody = JSON.stringify(
224+
this._convertBody({
225+
...body,
226+
stream: true,
227+
}),
228+
);
220229
const response = await customFetch(this.config.requestOptions)(url, {
221230
method: "POST",
222231
headers,

0 commit comments

Comments
 (0)