Default Values (#1130)

This commit is contained in:
Yuhong Sun 2024-02-24 14:01:59 -08:00 committed by GitHub
parent 0f23effe7e
commit 6d5340ae07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -120,6 +120,8 @@ def stream_answer_objects(
user_query=query_msg.message,
history_str=history_str,
)
# Given back ahead of the documents for latency reasons
# In chat flow it's given back along with the documents
yield QueryRephrase(rephrased_query=rephrased_query)
(
@ -154,6 +156,7 @@ def stream_answer_objects(
# Since this is in the one shot answer flow, we don't need to actually save the docs to DB
initial_response = QADocsResponse(
rephrased_query=rephrased_query,
top_documents=fake_saved_docs,
predicted_flow=predicted_flow,
predicted_search=predicted_search_type,

View File

@ -1,6 +1,7 @@
from typing import Any
from pydantic import BaseModel
from pydantic import Field
from pydantic import root_validator
from danswer.chat.models import DanswerContexts
@ -17,14 +18,14 @@ class QueryRephrase(BaseModel):
class ThreadMessage(BaseModel):
message: str
sender: str | None
role: MessageType
role: MessageType = MessageType.USER
class DirectQARequest(BaseModel):
messages: list[ThreadMessage]
prompt_id: int | None
persona_id: int
retrieval_options: RetrievalDetails
retrieval_options: RetrievalDetails = Field(default_factory=RetrievalDetails)
chain_of_thought: bool = False
return_contexts: bool = False