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

Replace auto_tool_execution with execute_tools (just step 1) #873

Closed

Conversation

mattlindsey
Copy link
Contributor

@mattlindsey mattlindsey commented Nov 12, 2024

WIP

@andreibondarev Can you give this a try and see if it's the behavior you want. Then I can fix the tests.

@state = :in_progress
@state = handle_state until run_finished?(auto_tool_execution)
if !execute_tools
@state = :completed
Copy link
Contributor Author

@mattlindsey mattlindsey Nov 12, 2024

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?

Copy link
Collaborator

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?

Copy link
Contributor Author

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.

Copy link
Collaborator

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.

Copy link
Contributor Author

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}}

Copy link
Contributor Author

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.

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