include_callback_events=True doesn't work in stream / stream_log endpoint #90

Open
opened 2026-02-16 00:18:43 -05:00 by yindo · 5 comments
Owner

Originally created by @JayAhn2 on GitHub (Jan 8, 2024).

Originally assigned to: @eyurtsev on GitHub.

Hi!

I found that include_callback_events doesn't work in stream / stream_log.

I need to check token counts when I call stream / stream_log.

Is it intended?

Many thanks :)

Originally created by @JayAhn2 on GitHub (Jan 8, 2024). Originally assigned to: @eyurtsev on GitHub. Hi! I found that include_callback_events doesn't work in stream / stream_log. I need to check token counts when I call stream / stream_log. Is it intended? Many thanks :)
yindo added the enhancement label 2026-02-16 00:18:43 -05:00
Author
Owner

@eyurtsev commented on GitHub (Jan 8, 2024):

Haven't gotten around to implementing it yet. Are you relying on RemoteRunnable for handling the callbacks?

Would sending the callbacks at the end of the stream work for your use case?

@eyurtsev commented on GitHub (Jan 8, 2024): Haven't gotten around to implementing it yet. Are you relying on RemoteRunnable for handling the callbacks? Would sending the callbacks at the end of the stream work for your use case?
Author
Owner

@JayAhn2 commented on GitHub (Jan 8, 2024):

@eyurtsev

Yes. I need to see callback_events at the end of the stream :)

It is required because my service only uses stream_log endpoint, and need to store token counts on each request.

@JayAhn2 commented on GitHub (Jan 8, 2024): @eyurtsev Yes. I need to see callback_events at the end of the stream :) It is required because my service only uses stream_log endpoint, and need to store token counts on each request.
Author
Owner

@eyurtsev commented on GitHub (Jan 8, 2024):

it's end of stream vs. sending the callbacks in "real time" as they occur -- so they will be intermingled with event data. At the end shouldn't be too difficult to do.

End of stream shouldn't be too difficult to do, so i'll try to sequence that soonish

@eyurtsev commented on GitHub (Jan 8, 2024): it's end of stream vs. sending the callbacks in "real time" as they occur -- so they will be intermingled with event data. At the end shouldn't be too difficult to do. End of stream shouldn't be too difficult to do, so i'll try to sequence that soonish
Author
Owner

@JayAhn2 commented on GitHub (Jan 8, 2024):

@eyurtsev

IMHO, I guess real time callback isn't so meaningful, as callbacks are required for auditing the prompt and response for my case ;)

@JayAhn2 commented on GitHub (Jan 8, 2024): @eyurtsev IMHO, I guess real time callback isn't so meaningful, as callbacks are required for auditing the prompt and response for my case ;)
Author
Owner

@eyurtsev commented on GitHub (Feb 1, 2024):

Hi @JayAhn2, I haven't picked up work on this yet

Quick question -- have you confirmed that you can get token counts when streaming with the model provider that you use?

I suspect that including callback events for streaming might not actually solve your use case as you'll need to run code client side to tokenize the response and count the tokens manually (even with callbacks included)

@eyurtsev commented on GitHub (Feb 1, 2024): Hi @JayAhn2, I haven't picked up work on this yet Quick question -- have you confirmed that you can get token counts when streaming with the model provider that you use? I suspect that including callback events for streaming might not actually solve your use case as you'll need to run code client side to tokenize the response and count the tokens manually (even with callbacks included)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langserve#90