Skip to content
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

feat: Streaming w/ Tools #117

Open
ksylvest opened this issue Feb 14, 2025 · 2 comments
Open

feat: Streaming w/ Tools #117

ksylvest opened this issue Feb 14, 2025 · 2 comments

Comments

@ksylvest
Copy link
Owner

Right now streaming + tools isn't supported. The API needs to be adjusted to support.

@artob
Copy link

artob commented Feb 22, 2025

This presumably meaning the https://sdk.vercel.ai/docs/ai-sdk-ui/stream-protocol protocol?

@ksylvest
Copy link
Owner Author

@artob I'm not sure. Currently all the LLM providers support streaming via SSE:

https://github.com/ksylvest/omniai/blob/main/lib/omniai/chat/stream.rb

The challenging bit is how tool-call messages are chunked. For example, OpenAI sends through through like this:

[{"index": 0, "id": "call_DdmO9pD3xa9XTPNJ32zg2hcA", "function": {"arguments": "", "name": "get_weather"}, "type": "function"}]
[{"index": 0, "id": null, "function": {"arguments": "{\"", "name": null}, "type": null}]
[{"index": 0, "id": null, "function": {"arguments": "location", "name": null}, "type": null}]
[{"index": 0, "id": null, "function": {"arguments": "\":\"", "name": null}, "type": null}]
[{"index": 0, "id": null, "function": {"arguments": "Paris", "name": null}, "type": null}]
[{"index": 0, "id": null, "function": {"arguments": ",", "name": null}, "type": null}]
[{"index": 0, "id": null, "function": {"arguments": " France", "name": null}, "type": null}]
[{"index": 0, "id": null, "function": {"arguments": "\"}", "name": null}, "type": null}]

I think we'd need some basic understanding that a chunk is for a tool call - then not yield it back immediately, but collect the entire tool call and perform it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants