Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@gadenbuie
Copy link
Collaborator

Fixes #398
Fixes #399

@gadenbuie gadenbuie marked this pull request as ready for review April 3, 2025 18:50
@gadenbuie gadenbuie requested a review from hadley April 3, 2025 19:05
result <- stream_merge_chunks(private$provider, result, chunk)
}
turn <- value_turn(private$provider, result, has_type = !is.null(type))
turn <- private$match_tools(turn)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea here is that we match requests to the tool definitions up-front, which allows ContentToolRequest to carry the tool definition.

With this in place, we don't need to pass the tools into invoke_tools(), we can instead pass the turn directly. This could also be helpful in the display of a tool request.

(It also ensures we have paired results/requests in the very unlikely event the LLM requests a tool even if there are no tools defined.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this approach!

@gadenbuie gadenbuie requested a review from hadley April 3, 2025 20:51
Copy link
Member

@hadley hadley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like great progress. The API is really starting to come together.

result <- stream_merge_chunks(private$provider, result, chunk)
}
turn <- value_turn(private$provider, result, has_type = !is.null(type))
turn <- private$match_tools(turn)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this approach!

Copy link
Member

@hadley hadley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@gadenbuie gadenbuie merged commit 9ffe282 into tidyverse:main Apr 4, 2025
9 checks passed
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

Successfully merging this pull request may close these issues.

Augment data attached to ContentToolResult Allow tool functions to return a ContentToolResult object

3 participants