-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 ToolCall non returned when using client.exec_chat_stream #46
Comments
@jBernavaPrah Yes, that's correct. I didn't implement the stream for function calling and structured output. My reasoning is that streaming is a gimmick to appease users due to the general slowness of LLMs, and in fact, it's quite a wasteful protocol. I implemented it for the text response because this has become the default for many end-user applications. That being said, I can see a point in implementing it for function calling and structured output. And your plan seems decent. Hopefully, this shouldn't break any APIs. Let me know if this is a high priority. If the PR is relatively simple to implement and not too intrusive, then I'm okay with merging it. |
Hi @jeremychone! Thank you for your reply. I understand your point, and mine is one of those "end-user applications" where every ms matters :) To give you context: If I may add my point of view, the stream should be the first-party (if not the only one) implementation. In this way how does need the stream, have everything there, and how doesn't need it, could use some utility functions (like Anyway, I'm already working on a PR for returning the tool from the stream (for OpenAI for now). I'm hoping to push it soon. |
Hi @jeremychone I pushed to my branch the changes to at least make it work with OpenAI. Unfortunately, I needed to change some public Your revision and opinion are appreciated before I continue with also the other providers. Thanks! Jure |
@jBernavaPrah I definitely agree that GenAI should support streaming for tooling. Now, regarding whether streaming should be first-party, my opinion may differ. Here are three points:
So, in short, here is the way I would like to add streaming to genai:
There may be different valid approaches, and yours might be a reasonable one. However, for genai, I would like to take the one above for the reasons explained. Side note Btw, on an unrelated note, I might change the prompt I'm also not sure if this tool's streaming support will introduce breaking changes, but the addition should be quite limited, so it could make it to |
Bug description
Using the example c08-tooluse.rs and changing the code to use the
client.exec_chat_stream
instead ofclient.exec_chat
, does not return the actual function called, but:Adapter
No response
Model
No response
Suggested Resolution
Proposing:
InterStreamEvent::Tool(ToolCall)
enum variant and consequently everywhere is used.streamer.rs
to map the tools internally and output them only when the complete tool is created, using the variantInterStreamEvent::Tool
The text was updated successfully, but these errors were encountered: