Home / Function/ aapply() — langchain Function Reference

aapply() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  6d160283_10a9_3468_0269_f458545a9fa6["aapply()"]
  ccf50fe1_4990_cf19_1e2d_25efe83f53c5["LLMChain"]
  6d160283_10a9_3468_0269_f458545a9fa6 -->|defined in| ccf50fe1_4990_cf19_1e2d_25efe83f53c5
  4aafc3e7_1717_9856_e0f1_9356acba7b7b["aapply_and_parse()"]
  4aafc3e7_1717_9856_e0f1_9356acba7b7b -->|calls| 6d160283_10a9_3468_0269_f458545a9fa6
  926fd9b4_0102_a6de_8f35_2fe1bcf91155["agenerate()"]
  6d160283_10a9_3468_0269_f458545a9fa6 -->|calls| 926fd9b4_0102_a6de_8f35_2fe1bcf91155
  18717271_ee47_6d4a_ccbd_dc7577e19985["create_outputs()"]
  6d160283_10a9_3468_0269_f458545a9fa6 -->|calls| 18717271_ee47_6d4a_ccbd_dc7577e19985
  style 6d160283_10a9_3468_0269_f458545a9fa6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/llm.py lines 249–272

    async def aapply(
        self,
        input_list: list[dict[str, Any]],
        callbacks: Callbacks = None,
    ) -> list[dict[str, str]]:
        """Utilize the LLM generate method for speed gains."""
        callback_manager = AsyncCallbackManager.configure(
            callbacks,
            self.callbacks,
            self.verbose,
        )
        run_manager = await callback_manager.on_chain_start(
            None,
            {"input_list": input_list},
            name=self.get_name(),
        )
        try:
            response = await self.agenerate(input_list, run_manager=run_manager)
        except BaseException as e:
            await run_manager.on_chain_error(e)
            raise
        outputs = self.create_outputs(response)
        await run_manager.on_chain_end({"outputs": outputs})
        return outputs

Subdomains

Called By

Frequently Asked Questions

What does aapply() do?
aapply() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/llm.py.
Where is aapply() defined?
aapply() is defined in libs/langchain/langchain_classic/chains/llm.py at line 249.
What does aapply() call?
aapply() calls 2 function(s): agenerate, create_outputs.
What calls aapply()?
aapply() is called by 1 function(s): aapply_and_parse.

Analyze Your Own Codebase

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

Try Supermodel Free