aprep_inputs() — langchain Function Reference
Architecture documentation for the aprep_inputs() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD a668f6fe_95e7_c3c9_3e60_d9c0b67fe88c["aprep_inputs()"] f3cef70e_11b0_61c9_7ec0_7308f4b45056["Chain"] a668f6fe_95e7_c3c9_3e60_d9c0b67fe88c -->|defined in| f3cef70e_11b0_61c9_7ec0_7308f4b45056 3d0312e3_a4c5_8ae3_1487_fac6e14b7ae4["ainvoke()"] 3d0312e3_a4c5_8ae3_1487_fac6e14b7ae4 -->|calls| a668f6fe_95e7_c3c9_3e60_d9c0b67fe88c 9ecc68a4_1a52_6816_7fd7_ca210db8af19["dict()"] a668f6fe_95e7_c3c9_3e60_d9c0b67fe88c -->|calls| 9ecc68a4_1a52_6816_7fd7_ca210db8af19 style a668f6fe_95e7_c3c9_3e60_d9c0b67fe88c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/chains/base.py lines 545–567
async def aprep_inputs(self, inputs: dict[str, Any] | Any) -> dict[str, str]:
"""Prepare chain inputs, including adding inputs from memory.
Args:
inputs: Dictionary of raw inputs, or single input if chain expects
only one param. Should contain all inputs specified in
`Chain.input_keys` except for inputs that will be set by the chain's
memory.
Returns:
A dictionary of all inputs, including those added by the chain's memory.
"""
if not isinstance(inputs, dict):
_input_keys = set(self.input_keys)
if self.memory is not None:
# If there are multiple input keys, but some get set by memory so that
# only one is not set, we can still figure out which key it is.
_input_keys = _input_keys.difference(self.memory.memory_variables)
inputs = {next(iter(_input_keys)): inputs}
if self.memory is not None:
external_context = await self.memory.aload_memory_variables(inputs)
inputs = dict(inputs, **external_context)
return inputs
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does aprep_inputs() do?
aprep_inputs() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/base.py.
Where is aprep_inputs() defined?
aprep_inputs() is defined in libs/langchain/langchain_classic/chains/base.py at line 545.
What does aprep_inputs() call?
aprep_inputs() calls 1 function(s): dict.
What calls aprep_inputs()?
aprep_inputs() 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