mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-07 13:40:46 +00:00
Harrison/source docs (#1275)
Co-authored-by: Tushar Dhadiwal <tushardhadiwal@users.noreply.github.com>
This commit is contained in:
parent
9becdeaadf
commit
4b5d427421
@ -101,7 +101,7 @@ class ChatVectorDBChain(Chain, BaseModel):
|
|||||||
else:
|
else:
|
||||||
return {self.output_key: answer}
|
return {self.output_key: answer}
|
||||||
|
|
||||||
async def _acall(self, inputs: Dict[str, Any]) -> Dict[str, str]:
|
async def _acall(self, inputs: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
question = inputs["question"]
|
question = inputs["question"]
|
||||||
chat_history_str = _get_chat_history(inputs["chat_history"])
|
chat_history_str = _get_chat_history(inputs["chat_history"])
|
||||||
vectordbkwargs = inputs.get("vectordbkwargs", {})
|
vectordbkwargs = inputs.get("vectordbkwargs", {})
|
||||||
@ -119,4 +119,7 @@ class ChatVectorDBChain(Chain, BaseModel):
|
|||||||
new_inputs["question"] = new_question
|
new_inputs["question"] = new_question
|
||||||
new_inputs["chat_history"] = chat_history_str
|
new_inputs["chat_history"] = chat_history_str
|
||||||
answer, _ = await self.combine_docs_chain.acombine_docs(docs, **new_inputs)
|
answer, _ = await self.combine_docs_chain.acombine_docs(docs, **new_inputs)
|
||||||
return {self.output_key: answer}
|
if self.return_source_documents:
|
||||||
|
return {self.output_key: answer, "source_documents": docs}
|
||||||
|
else:
|
||||||
|
return {self.output_key: answer}
|
||||||
|
Loading…
Reference in New Issue
Block a user