Home / Function/ afrom_names_and_descriptions() — langchain Function Reference

afrom_names_and_descriptions() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/router/embedding_router.py lines 76–93

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

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free