_acall() — langchain Function Reference
Architecture documentation for the _acall() function in llms.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD a27ba324_f950_5f71_c654_3c089ef7f49a["_acall()"] b2c7d2a5_0852_93df_c3e1_828c36a88999["LLM"] a27ba324_f950_5f71_c654_3c089ef7f49a -->|defined in| b2c7d2a5_0852_93df_c3e1_828c36a88999 ffe354d9_4df1_2cd5_e12d_ff4ee146557e["_agenerate()"] ffe354d9_4df1_2cd5_e12d_ff4ee146557e -->|calls| a27ba324_f950_5f71_c654_3c089ef7f49a style a27ba324_f950_5f71_c654_3c089ef7f49a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/language_models/llms.py lines 1455–1491
async def _acall(
self,
prompt: str,
stop: list[str] | None = None,
run_manager: AsyncCallbackManagerForLLMRun | None = None,
**kwargs: Any,
) -> str:
"""Async version of the _call method.
The default implementation delegates to the synchronous _call method using
`run_in_executor`. Subclasses that need to provide a true async implementation
should override this method to reduce the overhead of using `run_in_executor`.
Args:
prompt: The prompt to generate from.
stop: Stop words to use when generating.
Model output is cut off at the first occurrence of any of these
substrings.
If stop tokens are not supported consider raising `NotImplementedError`.
run_manager: Callback manager for the run.
**kwargs: Arbitrary additional keyword arguments.
These are usually passed to the model provider API call.
Returns:
The model output as a string. SHOULD NOT include the prompt.
"""
return await run_in_executor(
None,
self._call,
prompt,
stop,
run_manager.get_sync() if run_manager else None,
**kwargs,
)
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _acall() do?
_acall() is a function in the langchain codebase, defined in libs/core/langchain_core/language_models/llms.py.
Where is _acall() defined?
_acall() is defined in libs/core/langchain_core/language_models/llms.py at line 1455.
What calls _acall()?
_acall() 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