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

Added search_doc_ids to the simple api to allow for skipping search #2421

Merged
merged 3 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions backend/ee/danswer/server/query_and_chat/chat_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,22 @@ def handle_send_message_simple_with_history(
history_str=history_str,
)

if req.retrieval_options is None and req.search_doc_ids is None:
retrieval_options: RetrievalDetails | None = RetrievalDetails(
run_search=OptionalSearchSetting.ALWAYS,
real_time=False,
)
else:
retrieval_options = req.retrieval_options

full_chat_msg_info = CreateChatMessageRequest(
chat_session_id=chat_session.id,
parent_message_id=chat_message.id,
message=query,
file_descriptors=[],
prompt_id=req.prompt_id,
search_doc_ids=None,
retrieval_options=req.retrieval_options,
search_doc_ids=req.search_doc_ids,
retrieval_options=retrieval_options,
query_override=rephrased_query,
chunks_above=0,
chunks_below=0,
Expand Down
4 changes: 3 additions & 1 deletion backend/ee/danswer/server/query_and_chat/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ class BasicCreateChatMessageWithHistoryRequest(ChunkContext):
messages: list[ThreadMessage]
prompt_id: int | None
persona_id: int
retrieval_options: RetrievalDetails = Field(default_factory=RetrievalDetails)
retrieval_options: RetrievalDetails | None = None
query_override: str | None = None
skip_rerank: bool | None = None
# If search_doc_ids provided, then retrieval options are unused
search_doc_ids: list[int] | None = None


class SimpleDoc(BaseModel):
Expand Down
Loading