_agenerate_helper() — langchain Function Reference
Architecture documentation for the _agenerate_helper() function in llms.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD b5b0ca06_5826_6cbb_e9a3_9ad03072565c["_agenerate_helper()"] ce4aa464_3868_179e_5d99_df48bc307c5f["BaseLLM"] b5b0ca06_5826_6cbb_e9a3_9ad03072565c -->|defined in| ce4aa464_3868_179e_5d99_df48bc307c5f 99297396_752a_7590_6d2b_c4757fc5a9d8["agenerate()"] 99297396_752a_7590_6d2b_c4757fc5a9d8 -->|calls| b5b0ca06_5826_6cbb_e9a3_9ad03072565c 70d0ab8e_d34a_ffec_e962_7f1649597664["_agenerate()"] b5b0ca06_5826_6cbb_e9a3_9ad03072565c -->|calls| 70d0ab8e_d34a_ffec_e962_7f1649597664 style b5b0ca06_5826_6cbb_e9a3_9ad03072565c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/language_models/llms.py lines 1072–1113
async def _agenerate_helper(
self,
prompts: list[str],
stop: list[str] | None,
run_managers: list[AsyncCallbackManagerForLLMRun],
*,
new_arg_supported: bool,
**kwargs: Any,
) -> LLMResult:
try:
output = (
await self._agenerate(
prompts,
stop=stop,
run_manager=run_managers[0] if run_managers else None,
**kwargs,
)
if new_arg_supported
else await self._agenerate(prompts, stop=stop)
)
except BaseException as e:
await asyncio.gather(
*[
run_manager.on_llm_error(e, response=LLMResult(generations=[]))
for run_manager in run_managers
]
)
raise
flattened_outputs = output.flatten()
await asyncio.gather(
*[
run_manager.on_llm_end(flattened_output)
for run_manager, flattened_output in zip(
run_managers, flattened_outputs, strict=False
)
]
)
if run_managers:
output.run = [
RunInfo(run_id=run_manager.run_id) for run_manager in run_managers
]
return output
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does _agenerate_helper() do?
_agenerate_helper() is a function in the langchain codebase, defined in libs/core/langchain_core/language_models/llms.py.
Where is _agenerate_helper() defined?
_agenerate_helper() is defined in libs/core/langchain_core/language_models/llms.py at line 1072.
What does _agenerate_helper() call?
_agenerate_helper() calls 1 function(s): _agenerate.
What calls _agenerate_helper()?
_agenerate_helper() is called by 1 function(s): agenerate.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free