langchaingo icon indicating copy to clipboard operation
langchaingo copied to clipboard

anthropic: improve handling of multipart tool responses

Open lonelycode opened this issue 1 year ago • 1 comments

fixes #1010

PR Checklist

  • [x] Read the Contributing documentation.
  • [x] Read the Code of conduct documentation.
  • [x] Name your Pull Request title clearly, concisely, and prefixed with the name of the primarily affected package you changed according to Good commit messages (such as memory: add interfaces for X, Y or util: add whizzbang helpers).
  • [x] Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • [x] Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. Fixes #123).
  • [ ] Describes the source of new concepts.
  • [ ] References existing implementations as appropriate.
  • [ ] Contains test coverage for new functions.
  • [ ] Passes all golangci-lint checks.

lonelycode avatar Sep 12 '24 21:09 lonelycode

Just wanted to note that while this (and related commits by @lonelycode) do solve the problem and give a proper tool response, I notice tool calls are not streamed. This can be extremely helpful when tool arguments are very long.

We can either include a new 'WithToolStreamingFunc' or send tool chunks into the existing streaming function with perhaps some prefix (risk of false-positive), or just update the existing function signature (breaking change, but should be fine as we are still v0.x)

bloeys avatar Nov 17 '24 15:11 bloeys