Home / Function/ _get_docs() — langchain Function Reference

_get_docs() — langchain Function Reference

Architecture documentation for the _get_docs() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  35e82f85_1285_ad0d_4671_a9fd56e39900["_get_docs()"]
  b8cae909_b704_b10a_76f9_9d81abaafe39["VectorDBQA"]
  35e82f85_1285_ad0d_4671_a9fd56e39900 -->|defined in| b8cae909_b704_b10a_76f9_9d81abaafe39
  811cffbd_8a9c_6a62_d725_9323fb07755c["_get_docs()"]
  35e82f85_1285_ad0d_4671_a9fd56e39900 -->|calls| 811cffbd_8a9c_6a62_d725_9323fb07755c
  style 35e82f85_1285_ad0d_4671_a9fd56e39900 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/retrieval_qa/base.py lines 331–353

    def _get_docs(
        self,
        question: str,
        *,
        run_manager: CallbackManagerForChainRun,
    ) -> list[Document]:
        """Get docs."""
        if self.search_type == "similarity":
            docs = self.vectorstore.similarity_search(
                question,
                k=self.k,
                **self.search_kwargs,
            )
        elif self.search_type == "mmr":
            docs = self.vectorstore.max_marginal_relevance_search(
                question,
                k=self.k,
                **self.search_kwargs,
            )
        else:
            msg = f"search_type of {self.search_type} not allowed."
            raise ValueError(msg)
        return docs

Subdomains

Calls

Frequently Asked Questions

What does _get_docs() do?
_get_docs() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/retrieval_qa/base.py.
Where is _get_docs() defined?
_get_docs() is defined in libs/langchain/langchain_classic/chains/retrieval_qa/base.py at line 331.
What does _get_docs() call?
_get_docs() calls 1 function(s): _get_docs.

Analyze Your Own Codebase

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

Try Supermodel Free