Skip to content

Conversation

evan-onyx
Copy link
Contributor

@evan-onyx evan-onyx commented Apr 10, 2025

Description

Fix issue where task prompt was included as part of the user query when selecting tool call args

How Has This Been Tested?

tested in UI, code tests coming

Backporting (check the box to trigger backport action)

Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.

  • This PR should be backported (make sure to check that the backport attempt succeeds)
  • [Optional] Override Linear Check

@evan-onyx evan-onyx requested a review from a team as a code owner April 10, 2025 00:17
Copy link

vercel bot commented Apr 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 10, 2025 0:31am

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 fixes a bug where the task prompt was mistakenly incorporated into the user query for tool call arguments in the tool response handler.

  • Modified /backend/onyx/chat/tool_handling/tool_response_handler.py to remove the erroneous re-assignment.
  • Ensures that prompt_builder.raw_user_query is used correctly in selecting tool call arguments.

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

@pablonyx pablonyx enabled auto-merge April 10, 2025 00:25
user_query = prompt_builder.raw_user_query
history = prompt_builder.raw_message_history
if isinstance(prompt_builder, AnswerPromptBuilder):
user_query = prompt_builder.get_user_message_content()
Copy link
Contributor

Choose a reason for hiding this comment

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

Could I get some context here, please? What's the point of deleting this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

get_user_message_content() adds the task prompt (a prompt piece specified during assistant/persona creation; the search assistant has one that we wrote) to the user query. This is Good during the final prompt to the LLM asking for an answer, but the function that gets tool call args for non-tool-calling LLMs expects only the raw user query to be passed in. This was actually a holdover from a previous approach to a fix in which having the task prompt attached to the user query was actually desired behavior, but a later different approach (adding system prompt to the history, actually) made that unnecessary and I forgot to remove this part 😭

@pablonyx pablonyx added this pull request to the merge queue Apr 10, 2025
Merged via the queue into main with commit 1718b8f Apr 10, 2025
10 of 12 checks passed
@pablonyx pablonyx deleted the non-tool-calling-bugfix branch April 10, 2025 01:36
tim-dim pushed a commit to GrantHive/grantgpt-dev that referenced this pull request Apr 10, 2025
* fix claude bug

* fixed tests
aronszanto pushed a commit to aronszanto/onyx that referenced this pull request Apr 26, 2025
* fix claude bug

* fixed tests
AnkitTukatek pushed a commit to TukaTek/onyx that referenced this pull request Sep 23, 2025
* fix claude bug

* fixed tests
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.

3 participants