pass stream in the body instead of the path
This commit is contained in:
parent
07ad240b0c
commit
38fd139c5b
3 changed files with 14 additions and 5 deletions
4
packages/openai-adapters/package-lock.json
generated
4
packages/openai-adapters/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@continuedev/openai-adapters",
|
||||
"version": "1.0.32",
|
||||
"version": "1.0.33",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@continuedev/openai-adapters",
|
||||
"version": "1.0.32",
|
||||
"version": "1.0.33",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "^1.0.5",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@continuedev/openai-adapters",
|
||||
"version": "1.0.33",
|
||||
"version": "1.0.34",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ export class WatsonXApi implements BaseLlmApi {
|
|||
}
|
||||
|
||||
private getEndpoint(endpoint: string): string {
|
||||
return `${this.apiBase}ml/v1/${this.deploymentId ? `deployments/${this.deploymentId}/` : ""}text/${endpoint}_stream?version=${this.apiVersion}`;
|
||||
return `${this.apiBase}ml/v1/${this.deploymentId ? `deployments/${this.deploymentId}/` : ""}text/${endpoint}?version=${this.apiVersion}`;
|
||||
}
|
||||
|
||||
private _convertBody(oaiBody: ChatCompletionCreateParams) {
|
||||
|
|
@ -174,6 +174,10 @@ export class WatsonXApi implements BaseLlmApi {
|
|||
}
|
||||
}
|
||||
|
||||
if (oaiBody.stream) {
|
||||
payload.stream = oaiBody.stream;
|
||||
}
|
||||
|
||||
return payload;
|
||||
}
|
||||
|
||||
|
|
@ -216,7 +220,12 @@ export class WatsonXApi implements BaseLlmApi {
|
|||
): AsyncGenerator<ChatCompletionChunk, any, unknown> {
|
||||
const url = this.getEndpoint("chat");
|
||||
const headers = await this.getHeaders();
|
||||
const stringifiedBody = JSON.stringify(this._convertBody(body));
|
||||
const stringifiedBody = JSON.stringify(
|
||||
this._convertBody({
|
||||
...body,
|
||||
stream: true,
|
||||
}),
|
||||
);
|
||||
const response = await customFetch(this.config.requestOptions)(url, {
|
||||
method: "POST",
|
||||
headers,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue