JsonKeyOutputFunctionsParser Class — langchain Architecture
Architecture documentation for the JsonKeyOutputFunctionsParser class in openai_functions.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD a3ccd18e_9d4d_5004_be28_4f7a9896b016["JsonKeyOutputFunctionsParser"] a82d17ab_c7c5_fd70_58ed_c083cfd5e7d9["JsonOutputFunctionsParser"] a3ccd18e_9d4d_5004_be28_4f7a9896b016 -->|extends| a82d17ab_c7c5_fd70_58ed_c083cfd5e7d9 d083bb96_f642_0585_b68e_6b3fea430962["openai_functions.py"] a3ccd18e_9d4d_5004_be28_4f7a9896b016 -->|defined in| d083bb96_f642_0585_b68e_6b3fea430962 179e94ea_3c48_dd3c_71c3_e665ddff1427["parse_result()"] a3ccd18e_9d4d_5004_be28_4f7a9896b016 -->|method| 179e94ea_3c48_dd3c_71c3_e665ddff1427
Relationship Graph
Source Code
libs/core/langchain_core/output_parsers/openai_functions.py lines 157–176
class JsonKeyOutputFunctionsParser(JsonOutputFunctionsParser):
"""Parse an output as the element of the JSON object."""
key_name: str
"""The name of the key to return."""
def parse_result(self, result: list[Generation], *, partial: bool = False) -> Any:
"""Parse the result of an LLM call to a JSON object.
Args:
result: The result of the LLM call.
partial: Whether to parse partial JSON objects.
Returns:
The parsed JSON object.
"""
res = super().parse_result(result, partial=partial)
if partial and res is None:
return None
return res.get(self.key_name) if partial else res[self.key_name]
Domain
Extends
Source
Frequently Asked Questions
What is the JsonKeyOutputFunctionsParser class?
JsonKeyOutputFunctionsParser is a class in the langchain codebase, defined in libs/core/langchain_core/output_parsers/openai_functions.py.
Where is JsonKeyOutputFunctionsParser defined?
JsonKeyOutputFunctionsParser is defined in libs/core/langchain_core/output_parsers/openai_functions.py at line 157.
What does JsonKeyOutputFunctionsParser extend?
JsonKeyOutputFunctionsParser extends JsonOutputFunctionsParser.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free