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

fix: Handle interrupt after tool response but before assistant message #374

Merged

Conversation

jsibbison-square
Copy link
Collaborator

When the interrupt came after a tool result but before the next assistant message the rewrite code would see the last message (tool result) with user role and remove it. This is the correct behavior if it was an actual user message but not for a tool result as it causes a mismatch in requests-results making the message request invalid.

This PR stops that behavior and adds a assistant message explaining the the tool calls were interrupted, what would the user like to do next.

image

let prompt_response = "We interrupted before the model replied and removed the last message.";
self.prompt.render(raw_message(prompt_response));
}
None => panic!("No content in last message"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this quit the whole agent or a child process?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything I imagine, but should never have a User message with no content, should be unreachable.

@jsibbison-square jsibbison-square merged commit cc558c2 into v1.0 Nov 29, 2024
2 checks passed
michaelneale added a commit that referenced this pull request Dec 1, 2024
* v1.0:
  [app] Fix message ordering + better UI for ToolInvocations
  fix: server state persists (#378)
  cli: review command naming and help descriptions (#347)
  fix: Handle interrupt after tool response but before assistant message (#374)
  fix: set the path when running from app (#375)
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