unify return types across map-reduce and refine (#442)

This commit is contained in:
Harrison Chase 2022-12-27 19:53:45 -05:00 committed by GitHub
parent 0c5d3fd894
commit ffe35c396c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -147,7 +147,8 @@ class MapReduceDocumentsChain(BaseCombineDocumentsChain, BaseModel):
result_docs, **kwargs
)
if self.return_map_steps:
extra_return_dict = {"map_steps": results}
_results = [r[self.llm_chain.output_key] for r in results]
extra_return_dict = {"map_steps": _results}
else:
extra_return_dict = {}
output, _ = self.combine_document_chain.combine_docs(result_docs, **kwargs)