-
-
Notifications
You must be signed in to change notification settings - Fork 734
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
feat: support anthropic tools #569
Changes from 6 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,8 +31,8 @@ def reask_messages(response: ChatCompletion, mode: Mode, exception: Exception): | |
if mode == Mode.ANTHROPIC_TOOLS: | ||
# TODO: we need to include the original response | ||
yield { | ||
"role": "assistant", | ||
"content": f"Validation Errors found:\n{exception}\nRecall the function correctly, fix the errors", | ||
"role": "user", | ||
"content": f"Validation Errors found:\n{exception}\nReca ll the function correctly, fix the errors from\n{response.content}", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be better to use the following format from official documentation to indicate an error? {
"role": "user",
"content": [
{
"type": "tool_result",
"tool_use_id": "toolu_01A09q90qw90lq917835lq9",
"content": "ConnectionError: the weather service API is not available (HTTP 500)",
"is_error": true
}
]
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh this is great are you able to kick of a PR There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok I will take a look at it tomorrow |
||
} | ||
return | ||
if mode == Mode.ANTHROPIC_JSON: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import pydantic | ||
|
||
|
||
class User(pydantic.BaseModel): | ||
name: str | ||
age: int | ||
|
||
|
||
from pprint import pprint | ||
|
||
pprint( | ||
{ | ||
"name": User.model_json_schema()["title"], | ||
"description": User.__doc__, | ||
"input_schema": User.model_json_schema(), | ||
} | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small typo:
Rec all