Home / Function/ _agenerate() — langchain Function Reference

_agenerate() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  7011d587_acb4_b0cd_06ad_04d2c3714e13["_agenerate()"]
  84cca705_1eaa_cf41_ae6b_9059440df4c8["FakeToolCallingModel"]
  7011d587_acb4_b0cd_06ad_04d2c3714e13 -->|defined in| 84cca705_1eaa_cf41_ae6b_9059440df4c8
  style 7011d587_acb4_b0cd_06ad_04d2c3714e13 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/tests/unit_tests/middleware/test_prompt_caching.py lines 41–51

    async def _agenerate(
        self,
        messages: list[BaseMessage],
        stop: list[str] | None = None,
        run_manager: AsyncCallbackManagerForLLMRun | None = None,
        **kwargs: Any,
    ) -> ChatResult:
        """Async top level call"""
        messages_string = "-".join([str(m.content) for m in messages])
        message = AIMessage(content=messages_string, id="0")
        return ChatResult(generations=[ChatGeneration(message=message)])

Domain

Subdomains

Frequently Asked Questions

What does _agenerate() do?
_agenerate() is a function in the langchain codebase, defined in libs/partners/anthropic/tests/unit_tests/middleware/test_prompt_caching.py.
Where is _agenerate() defined?
_agenerate() is defined in libs/partners/anthropic/tests/unit_tests/middleware/test_prompt_caching.py at line 41.

Analyze Your Own Codebase

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

Try Supermodel Free