Skip to content

Commit 2bb45a4

Browse files
authored
fix(openai): ensure that we're not sending stream: true even if streaming is not being done (#7959)
2 parents b7bba19 + 985d015 commit 2bb45a4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

libs/langchain-openai/src/chat_models.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -1568,13 +1568,14 @@ export class ChatOpenAI<
15681568
this.reasoningEffort = fields?.reasoningEffort;
15691569
this.maxTokens = fields?.maxCompletionTokens ?? fields?.maxTokens;
15701570
this.useResponsesApi = fields?.useResponsesApi ?? this.useResponsesApi;
1571-
1572-
if (this.model === "o1") {
1573-
this.disableStreaming = true;
1574-
}
1571+
this.disableStreaming = fields?.disableStreaming ?? this.disableStreaming;
1572+
if (this.model === "o1") this.disableStreaming = true;
15751573

15761574
this.streaming = fields?.streaming ?? false;
1575+
if (this.disableStreaming) this.streaming = false;
1576+
15771577
this.streamUsage = fields?.streamUsage ?? this.streamUsage;
1578+
if (this.disableStreaming) this.streamUsage = false;
15781579

15791580
this.clientConfig = {
15801581
apiKey: this.apiKey,

0 commit comments

Comments
 (0)