Home / Function/ _agenerate() — langchain Function Reference

_agenerate() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  70d0ab8e_d34a_ffec_e962_7f1649597664["_agenerate()"]
  ce4aa464_3868_179e_5d99_df48bc307c5f["BaseLLM"]
  70d0ab8e_d34a_ffec_e962_7f1649597664 -->|defined in| ce4aa464_3868_179e_5d99_df48bc307c5f
  b5b0ca06_5826_6cbb_e9a3_9ad03072565c["_agenerate_helper()"]
  b5b0ca06_5826_6cbb_e9a3_9ad03072565c -->|calls| 70d0ab8e_d34a_ffec_e962_7f1649597664
  ffe354d9_4df1_2cd5_e12d_ff4ee146557e["_agenerate()"]
  ffe354d9_4df1_2cd5_e12d_ff4ee146557e -->|calls| 70d0ab8e_d34a_ffec_e962_7f1649597664
  ffe354d9_4df1_2cd5_e12d_ff4ee146557e["_agenerate()"]
  70d0ab8e_d34a_ffec_e962_7f1649597664 -->|calls| ffe354d9_4df1_2cd5_e12d_ff4ee146557e
  style 70d0ab8e_d34a_ffec_e962_7f1649597664 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/language_models/llms.py lines 671–700

    async def _agenerate(
        self,
        prompts: list[str],
        stop: list[str] | None = None,
        run_manager: AsyncCallbackManagerForLLMRun | None = None,
        **kwargs: Any,
    ) -> LLMResult:
        """Run the LLM on the given prompts.

        Args:
            prompts: The prompts 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.

        Returns:
            The LLM result.
        """
        return await run_in_executor(
            None,
            self._generate,
            prompts,
            stop,
            run_manager.get_sync() if run_manager else None,
            **kwargs,
        )

Domain

Subdomains

Calls

Frequently Asked Questions

What does _agenerate() do?
_agenerate() is a function in the langchain codebase, defined in libs/core/langchain_core/language_models/llms.py.
Where is _agenerate() defined?
_agenerate() is defined in libs/core/langchain_core/language_models/llms.py at line 671.
What does _agenerate() call?
_agenerate() calls 1 function(s): _agenerate.
What calls _agenerate()?
_agenerate() is called by 2 function(s): _agenerate, _agenerate_helper.

Analyze Your Own Codebase

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

Try Supermodel Free