Home / Function/ aprep_outputs() — langchain Function Reference

aprep_outputs() — langchain Function Reference

Architecture documentation for the aprep_outputs() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  73fc6494_3cf5_d143_3c77_a2f6a40c55ed["aprep_outputs()"]
  f3cef70e_11b0_61c9_7ec0_7308f4b45056["Chain"]
  73fc6494_3cf5_d143_3c77_a2f6a40c55ed -->|defined in| f3cef70e_11b0_61c9_7ec0_7308f4b45056
  3d0312e3_a4c5_8ae3_1487_fac6e14b7ae4["ainvoke()"]
  3d0312e3_a4c5_8ae3_1487_fac6e14b7ae4 -->|calls| 73fc6494_3cf5_d143_3c77_a2f6a40c55ed
  e74a56f1_f5d9_1683_0e44_ce6fd51d40b8["_validate_outputs()"]
  73fc6494_3cf5_d143_3c77_a2f6a40c55ed -->|calls| e74a56f1_f5d9_1683_0e44_ce6fd51d40b8
  style 73fc6494_3cf5_d143_3c77_a2f6a40c55ed fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/base.py lines 496–519

    async def aprep_outputs(
        self,
        inputs: dict[str, str],
        outputs: dict[str, str],
        return_only_outputs: bool = False,  # noqa: FBT001,FBT002
    ) -> dict[str, str]:
        """Validate and prepare chain outputs, and save info about this run to memory.

        Args:
            inputs: Dictionary of chain inputs, including any inputs added by chain
                memory.
            outputs: Dictionary of initial chain outputs.
            return_only_outputs: Whether to only return the chain outputs. If `False`,
                inputs are also added to the final outputs.

        Returns:
            A dict of the final chain outputs.
        """
        self._validate_outputs(outputs)
        if self.memory is not None:
            await self.memory.asave_context(inputs, outputs)
        if return_only_outputs:
            return outputs
        return {**inputs, **outputs}

Subdomains

Called By

Frequently Asked Questions

What does aprep_outputs() do?
aprep_outputs() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/base.py.
Where is aprep_outputs() defined?
aprep_outputs() is defined in libs/langchain/langchain_classic/chains/base.py at line 496.
What does aprep_outputs() call?
aprep_outputs() calls 1 function(s): _validate_outputs.
What calls aprep_outputs()?
aprep_outputs() is called by 1 function(s): ainvoke.

Analyze Your Own Codebase

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

Try Supermodel Free