Skip to content

Support tool messages in Anthropic #62

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

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

branislav-burdiliak
Copy link
Collaborator

@branislav-burdiliak branislav-burdiliak commented May 8, 2024

Extract OpenAIChatToolCompletionService trait providing just a single method -- createChatToolCompletion. Provide OpenAIAnthropicChatToolCompletionService.

Additionally, OpenAI tool choice is translated to Anthropic AI as an additional user message with encouragement to use the tool in question, namely: Use the $toolChoice tool in your response.

Extract OpenAIChatToolCompletionService trait providing just a single method -- createChatToolCompletion.
Provide OpenAIAnthropicChatToolCompletionService.

Additionally, OpenAI tool choice is translated to Anthropic AI as an additional user message with encouragement to use the tool in question, namely:
Use the $toolChoice tool in your response.
Add beta header to tool calls:
anthropic-beta: tools-2024-04-04
System prompts are not provided from settings, instead, you can supply them per createMessage call. OpenAI adapter takes all System messages and concatenates their content to get a single Anthropic system prompt.

Model Anthropic's tool use content block which can be returned as a reply to a create tool message.
Add tests for:
- deserialization of a tool_use content block
- deserialization of a create message reponse with a tool_use content block
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.

1 participant