cli(ux): Show active context length in CLI#2315
Conversation
crates/goose-cli/src/session/mod.rs
Outdated
|
|
||
| // Calculate system prompt tokens (approximate using a simpler system prompt) | ||
| // Since we can't directly access the built system prompt | ||
| let system_prompt = "You are an AI assistant."; |
There was a problem hiding this comment.
This is a hack to get it working for now, we should probably load context prompt similar to how we do it truncate.rs
crates/goose-cli/src/session/mod.rs
Outdated
| .provider() | ||
| .get_model_config() | ||
| .context_limit | ||
| .unwrap_or(32000); // Default to 32k if not specified |
There was a problem hiding this comment.
Similar to truncate.rs, perhaps there could be one place where this is exposed, but don't have that much of knowledge about the codebase yet to tell where that should be.
crates/goose/src/model.rs
Outdated
| name if name.contains("gpt-4.1") | ||
| || name.contains("gpt-4-1") | ||
| || name.contains("gpt-41") => | ||
| { | ||
| Some(1_000_000) |
There was a problem hiding this comment.
This might be just a thing for our internal proxies, let me know if that's not a good addition, can remove.
crates/goose-cli/src/session/mod.rs
Outdated
| all_tools.extend(toolshim_tools.iter().cloned()); | ||
|
|
||
| // Create a token counter using the same tokenizer as the model | ||
| let token_counter = TokenCounter::new(model_config.tokenizer_name()); |
There was a problem hiding this comment.
the token counting i think can be somewhat slow and inaccurate (the anthropic ones are proprietary and we've seen our estimates be off by as much as 30%). Instead i think we can save the current token usage from the most recent model inference? that way we know more exactly and don't spend any extra time on it during the iteration loop
|
hey @dbraduan - couple of merge conflicts to address |
|
should be good to go, @angiejones ? |
* upstream/main: Feat: Refined the documentation for Goose (block#2751) mcp(developer): add fallback on .gitignore if no .gooseignore is present (block#2661) cli(ux): Show active context length in CLI (block#2315) cli(config): Add GOOSE_CONTEXT_STRATEGY setting (block#2666) fix: new models have different messages for context length exceeded (block#2763)
* main: fix: pr comment build cli workflow (#2774) hotfix: don't always run prompt (#2773) Lifei/test workflow (#2772) chore: use hermit to install node, rust and protoc (#2766) Feat: Refined the documentation for Goose (#2751) mcp(developer): add fallback on .gitignore if no .gooseignore is present (#2661) cli(ux): Show active context length in CLI (#2315) cli(config): Add GOOSE_CONTEXT_STRATEGY setting (#2666) fix: new models have different messages for context length exceeded (#2763) fix: increase limit for direct to disk for performance (#2762) Revert "chore: use hermit in goose" (#2759) alexhancock/remove-settings-v1 (#2744) blog: Democratizing Detection Engineering at Block with Goose and Panther MCP (#2746)
* main: (82 commits) feat: lead/worker model (#2719) fix: pass ref in pr comment workflow (#2777) feat: goose web for local terminal alternative (#2718) chore: run CI on merge_group (#2786) fix: Don't break from consuming subprocess output in shell tool until both streams are done (#2771) Add retries w/ exponential backoff for databricks provider (#2764) Fix paths in google drive mcp documentation (#2775) testing windows build (#2770) docs: Add Context7 YouTube Video (#2779) cli(command): Add `export` command to CLI for markdown export of sessions (#2533) fix(copilot): gh copilot auth token conflicts w/ gh mcp env var (#2743) feat(providers): Add support for Gemini 2.5 Flash Preview and Pro Preview models (#2780) fix: pr comment build cli workflow (#2774) hotfix: don't always run prompt (#2773) Lifei/test workflow (#2772) chore: use hermit to install node, rust and protoc (#2766) Feat: Refined the documentation for Goose (#2751) mcp(developer): add fallback on .gitignore if no .gooseignore is present (#2661) cli(ux): Show active context length in CLI (#2315) cli(config): Add GOOSE_CONTEXT_STRATEGY setting (#2666) ...
Co-authored-by: Angie Jones <jones.angie@gmail.com>
Co-authored-by: Angie Jones <jones.angie@gmail.com>
Exposing # of tokens used in a last message(total_tokens = input_tokens + output_tokens) to the end user for UX improvement.
How this looks like:
