Skip to content

Conversation

evan-onyx
Copy link
Contributor

@evan-onyx evan-onyx commented Mar 31, 2025

Description

Fixes https://linear.app/danswer/issue/DAN-1634/address-weird-tool-calling-behavior-with-claude-37

How Has This Been Tested?

tested in UI + tests now cover this case (ensure that system message is in task prompt)

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 March 31, 2025 02:46
Copy link

vercel bot commented Mar 31, 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 8, 2025 1:18am

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 refines tool argument construction by leveraging persona information from the prompt builder to improve both forced and automatic tool calls.

  • In backend/onyx/chat/tool_handling/tool_response_handler.py, get_tool_call_for_non_tool_calling_llm_impl now uses AnswerPromptBuilder to refine the user query.
  • In backend/onyx/chat/process_message.py, prompt assignment now defaults to the first persona prompt if final_msg.prompt is missing; ensure handling of empty or invalid persona.prompts.

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

Comment on lines +663 to +800
prompt_config = PromptConfig.from_model(
final_msg.prompt or persona.prompts[0]
)
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Ensure persona.prompts is non-empty to avoid index errors if final_msg.prompt is falsy.

Copy link
Contributor

@Weves Weves left a comment

Choose a reason for hiding this comment

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

lgtm 🍾

@Weves Weves added this pull request to the merge queue Apr 8, 2025
@Weves Weves removed this pull request from the merge queue due to a manual request Apr 8, 2025
@Weves Weves added this pull request to the merge queue Apr 8, 2025
Merged via the queue into main with commit 10f1ac5 Apr 8, 2025
11 checks passed
aronszanto pushed a commit to aronszanto/onyx that referenced this pull request Apr 26, 2025
* use persona info when creating tool args

* fixed unit test

* include system message

* fix unit test

* nit
@rkuo-danswer rkuo-danswer deleted the non-explicit-tool-call-use-persona-prompt branch May 12, 2025 22:38
AnkitTukatek pushed a commit to TukaTek/onyx that referenced this pull request Sep 23, 2025
* use persona info when creating tool args

* fixed unit test

* include system message

* fix unit test

* nit
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.

2 participants