Home / Function/ _call_async() — langchain Function Reference

_call_async() — langchain Function Reference

Architecture documentation for the _call_async() function in chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  15591100_d8ca_92e7_4145_99a0242de9f0["_call_async()"]
  48aa29b8_65e7_522f_a445_a441eeb6baff["BaseChatModel"]
  15591100_d8ca_92e7_4145_99a0242de9f0 -->|defined in| 48aa29b8_65e7_522f_a445_a441eeb6baff
  bb15e35a_96ec_beed_4dc7_6fc3602e2d6a["agenerate()"]
  15591100_d8ca_92e7_4145_99a0242de9f0 -->|calls| bb15e35a_96ec_beed_4dc7_6fc3602e2d6a
  style 15591100_d8ca_92e7_4145_99a0242de9f0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/language_models/chat_models.py lines 1493–1507

    async def _call_async(
        self,
        messages: list[BaseMessage],
        stop: list[str] | None = None,
        callbacks: Callbacks = None,
        **kwargs: Any,
    ) -> BaseMessage:
        result = await self.agenerate(
            [messages], stop=stop, callbacks=callbacks, **kwargs
        )
        generation = result.generations[0][0]
        if isinstance(generation, ChatGeneration):
            return generation.message
        msg = "Unexpected generation type"
        raise ValueError(msg)

Domain

Subdomains

Calls

Frequently Asked Questions

What does _call_async() do?
_call_async() is a function in the langchain codebase, defined in libs/core/langchain_core/language_models/chat_models.py.
Where is _call_async() defined?
_call_async() is defined in libs/core/langchain_core/language_models/chat_models.py at line 1493.
What does _call_async() call?
_call_async() calls 1 function(s): agenerate.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free