aparse_with_prompt() — langchain Function Reference
Architecture documentation for the aparse_with_prompt() function in retry.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD af9365c1_7554_045e_da47_85d942fb6e5c["aparse_with_prompt()"] 056612cb_8291_0c46_ab1b_ac10284862d6["RetryOutputParser"] af9365c1_7554_045e_da47_85d942fb6e5c -->|defined in| 056612cb_8291_0c46_ab1b_ac10284862d6 95d8cdd7_ad78_0741_b125_a6ce998f7adf["aparse_with_prompt()"] 95d8cdd7_ad78_0741_b125_a6ce998f7adf -->|calls| af9365c1_7554_045e_da47_85d942fb6e5c 95d8cdd7_ad78_0741_b125_a6ce998f7adf["aparse_with_prompt()"] af9365c1_7554_045e_da47_85d942fb6e5c -->|calls| 95d8cdd7_ad78_0741_b125_a6ce998f7adf style af9365c1_7554_045e_da47_85d942fb6e5c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/output_parsers/retry.py lines 132–166
async def aparse_with_prompt(self, completion: str, prompt_value: PromptValue) -> T:
"""Parse the output of an LLM call using a wrapped parser.
Args:
completion: The chain completion to parse.
prompt_value: The prompt to use to parse the completion.
Returns:
The parsed completion.
"""
retries = 0
while retries <= self.max_retries:
try:
return await self.parser.aparse(completion)
except OutputParserException as e:
if retries == self.max_retries:
raise
retries += 1
if self.legacy and hasattr(self.retry_chain, "arun"):
completion = await self.retry_chain.arun(
prompt=prompt_value.to_string(),
completion=completion,
error=repr(e),
)
else:
completion = await self.retry_chain.ainvoke(
{
"prompt": prompt_value.to_string(),
"completion": completion,
},
)
msg = "Failed to parse"
raise OutputParserException(msg)
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does aparse_with_prompt() do?
aparse_with_prompt() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/output_parsers/retry.py.
Where is aparse_with_prompt() defined?
aparse_with_prompt() is defined in libs/langchain/langchain_classic/output_parsers/retry.py at line 132.
What does aparse_with_prompt() call?
aparse_with_prompt() calls 1 function(s): aparse_with_prompt.
What calls aparse_with_prompt()?
aparse_with_prompt() is called by 1 function(s): aparse_with_prompt.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free