Home / Function/ _get_prompt_input() — langchain Function Reference

_get_prompt_input() — langchain Function Reference

Architecture documentation for the _get_prompt_input() function in listwise_rerank.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  85b13c6a_d558_4f65_4534_6cf719589a6c["_get_prompt_input()"]
  4e632d3e_51a3_ce8f_2735_e8ab3d863e6b["listwise_rerank.py"]
  85b13c6a_d558_4f65_4534_6cf719589a6c -->|defined in| 4e632d3e_51a3_ce8f_2735_e8ab3d863e6b
  style 85b13c6a_d558_4f65_4534_6cf719589a6c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/retrievers/document_compressors/listwise_rerank.py lines 21–31

def _get_prompt_input(input_: dict) -> dict[str, Any]:
    """Return the compression chain input."""
    documents = input_["documents"]
    context = ""
    for index, doc in enumerate(documents):
        context += f"Document ID: {index}\n```{doc.page_content}```\n\n"
    document_range = "empty list"
    if len(documents) > 0:
        document_range = f"Document ID: 0, ..., Document ID: {len(documents) - 1}"
    context += f"Documents = [{document_range}]"
    return {"query": input_["query"], "context": context}

Domain

Subdomains

Frequently Asked Questions

What does _get_prompt_input() do?
_get_prompt_input() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/retrievers/document_compressors/listwise_rerank.py.
Where is _get_prompt_input() defined?
_get_prompt_input() is defined in libs/langchain/langchain_classic/retrievers/document_compressors/listwise_rerank.py at line 21.

Analyze Your Own Codebase

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

Try Supermodel Free