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

Feature/agentic buffered #4231

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Feature/agentic buffered #4231

wants to merge 3 commits into from

Conversation

rkuo-danswer
Copy link
Contributor

Description

Fixes DAN-1499.
https://linear.app/danswer/issue/DAN-1499/agent-search-non-streaming-endpoints

How Has This Been Tested?

[Describe the tests you ran to verify your changes]

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

Copy link

vercel bot commented Mar 7, 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 Mar 7, 2025 8:26pm

@rkuo-danswer rkuo-danswer marked this pull request as ready for review March 7, 2025 19:55
@rkuo-danswer rkuo-danswer requested a review from a team as a code owner March 7, 2025 19:55
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

The PR introduces significant changes to enhance agent search functionality and improve code quality across the Onyx backend. Here's a summary of the key changes:

  • Added new models and methods in chat/models.py for organizing sub-questions hierarchically, including SubQuestionKey class and make_dict_by_level functionality
  • Implemented buffered agent responses in chat_backend.py with support for sub-questions, refined answers, and document tracking
  • Fixed widespread typo by renaming current_chat_accesssible_user to current_chat_accessible_user across multiple files
  • Added database connection cleanup with SqlEngine.reset_engine() in FastAPI application lifecycle
  • Introduced comprehensive agent test script with timing metrics and comparison between basic and agent-based search flows

The changes appear well-structured but the test script could benefit from improved resource management and validation.

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

Copy link
Contributor

@evan-danswer evan-danswer left a comment

Choose a reason for hiding this comment

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

LGTM with some minor edits!

level: int | None = None
level_question_num: int | None = None

@staticmethod
def make_dict_by_level(
original_dict: Mapping[tuple[int | None, int | None], "SubQuestionIdentifier"]
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm in favor of removing all the | None's and asserting that values aren't None for typing; probably better to find out that way if something breaks

Copy link
Contributor

Choose a reason for hiding this comment

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

It might be out of scope for this PR, but I'm now leaning that we should have made the fields for SubQuestionIdentifier non-Nullable and added it as an attribute instead of subclassing... oh well

def make_dict_by_level(
original_dict: Mapping[tuple[int | None, int | None], "SubQuestionIdentifier"]
) -> dict[int | None, list["SubQuestionIdentifier"]]:
"""returns a dict of level to object list (sorted by level_question_num)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can make this return a list once we purge the Nones?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there's still levels and questions per level, so i think it's better the way it is.

value2, key=lambda o: o.query_id
)
# sort the question_index dict of level
level_question_dict[key1] = OrderedDict(
Copy link
Contributor

Choose a reason for hiding this comment

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

In favor of getting rid of None's explicitly via assert and using lists

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