_process_results() — langchain Function Reference
Architecture documentation for the _process_results() function in map_rerank.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 04e51b41_5072_aa90_26eb_d0a9395e5846["_process_results()"] ee80b7d6_d087_8cc2_13e6_51659dee89b4["MapRerankDocumentsChain"] 04e51b41_5072_aa90_26eb_d0a9395e5846 -->|defined in| ee80b7d6_d087_8cc2_13e6_51659dee89b4 3ee542d4_6c5f_5591_2901_27a70f133c10["combine_docs()"] 3ee542d4_6c5f_5591_2901_27a70f133c10 -->|calls| 04e51b41_5072_aa90_26eb_d0a9395e5846 5744a8f1_eae7_a731_34d0_2d43bba6a9cc["acombine_docs()"] 5744a8f1_eae7_a731_34d0_2d43bba6a9cc -->|calls| 04e51b41_5072_aa90_26eb_d0a9395e5846 style 04e51b41_5072_aa90_26eb_d0a9395e5846 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/chains/combine_documents/map_rerank.py lines 224–241
def _process_results(
self,
docs: list[Document],
results: Sequence[str | list[str] | dict[str, str]],
) -> tuple[str, dict]:
typed_results = cast("list[dict]", results)
sorted_res = sorted(
zip(typed_results, docs, strict=False),
key=lambda x: -int(x[0][self.rank_key]),
)
output, document = sorted_res[0]
extra_info = {}
if self.metadata_keys is not None:
for key in self.metadata_keys:
extra_info[key] = document.metadata[key]
if self.return_intermediate_steps:
extra_info["intermediate_steps"] = results
return output[self.answer_key], extra_info
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _process_results() do?
_process_results() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/combine_documents/map_rerank.py.
Where is _process_results() defined?
_process_results() is defined in libs/langchain/langchain_classic/chains/combine_documents/map_rerank.py at line 224.
What calls _process_results()?
_process_results() is called by 2 function(s): acombine_docs, combine_docs.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free