-
Notifications
You must be signed in to change notification settings - Fork 88
fix(/context): gracefully handle huge context files + ux #1331
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
base: main
Are you sure you want to change the base?
fix(/context): gracefully handle huge context files + ux #1331
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1331 +/- ##
==========================================
+ Coverage 17.92% 17.93% +0.01%
==========================================
Files 1844 1844
Lines 164489 164580 +91
Branches 144685 144776 +91
==========================================
+ Hits 29477 29520 +43
- Misses 133562 133609 +47
- Partials 1450 1451 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
9c96cc4
to
a49095c
Compare
.ok(); | ||
} | ||
for (filename, _) in dropped_files { | ||
files.retain(|(f, _)| f != &filename); |
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.
Is this correct? this looks like every context file will end up being dropped.
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.
how? we only keep the context files that are not in dropped_files. so basically storing the leftover files
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.
I just verified and looks like it does drop everything. If that's not correct, then we should have a test case that asserts this behavior is correct at least.
.await | ||
.into_fig_conversation_state() | ||
.expect("unable to construct conversation state") | ||
} | ||
|
||
/// Returns a conversation state representation which reflects the exact conversation to send | ||
/// back to the model. | ||
pub async fn backend_conversation_state(&mut self, run_hooks: bool, quiet: bool) -> BackendConversationState<'_> { | ||
pub async fn backend_conversation_state( |
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.
I'd like to avoid adding another parameter show_dropped_context_files_warning
to this func if we can, instead include it as part of BackendConversationState
and let the consumer print the message (e.g. in /usage
, and as_sendable_conversation_state
).
crates/q_cli/src/cli/chat/mod.rs
Outdated
.collect(); | ||
|
||
let dropped_files = | ||
drop_matched_context_files(&mut combined_files, CONTEXT_FILES_MAX_SIZE).ok(); |
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.
Don't really like having to duplicate drop_matched_context_files
here and in context_messages
, we should have a single method on the context manager that collects context files, and have ContextManager
instantiated with a configurable max value (by default CONTEXT_FILES_MAX_SIZE
). This way we can at least write some reasonable test cases against it.
51670be
to
caa85e5
Compare
caa85e5
to
c2e6d65
Compare
#1254
demo-context-file-exceeded-limit.mp4