Home / Function/ _agenerate() — langchain Function Reference

_agenerate() — langchain Function Reference

Architecture documentation for the _agenerate() function in test_wrap_model_call.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  76f9c2cf_408e_f96a_c3ed_7090a3a6c165["_agenerate()"]
  f2e45977_af64_b3bf_b95b_e2ed76bc7f48["AsyncFailOnceThenSucceed"]
  76f9c2cf_408e_f96a_c3ed_7090a3a6c165 -->|defined in| f2e45977_af64_b3bf_b95b_e2ed76bc7f48
  a22d9207_3949_0a51_b352_3861c56117b7["test_async_retry()"]
  a22d9207_3949_0a51_b352_3861c56117b7 -->|calls| 76f9c2cf_408e_f96a_c3ed_7090a3a6c165
  style 76f9c2cf_408e_f96a_c3ed_7090a3a6c165 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call.py lines 1411–1422

            async def _agenerate(
                self,
                messages: list[BaseMessage],
                stop: list[str] | None = None,
                run_manager: AsyncCallbackManagerForLLMRun | None = None,
                **kwargs: Any,
            ) -> ChatResult:
                call_count["value"] += 1
                if call_count["value"] == 1:
                    msg = "First async call fails"
                    raise ValueError(msg)
                return await super()._agenerate(messages, **kwargs)

Domain

Subdomains

Called By

Frequently Asked Questions

What does _agenerate() do?
_agenerate() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call.py.
Where is _agenerate() defined?
_agenerate() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call.py at line 1411.
What calls _agenerate()?
_agenerate() is called by 1 function(s): test_async_retry.

Analyze Your Own Codebase

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

Try Supermodel Free