Home / Function/ from_names_and_descriptions() — langchain Function Reference

from_names_and_descriptions() — langchain Function Reference

Architecture documentation for the from_names_and_descriptions() function in embedding_router.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  554892a5_c935_4b19_b6e9_8233d0752fe0["from_names_and_descriptions()"]
  a9ecc02f_6a92_622a_70dc_826e973e25bd["EmbeddingRouterChain"]
  554892a5_c935_4b19_b6e9_8233d0752fe0 -->|defined in| a9ecc02f_6a92_622a_70dc_826e973e25bd
  style 554892a5_c935_4b19_b6e9_8233d0752fe0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/router/embedding_router.py lines 56–73

    def from_names_and_descriptions(
        cls,
        names_and_descriptions: Sequence[tuple[str, Sequence[str]]],
        vectorstore_cls: type[VectorStore],
        embeddings: Embeddings,
        **kwargs: Any,
    ) -> EmbeddingRouterChain:
        """Convenience constructor."""
        documents = []
        for name, descriptions in names_and_descriptions:
            documents.extend(
                [
                    Document(page_content=description, metadata={"name": name})
                    for description in descriptions
                ]
            )
        vectorstore = vectorstore_cls.from_documents(documents, embeddings)
        return cls(vectorstore=vectorstore, **kwargs)

Subdomains

Frequently Asked Questions

What does from_names_and_descriptions() do?
from_names_and_descriptions() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/router/embedding_router.py.
Where is from_names_and_descriptions() defined?
from_names_and_descriptions() is defined in libs/langchain/langchain_classic/chains/router/embedding_router.py at line 56.

Analyze Your Own Codebase

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

Try Supermodel Free