From ef4cb51036a9e25a976e99db82105388a92013e6 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Fri, 30 Jan 2026 12:33:40 +0530 Subject: [PATCH 1/5] feat: add requestoptions.stream in model config --- core/index.d.ts | 1 + core/llm/index.ts | 10 +++++++++- packages/config-types/src/index.ts | 2 ++ packages/config-yaml/src/schemas/models.ts | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/index.d.ts b/core/index.d.ts index d88feb60bf2..5f27509c7ef 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -1050,6 +1050,7 @@ export interface RequestOptions { extraBodyProperties?: { [key: string]: any }; noProxy?: string[]; clientCertificate?: ClientCertificateOptions; + stream?: boolean; } export interface CacheBehavior { diff --git a/core/llm/index.ts b/core/llm/index.ts index ceea1153dcd..4449a3367a8 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -548,6 +548,13 @@ export abstract class BaseLLM implements ILLM { options, ); + if ( + completionOptions.stream === false || + this.requestOptions?.stream === false + ) { + completionOptions.stream = false; + } + return { completionOptions, logEnabled: log, raw }; } @@ -1037,7 +1044,8 @@ export abstract class BaseLLM implements ILLM { return ( this.providerName === "openai" && typeof (this as any)._streamResponses === "function" && - (this as any).isOSeriesOrGpt5Model(options.model) + (this as any).isOSeriesOrGpt5Model(options.model) && + this._llmOptions.useLegacyCompletionsEndpoint !== true ); } diff --git a/packages/config-types/src/index.ts b/packages/config-types/src/index.ts index a22bb00bb0b..630fb076863 100644 --- a/packages/config-types/src/index.ts +++ b/packages/config-types/src/index.ts @@ -37,6 +37,7 @@ export const requestOptionsSchema = z.object({ extraBodyProperties: z.record(z.any()).optional(), noProxy: z.array(z.string()).optional(), clientCertificate: clientCertificateOptionsSchema.optional(), + stream: z.boolean().optional(), }); export type RequestOptions = z.infer; @@ -97,6 +98,7 @@ export const modelDescriptionSchema = z.object({ headers: z.record(z.string()).optional(), extraBodyProperties: z.record(z.any()).optional(), noProxy: z.array(z.string()).optional(), + stream: z.boolean().optional(), }) .optional(), promptTemplates: z.record(z.string()).optional(), diff --git a/packages/config-yaml/src/schemas/models.ts b/packages/config-yaml/src/schemas/models.ts index cefbd93fa95..593256b3a2c 100644 --- a/packages/config-yaml/src/schemas/models.ts +++ b/packages/config-yaml/src/schemas/models.ts @@ -18,6 +18,7 @@ export const requestOptionsSchema = z.object({ extraBodyProperties: z.record(z.any()).optional(), noProxy: z.array(z.string()).optional(), clientCertificate: clientCertificateOptionsSchema.optional(), + stream: z.boolean().optional(), }); export type RequestOptions = z.infer; export const modelRolesSchema = z.enum([ From 19b632f5b6057820598ca540f6837dc5f27e4655 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Mon, 2 Feb 2026 20:04:20 +0530 Subject: [PATCH 2/5] remove introduced requestoptions.stream - already completionoptions.stream is present --- core/index.d.ts | 1 - core/llm/index.ts | 9 ++------- packages/config-types/src/index.ts | 2 -- packages/config-yaml/src/schemas/models.ts | 1 - 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/core/index.d.ts b/core/index.d.ts index 5f27509c7ef..d88feb60bf2 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -1050,7 +1050,6 @@ export interface RequestOptions { extraBodyProperties?: { [key: string]: any }; noProxy?: string[]; clientCertificate?: ClientCertificateOptions; - stream?: boolean; } export interface CacheBehavior { diff --git a/core/llm/index.ts b/core/llm/index.ts index 4449a3367a8..2feba2c4471 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -548,13 +548,6 @@ export abstract class BaseLLM implements ILLM { options, ); - if ( - completionOptions.stream === false || - this.requestOptions?.stream === false - ) { - completionOptions.stream = false; - } - return { completionOptions, logEnabled: log, raw }; } @@ -1208,6 +1201,8 @@ export abstract class BaseLLM implements ILLM { } } + console.log("debug1 llm options", this._llmOptions); + const canUseResponses = this.canUseOpenAIResponses(completionOptions); const useStream = completionOptions.stream !== false; diff --git a/packages/config-types/src/index.ts b/packages/config-types/src/index.ts index 630fb076863..da2f2354a6f 100644 --- a/packages/config-types/src/index.ts +++ b/packages/config-types/src/index.ts @@ -15,7 +15,6 @@ export const completionOptionsSchema = z.object({ keepAlive: z.number().optional(), numGpu: z.number().optional(), raw: z.boolean().optional(), - stream: z.boolean().optional(), }); export type CompletionOptions = z.infer; @@ -37,7 +36,6 @@ export const requestOptionsSchema = z.object({ extraBodyProperties: z.record(z.any()).optional(), noProxy: z.array(z.string()).optional(), clientCertificate: clientCertificateOptionsSchema.optional(), - stream: z.boolean().optional(), }); export type RequestOptions = z.infer; diff --git a/packages/config-yaml/src/schemas/models.ts b/packages/config-yaml/src/schemas/models.ts index 593256b3a2c..cefbd93fa95 100644 --- a/packages/config-yaml/src/schemas/models.ts +++ b/packages/config-yaml/src/schemas/models.ts @@ -18,7 +18,6 @@ export const requestOptionsSchema = z.object({ extraBodyProperties: z.record(z.any()).optional(), noProxy: z.array(z.string()).optional(), clientCertificate: clientCertificateOptionsSchema.optional(), - stream: z.boolean().optional(), }); export type RequestOptions = z.infer; export const modelRolesSchema = z.enum([ From ac5b8dc08476cfa39bb4e9f92e8d056674ac083c Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Mon, 2 Feb 2026 20:05:06 +0530 Subject: [PATCH 3/5] remove console log --- core/llm/index.ts | 2 -- packages/config-types/src/index.ts | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/core/llm/index.ts b/core/llm/index.ts index 2feba2c4471..9097525b81b 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -1201,8 +1201,6 @@ export abstract class BaseLLM implements ILLM { } } - console.log("debug1 llm options", this._llmOptions); - const canUseResponses = this.canUseOpenAIResponses(completionOptions); const useStream = completionOptions.stream !== false; diff --git a/packages/config-types/src/index.ts b/packages/config-types/src/index.ts index da2f2354a6f..7f34fb99d88 100644 --- a/packages/config-types/src/index.ts +++ b/packages/config-types/src/index.ts @@ -15,6 +15,7 @@ export const completionOptionsSchema = z.object({ keepAlive: z.number().optional(), numGpu: z.number().optional(), raw: z.boolean().optional(), + stream: z.boolean().optional(), }); export type CompletionOptions = z.infer; @@ -95,7 +96,6 @@ export const modelDescriptionSchema = z.object({ proxy: z.string().optional(), headers: z.record(z.string()).optional(), extraBodyProperties: z.record(z.any()).optional(), - noProxy: z.array(z.string()).optional(), stream: z.boolean().optional(), }) .optional(), From be3931718e7d601362c8b88dfd60051f9cdffc2e Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Mon, 2 Feb 2026 20:07:02 +0530 Subject: [PATCH 4/5] restore config-types --- packages/config-types/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/config-types/src/index.ts b/packages/config-types/src/index.ts index 7f34fb99d88..a22bb00bb0b 100644 --- a/packages/config-types/src/index.ts +++ b/packages/config-types/src/index.ts @@ -96,7 +96,7 @@ export const modelDescriptionSchema = z.object({ proxy: z.string().optional(), headers: z.record(z.string()).optional(), extraBodyProperties: z.record(z.any()).optional(), - stream: z.boolean().optional(), + noProxy: z.array(z.string()).optional(), }) .optional(), promptTemplates: z.record(z.string()).optional(), From 208d2b8b410699d38de7d879ee240f662c67cddf Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Mon, 2 Feb 2026 20:11:25 +0530 Subject: [PATCH 5/5] add stream option to config yaml reference --- docs/reference.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/reference.mdx b/docs/reference.mdx index 0e8cef73735..d7c28208b66 100644 --- a/docs/reference.mdx +++ b/docs/reference.mdx @@ -110,6 +110,7 @@ The `models` section defines the language models used in your configuration. Mod - `stop`: An array of stop tokens that will terminate the completion. - `reasoning`: Boolean to enable thinking/reasoning for Anthropic Claude 3.7+ and some Ollama models. - `reasoningBudgetTokens`: Budget tokens for thinking/reasoning in Anthropic Claude 3.7+ models. + - `stream`: Boolean to enable/disable streaming for the model. - `requestOptions`: HTTP request options specific to the model.