-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fix conversations before they hit the LLM #3660
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
Conversation
|
|
||
| if messages.is_empty() { | ||
| issues.push("Added placeholder user message to empty conversation".to_string()); | ||
| messages.push(Message::user().with_text(PLACEHOLDER_USER_MESSAGE)); |
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 added in this method because it's the last method we call of the four from fix_conversation? Wondering if we could simply run this logic as part of that method instead
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.
the thinking is that if you have merged messages with the same role and then you've stripped any assistant messages from beginning and end, that you now have a conversation that starts with a user message and ends with one, unless we have no messages left. would you like me to call this method differently?
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 was just thinking in terms of https://en.wikipedia.org/wiki/Principle_of_least_astonishment fix_lead_trail would not also do this. I was thinking instead we'd do it as a separate method similar to the others
let (messages, empty_removed) = Self::remove_empty_messages(messages);
let (messages, tool_calling_fixed) = Self::fix_tool_calling(messages);
let (messages, messages_merged) = Self::merge_consecutive_messages(messages);
let (messages, lead_trail_fixed) = Self::fix_lead_trail(messages);
let (messages, populated_if_empty) = Self::populate_if_empty(messages);
Where populate_if_empty does just this part
if messages.is_empty() {
issues.push("Added placeholder user message to empty conversation".to_string());
messages.push(Message::user().with_text(PLACEHOLDER_USER_MESSAGE));
}
But it's not a huge difference! Just posting this to explain my thought
I think the branch has a ton of value as-is and should merge unless you prefer to also do this suggestion
|
|
||
| if messages.is_empty() { | ||
| issues.push("Added placeholder user message to empty conversation".to_string()); | ||
| messages.push(Message::user().with_text(PLACEHOLDER_USER_MESSAGE)); |
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 was just thinking in terms of https://en.wikipedia.org/wiki/Principle_of_least_astonishment fix_lead_trail would not also do this. I was thinking instead we'd do it as a separate method similar to the others
let (messages, empty_removed) = Self::remove_empty_messages(messages);
let (messages, tool_calling_fixed) = Self::fix_tool_calling(messages);
let (messages, messages_merged) = Self::merge_consecutive_messages(messages);
let (messages, lead_trail_fixed) = Self::fix_lead_trail(messages);
let (messages, populated_if_empty) = Self::populate_if_empty(messages);
Where populate_if_empty does just this part
if messages.is_empty() {
issues.push("Added placeholder user message to empty conversation".to_string());
messages.push(Message::user().with_text(PLACEHOLDER_USER_MESSAGE));
}
But it's not a huge difference! Just posting this to explain my thought
I think the branch has a ton of value as-is and should merge unless you prefer to also do this suggestion
|
yeah I like it. will make it so |
…cn/compact2-task-tracking * 'dkatz/goose-compact2' of github.com:block/goose: (22 commits) rm stray files unused fmt fix threshold autocompact splice last message fmt Fix conversations before they hit the LLM (#3660) cli: add detailed instruction for WSL users (#3496) feat: recipe runs will now prompt for missing extension secrets (#3668) fix: pricing integration tests -> trying more runs for cache and retries (#3546) Add inline python extension (#3107) fix: add maintainer, homepage and categories to DEB/RPM package config (#3096) blog: agent to agent convo (#3677) Possible to disable random thinking messages (#3304) Two VS code tutorials (#3603) small blog fixes (#3549) docs: fix installation command for YouTube Transcript MCP in servers.json (#3595) Docs for using Docker Model Runner as a local LLM provider. (#3509) Docs: VS Code Extension move to tutorials (#3601) Fix working directory when session has no messages (#3513) ...
* dkatz/goose-compact2: (22 commits) rm stray files unused fmt fix threshold autocompact splice last message fmt Fix conversations before they hit the LLM (#3660) cli: add detailed instruction for WSL users (#3496) feat: recipe runs will now prompt for missing extension secrets (#3668) fix: pricing integration tests -> trying more runs for cache and retries (#3546) Add inline python extension (#3107) fix: add maintainer, homepage and categories to DEB/RPM package config (#3096) blog: agent to agent convo (#3677) Possible to disable random thinking messages (#3304) Two VS code tutorials (#3603) small blog fixes (#3549) docs: fix installation command for YouTube Transcript MCP in servers.json (#3595) Docs for using Docker Model Runner as a local LLM provider. (#3509) Docs: VS Code Extension move to tutorials (#3601) Fix working directory when session has no messages (#3513) ...
* main: blog: streamlining detection development w/ recipes (#3689) fix: have option for cli providers to use their configured or default model (#3683) docs: new blog post and corrections to an old one on goosehints (#3657) Resolve sub recipe path relative to the parent recipe path (#3642) Speed up recipe loading from deeplinks and various fixes (#3662) fix cmd + , not opening settings (#3694) Add warning when JSON env parsing fails. (#3696) chore: refactor session naming into provider (#3678) feat (ui): File picker for scheduling recipes default to recipe dir (#3611) fix: address issue with streamable http interactions via mcp (#3693) Provider scenario tests (#3688) Fix conversations before they hit the LLM (#3660) cli: add detailed instruction for WSL users (#3496) feat: recipe runs will now prompt for missing extension secrets (#3668) fix: pricing integration tests -> trying more runs for cache and retries (#3546)
Co-authored-by: Douwe Osinga <[email protected]> Signed-off-by: Adam Tarantino <[email protected]>
try to get a conversations into shape before we send them to the LLM