llama on ChatGroq with disable_streaming set to true and ran through the "nostream" tag with response_format fails when using streamEvents #220

Open
opened 2026-02-15 17:17:30 -05:00 by yindo · 3 comments
Owner

Originally created by @hiitsmax on GitHub (Mar 31, 2025).

I made a graph with a node in which a ChatGroq is invoked with response_format: "json_object".


ChatGroq is initialized like

this.model = new ChatGroq({
				...this.config.additionalOptions,
				model: this.config.model,
				disableStreaming: true,
				stream:false,
				streaming: false,
				apiKey: groqCredentials.getApiKey(),
				baseURL: groqCredentials.config.baseURL,
			});

then the response format is binded in the runnable

const chain = RunnableSequence.from([promptTemplate, model]).bind({ response_format: {type: 'json_object'} })

the chain is called it inside the node through

chain.invoke(state.messages, {})

Finally the node is added to the graph through the "nostream" tag as written in the docs

.addNode("User's KPI choice", RunnableLambda.from(this.userKPIChoiceNode).withConfig({
            tags: ["nostream"]
          }), {ends: ['KPI clarification']})

This leads the run of the graph called through graphAgent.streamEvents(stateToStream, streamConfig) to this error:

Error processing message: 400 {"error":{"message":"response_format` does not support streaming","type":"invalid_request_error"}}
    at APIError.generate (C:\Users\m.mendozza\Documents\GitHub\accelerator-ai\node_modules\groq-sdk\error.js:40:20)
    at Groq.makeStatusError (C:\Users\m.mendozza\Documents\GitHub\accelerator-ai\node_modules\groq-sdk\core.js:275:33)
    at Groq.makeRequest (C:\Users\m.mendozza\Documents\GitHub\accelerator-ai\node_modules\groq-sdk\core.js:322:30)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async RetryOperation._fn (C:\Users\m.mendozza\Documents\GitHub\accelerator-ai\node_modules\p-retry\index.js:50:12)

This is the node's metadata extracted from Langfuse

{
  tags: [
    0: "seq:step:2"
    1: "nostream"
  ]
  thread_id: "47b8486a-9381-4648-a31e-53db4e941fe3"
  langgraph_step: 3
  langgraph_node: "User's KPI choice"
  langgraph_triggers: [
    0: "branch:Get all objectives:__self__:User's KPI choice"
  ]
  langgraph_path: [
    0: "__pregel_pull"
    1: "User's KPI choice"
  ]
  langgraph_checkpoint_ns: "User's KPI choice:4e09ac84-fa33-549d-8f3d-5d7f9c4502e9"
  __pregel_resuming: false
  __pregel_task_id: "4e09ac84-fa33-549d-8f3d-5d7f9c4502e9"
  checkpoint_ns: "User's KPI choice:4e09ac84-fa33-549d-8f3d-5d7f9c4502e9"
  ls_provider: "groq"
  ls_model_name: "llama-3.3-70b-versatile"
  ls_model_type: "chat"
  ls_temperature: 0.02
}
Originally created by @hiitsmax on GitHub (Mar 31, 2025). I made a graph with a node in which a ChatGroq is invoked with `response_format: "json_object"`. - - - ChatGroq is initialized like ``` javascript this.model = new ChatGroq({ ...this.config.additionalOptions, model: this.config.model, disableStreaming: true, stream:false, streaming: false, apiKey: groqCredentials.getApiKey(), baseURL: groqCredentials.config.baseURL, }); ``` then the response format is binded in the runnable ``` javascript const chain = RunnableSequence.from([promptTemplate, model]).bind({ response_format: {type: 'json_object'} }) ``` the chain is called it inside the node through ``` javascript chain.invoke(state.messages, {}) ``` - - - Finally the node is added to the graph through the "nostream" tag as written in the [docs](https://langchain-ai.github.io/langgraphjs/how-tos/stream-tokens/?h=stream+llm#disabling-streaming) ``` javascript .addNode("User's KPI choice", RunnableLambda.from(this.userKPIChoiceNode).withConfig({ tags: ["nostream"] }), {ends: ['KPI clarification']}) ``` - - - This leads the run of the graph called through `graphAgent.streamEvents(stateToStream, streamConfig)` to this error: ``` javascript Error processing message: 400 {"error":{"message":"response_format` does not support streaming","type":"invalid_request_error"}} at APIError.generate (C:\Users\m.mendozza\Documents\GitHub\accelerator-ai\node_modules\groq-sdk\error.js:40:20) at Groq.makeStatusError (C:\Users\m.mendozza\Documents\GitHub\accelerator-ai\node_modules\groq-sdk\core.js:275:33) at Groq.makeRequest (C:\Users\m.mendozza\Documents\GitHub\accelerator-ai\node_modules\groq-sdk\core.js:322:30) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async RetryOperation._fn (C:\Users\m.mendozza\Documents\GitHub\accelerator-ai\node_modules\p-retry\index.js:50:12) ``` This is the node's metadata extracted from Langfuse ``` javascript { tags: [ 0: "seq:step:2" 1: "nostream" ] thread_id: "47b8486a-9381-4648-a31e-53db4e941fe3" langgraph_step: 3 langgraph_node: "User's KPI choice" langgraph_triggers: [ 0: "branch:Get all objectives:__self__:User's KPI choice" ] langgraph_path: [ 0: "__pregel_pull" 1: "User's KPI choice" ] langgraph_checkpoint_ns: "User's KPI choice:4e09ac84-fa33-549d-8f3d-5d7f9c4502e9" __pregel_resuming: false __pregel_task_id: "4e09ac84-fa33-549d-8f3d-5d7f9c4502e9" checkpoint_ns: "User's KPI choice:4e09ac84-fa33-549d-8f3d-5d7f9c4502e9" ls_provider: "groq" ls_model_name: "llama-3.3-70b-versatile" ls_model_type: "chat" ls_temperature: 0.02 } ```
yindo added the bug label 2026-02-15 17:17:30 -05:00
Author
Owner

@benjamincburns commented on GitHub (Apr 28, 2025):

@hiitsmax can you please confirm whether this is still an issue with latest versions of @langchain/groq and @langchain/langgraph? I recently made substantial updates to the groq package, and it may have fixed this issue.

@benjamincburns commented on GitHub (Apr 28, 2025): @hiitsmax can you please confirm whether this is still an issue with latest versions of `@langchain/groq` and `@langchain/langgraph`? I recently made substantial updates to the groq package, and it may have fixed this issue.
Author
Owner

@hiitsmax commented on GitHub (Apr 29, 2025):

@benjamincburns thanks for the answer!
Just updated @langchain/groq to 0.2.22 and @langchain/langgraph to 0.2.67 and the behaviour is the same unfortunately

Image

Do you now any other thing I can check in order to see if it's some kind of error on my side?

@hiitsmax commented on GitHub (Apr 29, 2025): @benjamincburns thanks for the answer! Just updated `@langchain/groq` to `0.2.22` and `@langchain/langgraph` to `0.2.67` and the behaviour is the same unfortunately ![Image](https://github.com/user-attachments/assets/05f994b8-2b45-4347-b27f-6bd73b99f010) Do you now any other thing I can check in order to see if it's some kind of error on my side?
Author
Owner

@danny-avila commented on GitHub (Aug 15, 2025):

I still have this issue in general. disableStreaming only works for ChatOpenAI and no other LLM classes.

@danny-avila commented on GitHub (Aug 15, 2025): I still have this issue in general. `disableStreaming` only works for ChatOpenAI and no other LLM classes.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#220