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

Refactor to remove QueryRequest entity #799

Merged
merged 1 commit into from
Jan 10, 2025
Merged

Refactor to remove QueryRequest entity #799

merged 1 commit into from
Jan 10, 2025

Conversation

jamesbraza
Copy link
Collaborator

The QueryRequest entity here served a few purposes oriented around a PaperQA web service infrastructure:

  • Group query, settings, and session ID
  • Provides a way to link Docs with a given run

QueryRequest also comes with a few tradeoffs:

  • One more entity in the stack --> one more level to recurse down
  • Complicates deepcopy since QueryRequest is stateful
  • Most of the time we just need (query, settings), a session ID is irrelevant

Since this repo is really more about CLI usage and the core algorithm, we don't need this entity here, so this PR removes it.

@jamesbraza jamesbraza added the enhancement New feature or request label Jan 9, 2025
@jamesbraza jamesbraza requested review from sidnarayanan and a team January 9, 2025 20:36
@jamesbraza jamesbraza self-assigned this Jan 9, 2025
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jan 9, 2025
@jamesbraza jamesbraza force-pushed the no-query-request branch 2 times, most recently from 618e857 to 22aee3c Compare January 9, 2025 22:17
self._docs = docs
self._llm_model = llm_model
self._summary_llm_model = summary_llm_model
self._embedding_model = embedding_model
self._session_id = session_id
Copy link
Collaborator

Choose a reason for hiding this comment

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

One minor feature we lose here is that he query_request had the session id, which you could then match to a given response. So if you built out a bunch of queries you could match to answers after.

Obviously the AnswerResponse object stores both, so I don't think this would cause an issue, but I'm trying to think through any edge cases.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it's good to have less duplication of the ID within paper-qa itself. Ideally we have one source of truth

Let me know if you'd like any unit tests added

@mskarlin
Copy link
Collaborator

Also we need to make a couple minor changes to Readme I think

@jamesbraza
Copy link
Collaborator Author

Also we need to make a couple minor changes to Readme I think

Done 👌 nice catch

@jamesbraza jamesbraza requested a review from mskarlin January 10, 2025 00:35
Copy link
Collaborator

@mskarlin mskarlin left a comment

Choose a reason for hiding this comment

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

I'm irrationally worried about this change because of the potential size of the affected interfaces, but I can't think of a rational reason not to approve 😄. Thanks @jamesbraza.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 10, 2025
@jamesbraza jamesbraza merged commit ec4e486 into main Jan 10, 2025
6 checks passed
@jamesbraza jamesbraza deleted the no-query-request branch January 10, 2025 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants