def create_request_model(chain: Chain, prefix: str = "") -> BaseModel:
    """Create a pydantic request model for a LangChain instance.

    Args:
        chain: A LangChain instance.
        prefix: A prefix for the model name.
    """
    request_fields = {}

    for key in chain.input_keys:
        # TODO: add support for other input key types
        # based on demand
        if key == "chat_history":
            request_fields[key] = (list[tuple[str, str]], ...)
        else:
            request_fields[key] = (str, ...)

    prefix = prefix or chain.__class__.__name__

    return create_model(f"{prefix}Request", **request_fields)
Create a pydantic request model for a LangChain instance.

    Args:
        chain: A LangChain instance.
        prefix: A prefix for the model name.
    
lanarky/adapters/langchain/utils.py