parse_with_prompt() — langchain Function Reference
Architecture documentation for the parse_with_prompt() function in retry.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 9c3417b9_129b_607d_2bac_a99e15523192["parse_with_prompt()"] 760525b3_dbb5_ba3a_41f5_a11b5f2770f7["RetryWithErrorOutputParser"] 9c3417b9_129b_607d_2bac_a99e15523192 -->|defined in| 760525b3_dbb5_ba3a_41f5_a11b5f2770f7 c8a39100_6a6c_a117_4c32_82d25211d598["parse_with_prompt()"] c8a39100_6a6c_a117_4c32_82d25211d598 -->|calls| 9c3417b9_129b_607d_2bac_a99e15523192 c8a39100_6a6c_a117_4c32_82d25211d598["parse_with_prompt()"] 9c3417b9_129b_607d_2bac_a99e15523192 -->|calls| c8a39100_6a6c_a117_4c32_82d25211d598 2967f287_d0ff_f0ca_65b5_bc9442772e23["parse()"] 9c3417b9_129b_607d_2bac_a99e15523192 -->|calls| 2967f287_d0ff_f0ca_65b5_bc9442772e23 style 9c3417b9_129b_607d_2bac_a99e15523192 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/output_parsers/retry.py lines 234–260
def parse_with_prompt(self, completion: str, prompt_value: PromptValue) -> T:
retries = 0
while retries <= self.max_retries:
try:
return self.parser.parse(completion)
except OutputParserException as e:
if retries == self.max_retries:
raise
retries += 1
if self.legacy and hasattr(self.retry_chain, "run"):
completion = self.retry_chain.run(
prompt=prompt_value.to_string(),
completion=completion,
error=repr(e),
)
else:
completion = self.retry_chain.invoke(
{
"completion": completion,
"prompt": prompt_value.to_string(),
"error": repr(e),
},
)
msg = "Failed to parse"
raise OutputParserException(msg)
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does parse_with_prompt() do?
parse_with_prompt() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/output_parsers/retry.py.
Where is parse_with_prompt() defined?
parse_with_prompt() is defined in libs/langchain/langchain_classic/output_parsers/retry.py at line 234.
What does parse_with_prompt() call?
parse_with_prompt() calls 2 function(s): parse, parse_with_prompt.
What calls parse_with_prompt()?
parse_with_prompt() is called by 1 function(s): parse_with_prompt.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free