Home / Function/ get_prompt_input_key() — langchain Function Reference

get_prompt_input_key() — langchain Function Reference

Architecture documentation for the get_prompt_input_key() function in utils.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  bb28165d_01f3_47a5_0495_ba138e73f52c["get_prompt_input_key()"]
  c522c181_7b18_c9c8_2219_86c8c6ad6523["utils.py"]
  bb28165d_01f3_47a5_0495_ba138e73f52c -->|defined in| c522c181_7b18_c9c8_2219_86c8c6ad6523
  style bb28165d_01f3_47a5_0495_ba138e73f52c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/memory/utils.py lines 4–20

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

Frequently Asked Questions

What does get_prompt_input_key() do?
get_prompt_input_key() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/memory/utils.py.
Where is get_prompt_input_key() defined?
get_prompt_input_key() is defined in libs/langchain/langchain_classic/memory/utils.py at line 4.

Analyze Your Own Codebase

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

Try Supermodel Free