fix(metadata): Removed citation from metadata (#2507)

This pull request removes the citation metadata from the generate_answer
and generate_stream functions. The citation metadata was previously
being added to the streamed_chat_history and metadata dictionaries, but
it is no longer necessary. This change improves the efficiency and
clarity of the code.
This commit is contained in:
Stan Girard 2024-04-27 05:19:13 -07:00 committed by GitHub
parent 2be6aac02a
commit 785066f9cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -272,7 +272,6 @@ class KnowledgeBrainQA(BaseModel, QAInterface):
if citations:
citations = citations
answer = model_response["answer"].tool_calls[-1]["args"]["answer"]
metadata["citations"] = citations
else:
answer = model_response["answer"].content
sources = model_response["docs"] or []
@ -343,8 +342,6 @@ class KnowledgeBrainQA(BaseModel, QAInterface):
sources_list = generate_source(sources, self.brain_id, citations)
streamed_chat_history.metadata["citations"] = citations
# Serialize the sources list
serialized_sources_list = [source.dict() for source in sources_list]
streamed_chat_history.metadata["sources"] = serialized_sources_list