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

Add user prompt for context length exceeded #1109

Closed
wants to merge 1 commit into from

Conversation

jasonkneen
Copy link

@jasonkneen jasonkneen commented Feb 6, 2025

Fixes #1096

Add user prompt for further truncation or exit when context length exceeds limits.

  • Modify crates/goose-cli/src/prompt.rs to add TruncateFurther variant to InputType enum and Input struct, and add ask_user_for_truncation function to Prompt trait.
  • Modify crates/goose/src/agents/extension.rs to update ContextLimit error to include user prompt.
  • Add test cases in crates/goose/tests/providers.rs for user prompt on context length exceeded, including scenarios for further truncation and exit.

For more details, open the Copilot Workspace session.

Fixes block#1096

Add user prompt for further truncation or exit when context length exceeds limits.

* Modify `crates/goose-cli/src/prompt.rs` to add `TruncateFurther` variant to `InputType` enum and `Input` struct, and add `ask_user_for_truncation` function to `Prompt` trait.
* Modify `crates/goose/src/agents/extension.rs` to update `ContextLimit` error to include user prompt.
* Add test cases in `crates/goose/tests/providers.rs` for user prompt on context length exceeded, including scenarios for further truncation and exit.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/block/goose/issues/1096?shareId=XXXX-XXXX-XXXX-XXXX).
@@ -30,10 +31,5 @@ pub enum InputType {
AskAgain, // Ask the user for input again. Control flow command.
Message, // User sent a message
Exit, // User wants to exit the session
}

pub enum Theme {
Copy link
Collaborator

Choose a reason for hiding this comment

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

was this meant to be removed?

@michaelneale
Copy link
Collaborator

looks like not well formed or automated

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.

Instead of erroring on context length exceeded after 3 attempts, ask the user what to do
2 participants