Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
utils.py21 linesDownload Raw Back to memory
1from typing import Any2 3 4def get_prompt_input_key(inputs: dict[str, Any], memory_variables: list[str]) -> str:5    """Get the prompt input key.6 7    Args:8        inputs: Dict[str, Any]9        memory_variables: List[str]10 11    Returns:12        A prompt input key.13    """14    # "stop" is a special key that can be passed as input but is not used to15    # format the prompt.16    prompt_input_keys = list(set(inputs).difference([*memory_variables, "stop"]))17    if len(prompt_input_keys) != 1:18        msg = f"One input key expected got {prompt_input_keys}"19        raise ValueError(msg)20    return prompt_input_keys[0]21 
codekingpro/portable-devtools · Team Ai