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

FEATURE: partial tool call support for OpenAI and Anthropic #908

Merged
merged 5 commits into from
Nov 13, 2024

Conversation

SamSaffron
Copy link
Member

@SamSaffron SamSaffron commented Nov 12, 2024

Implement streaming tool call implementation for Anthropic and Open AI.

When calling:

llm.generate(..., partial_tool_calls: true) do ...

Partials may contain ToolCall instances with partial: true, These tool calls are partially populated with json partially parsed.

So for example when performing a search you may get:

ToolCall(..., {search: "hello" })
ToolCall(..., {search: "hello world" })

The library used to parse json is:

https://github.com/dgraham/json-stream

We use a fork cause we need access to the internal buffer.

This prepares internals to perform partial tool calls, but does not implement it yet.

@SamSaffron SamSaffron changed the title Anthropic implementation of partial streaming FEATURE: partial tool call support for OpenAI and Anthropic Nov 13, 2024
@SamSaffron SamSaffron marked this pull request as ready for review November 13, 2024 05:56
@SamSaffron SamSaffron merged commit 823e8ef into main Nov 13, 2024
6 checks passed
@SamSaffron SamSaffron deleted the stream_tool_params branch November 13, 2024 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants