-
Notifications
You must be signed in to change notification settings - Fork 74
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
Add tool calling to the LLM base class, implement in OpenAI #322
base: main
Are you sure you want to change the base?
Conversation
cd47dc2
to
882915f
Compare
fc2f734
to
7f9bb39
Compare
# Convert tools to OpenAI's expected type | ||
openai_tools: List[ChatCompletionToolParam] = [] | ||
for tool in tools: | ||
openai_tools.append(cast(ChatCompletionToolParam, tool)) |
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.
Can't we create the object with ChatCompletionToolParam(**tool)
(or something similar)?
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.
These are mypy related as well.
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.
Yes I guess this is because openai_tools
is declared to be List[ChatCompletionToolParam]
but tool
is a dict. That's why I thought instantiating the ChatCompletionToolParam
could fix mypy without having to use cast
, but I don't know the model exactly so maybe it doesn't work.
**params, | ||
) | ||
|
||
message = response.choices[0].message |
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.
Not for now because this is also the case in the already existing methods, but we should probably try to reduce code duplication between the sync and async calls.
913c8be
to
b769242
Compare
Description
Type of Change
Complexity
Complexity: Medium
How Has This Been Tested?
Checklist
The following requirements should have been met (depending on the changes in the branch):