Home / Function/ _embed_texts() — langchain Function Reference

_embed_texts() — langchain Function Reference

Architecture documentation for the _embed_texts() function in vectorstores.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  41f1bfba_8191_60b1_8221_cd496ce2557f["_embed_texts()"]
  2d095452_70a7_4606_a1b1_4650d16b5343["Qdrant"]
  41f1bfba_8191_60b1_8221_cd496ce2557f -->|defined in| 2d095452_70a7_4606_a1b1_4650d16b5343
  487bbb1f_037e_061d_cefc_2408b8b04c84["_generate_rest_batches()"]
  487bbb1f_037e_061d_cefc_2408b8b04c84 -->|calls| 41f1bfba_8191_60b1_8221_cd496ce2557f
  style 41f1bfba_8191_60b1_8221_cd496ce2557f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/qdrant/langchain_qdrant/vectorstores.py lines 2139–2166

    def _embed_texts(self, texts: Iterable[str]) -> list[list[float]]:
        """Embed search texts.

        Used to provide backward compatibility with `embedding_function` argument.

        Args:
            texts: Iterable of texts to embed.

        Returns:
            List of floats representing the texts embedding.

        """
        if self.embeddings is not None:
            embeddings = self.embeddings.embed_documents(list(texts))
            if hasattr(embeddings, "tolist"):
                embeddings = embeddings.tolist()
        elif self._embeddings_function is not None:
            embeddings = []
            for text in texts:
                embedding = self._embeddings_function(text)
                if hasattr(embeddings, "tolist"):
                    embedding = embedding.tolist()
                embeddings.append(embedding)
        else:
            msg = "Neither of embeddings or embedding_function is set"
            raise ValueError(msg)

        return embeddings

Domain

Subdomains

Frequently Asked Questions

What does _embed_texts() do?
_embed_texts() is a function in the langchain codebase, defined in libs/partners/qdrant/langchain_qdrant/vectorstores.py.
Where is _embed_texts() defined?
_embed_texts() is defined in libs/partners/qdrant/langchain_qdrant/vectorstores.py at line 2139.
What calls _embed_texts()?
_embed_texts() is called by 1 function(s): _generate_rest_batches.

Analyze Your Own Codebase

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

Try Supermodel Free