utils.py — langchain Source File
Architecture documentation for utils.py, a python file in the langchain codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 632a8655_740a_9b22_2469_406896b15947["utils.py"] 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"] 632a8655_740a_9b22_2469_406896b15947 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3 style 632a8655_740a_9b22_2469_406896b15947 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from typing import Any
def get_prompt_input_key(inputs: dict[str, Any], memory_variables: list[str]) -> str:
"""Get the prompt input key.
Args:
inputs: Dict[str, Any]
memory_variables: List[str]
Returns:
A prompt input key.
"""
# "stop" is a special key that can be passed as input but is not used to
# format the prompt.
prompt_input_keys = list(set(inputs).difference([*memory_variables, "stop"]))
if len(prompt_input_keys) != 1:
msg = f"One input key expected got {prompt_input_keys}"
raise ValueError(msg)
return prompt_input_keys[0]
Domain
Subdomains
Functions
Dependencies
- typing
Source
Frequently Asked Questions
What does utils.py do?
utils.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, RunnableInterface subdomain.
What functions are defined in utils.py?
utils.py defines 1 function(s): get_prompt_input_key.
What does utils.py depend on?
utils.py imports 1 module(s): typing.
Where is utils.py in the architecture?
utils.py is located at libs/langchain/langchain_classic/memory/utils.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/langchain/langchain_classic/memory).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free