Skip to content

dialog

langroid/prompts/dialog.py

collate_chat_history(inputs)

Collate (human, ai) pairs into a single, string Args: inputs: Returns:

Source code in langroid/prompts/dialog.py
def collate_chat_history(inputs: List[tuple[str, str]]) -> str:
    """
    Collate (human, ai) pairs into a single, string
    Args:
        inputs:
    Returns:
    """
    pairs = [
        f"""Human:{human}
        AI:{ai}
        """
        for human, ai in inputs
    ]
    return "\n".join(pairs)