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

Anthropic: Fix tool calls #74

Merged
merged 1 commit into from
Jun 4, 2024
Merged

Conversation

MichaelDoyle
Copy link
Contributor

@MichaelDoyle MichaelDoyle commented Jun 4, 2024

Update anthropic sdk; tools are GA in the latest release.

Before you submit a pull request, please make sure you have read and understood the contribution guidelines and the code of conduct.

This pull request is related to:

  • A bug
  • A new feature
  • Documentation
  • Other (please specify)

I have checked the following:

  • I have read and understood the contribution guidelines and the code of conduct;
  • I have added new tests (for bug fixes/features);
  • I have added/updated the documentation (for bug fixes / features).

Description:

I've been working on testing tool calling with all of the 3P models, and ran into some issues with Anthropic. Particularly, Anthropic will combine text and tool parts together into a single message. It does this to provide chain of thought reasoning for debug purposes. It's also possible to get a batch of tool requests. However, the current plugin will turn these parts into multiple candidates.

Changes

  • Upgrade: Anthropic SDK to 0.22.0 which supports tools in GA
  • Fix: Return a single response candidate with multiple parts
  • Fix: Properly convert "stop" reasons
  • Fix: Support complex objects in tool results
  • Fix: Improve testability of anthropic response conversion
  • Cleanup: Rename choice -> event (I think choice was copied over from OpenAI)

There's some overlap with #72 wrt Schema config. We should probably merge that one first, and resolve any conflicts here.

image

Related issues:
N/A

Dabolus
Dabolus previously approved these changes Jun 4, 2024
Copy link
Collaborator

@Dabolus Dabolus left a comment

Choose a reason for hiding this comment

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

Nice, thanks for you effort and for increasing test coverage 🔥

@Dabolus
Copy link
Collaborator

Dabolus commented Jun 4, 2024

@MichaelDoyle I just merged the other one and, as you said, I see there are a couple of conflicts. Feel free to ping me once they're resolved

Update anthropic sdk; tools are GA in the latest release.
@MichaelDoyle
Copy link
Contributor Author

@Dabolus thanks - went ahead and fixed those conflicts. 😄

@Dabolus Dabolus merged commit e283a83 into TheFireCo:main Jun 4, 2024
1 check 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.

2 participants