-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
Replace auto_tool_execution with execute_tools (just step 1) #873
Replace auto_tool_execution with execute_tools (just step 1) #873
Conversation
@state = :in_progress | ||
@state = handle_state until run_finished?(auto_tool_execution) | ||
if !execute_tools | ||
@state = :completed |
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.
This is the part that confuses me. Why are we even calling run
if we don't want to do anything?
@andreibondarev If you want to handle this issue yourself, that's totally fine. I don't want to clutter up the code.
I think maybe what's needed is to separate `handle_user_or_tool_message' into 2 methods?
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.
Why do we need to change the logic if we're merely renaming things?
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.
There's already a method called execute_tools
so it's not that simple.
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.
You can rename that private method to _execute_tools
then.
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.
For some reason, doing that I get the error below, then I get lost in the details. I'm probably missing something simple.
OpenAI HTTP Error (spotted in ruby-openai 7.1.0): {"error"=>{"message"=>"An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'. The following tool_call_ids did not have response messages: call_ZM6cJs8AMnU0JcEdFErekxlj", "type"=>"invalid_request_error", "param"=>"messages.[3].role", "code"=>nil}}
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.
Oh wait. You get that error also with the current code if you do this sequence, so it's not an issue with the rename:
a.add_message_and_run(content: "What's the weather in Boston?", auto_tool_execution: false)
a.add_message_and_run(content: "What's the weather in Chicago?", auto_tool_execution: true)
That is confusing. Wasn't there something in the README before about running tools manually? Should that sequence really cause an error?
I'll close these PRs and can do the simple rename later today or tomorrow when hopefully it will make more sense to me. LOL.
WIP
@andreibondarev Can you give this a try and see if it's the behavior you want. Then I can fix the tests.