Home / Function/ apredict() — langchain Function Reference

apredict() — langchain Function Reference

Architecture documentation for the apredict() function in llm.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  95ce3986_2fc8_46a4_8a43_66522857e81e["apredict()"]
  ccf50fe1_4990_cf19_1e2d_25efe83f53c5["LLMChain"]
  95ce3986_2fc8_46a4_8a43_66522857e81e -->|defined in| ccf50fe1_4990_cf19_1e2d_25efe83f53c5
  26fce58f_875a_c280_ba56_6ad1f8464568["apredict_and_parse()"]
  26fce58f_875a_c280_ba56_6ad1f8464568 -->|calls| 95ce3986_2fc8_46a4_8a43_66522857e81e
  5f5923e3_49b2_3390_e650_ddc0b0cee750["predict()"]
  95ce3986_2fc8_46a4_8a43_66522857e81e -->|calls| 5f5923e3_49b2_3390_e650_ddc0b0cee750
  style 95ce3986_2fc8_46a4_8a43_66522857e81e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/llm.py lines 317–332

    async def apredict(self, callbacks: Callbacks = None, **kwargs: Any) -> str:
        """Format prompt with kwargs and pass to LLM.

        Args:
            callbacks: Callbacks to pass to LLMChain
            **kwargs: Keys to pass to prompt template.

        Returns:
            Completion from LLM.

        Example:
            ```python
            completion = llm.predict(adjective="funny")
            ```
        """
        return (await self.acall(kwargs, callbacks=callbacks))[self.output_key]

Subdomains

Calls

Frequently Asked Questions

What does apredict() do?
apredict() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/llm.py.
Where is apredict() defined?
apredict() is defined in libs/langchain/langchain_classic/chains/llm.py at line 317.
What does apredict() call?
apredict() calls 1 function(s): predict.
What calls apredict()?
apredict() is called by 1 function(s): apredict_and_parse.

Analyze Your Own Codebase

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

Try Supermodel Free