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

feat(max): Include query description in formatted query result #29220

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Twixes
Copy link
Member

@Twixes Twixes commented Feb 25, 2025

Problem

The assistant root didn't have a query title associated with query results, the only context being the earlier message history. Usually this has been fine, but e.g. if the previous message was an assistant message based on docs retrieval, root's summarization was confused what the query is (e.g. with a question like "tell me about key features of PostHog trends and show me an example of such a insight", root wasn't sure that it's looking at an example insight).

Changes

With this change, we're using the query_description arg of create_and_query_insight in query executor results formatting. This is a straightforward way to give root the right context.

How did you test this code?

TODO

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR enhances the assistant's context by including query descriptions in formatted query results, improving clarity when previous messages lack sufficient context.

  • Modified QUERY_RESULTS_PROMPT in ee/hogai/query_executor/prompts.py to replace generic phrasing with specific query descriptions
  • Added logic in ee/hogai/query_executor/nodes.py to find the original tool call and extract its query description
  • Updated documentation for WorldMap visualization in multiple files to clarify it MUST be used with $geoip_country_name breakdown
  • Implemented backward search through message history in QueryExecutorNode.run() to locate the relevant tool call ID
  • Added proper type handling with Optional import for cases where tool calls might not be found

5 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +119 to +121
if tool_call.id == tool_call_id:
relevant_tool_call = tool_call
break
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider adding a break after finding the relevant tool call to exit both loops for better performance.

Copy link
Contributor

Size Change: 0 B

Total Size: 9.72 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 9.72 MB

compressed-size-action

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.

1 participant