validate_llm_output() — langchain Function Reference
Architecture documentation for the validate_llm_output() function in map_rerank.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 66907a22_1945_395e_6a94_37a8d00a56e2["validate_llm_output()"] ee80b7d6_d087_8cc2_13e6_51659dee89b4["MapRerankDocumentsChain"] 66907a22_1945_395e_6a94_37a8d00a56e2 -->|defined in| ee80b7d6_d087_8cc2_13e6_51659dee89b4 style 66907a22_1945_395e_6a94_37a8d00a56e2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/chains/combine_documents/map_rerank.py lines 120–142
def validate_llm_output(self) -> Self:
"""Validate that the combine chain outputs a dictionary."""
output_parser = self.llm_chain.prompt.output_parser
if not isinstance(output_parser, RegexParser):
msg = (
"Output parser of llm_chain should be a RegexParser,"
f" got {output_parser}"
)
raise ValueError(msg) # noqa: TRY004
output_keys = output_parser.output_keys
if self.rank_key not in output_keys:
msg = (
f"Got {self.rank_key} as key to rank on, but did not find "
f"it in the llm_chain output keys ({output_keys})"
)
raise ValueError(msg)
if self.answer_key not in output_keys:
msg = (
f"Got {self.answer_key} as key to return, but did not find "
f"it in the llm_chain output keys ({output_keys})"
)
raise ValueError(msg)
return self
Domain
Subdomains
Source
Frequently Asked Questions
What does validate_llm_output() do?
validate_llm_output() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/combine_documents/map_rerank.py.
Where is validate_llm_output() defined?
validate_llm_output() is defined in libs/langchain/langchain_classic/chains/combine_documents/map_rerank.py at line 120.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free