Home / Function/ add_texts() — langchain Function Reference

add_texts() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  9128ff96_4cd0_27f4_f5dd_984a9334eb49["add_texts()"]
  2d095452_70a7_4606_a1b1_4650d16b5343["Qdrant"]
  9128ff96_4cd0_27f4_f5dd_984a9334eb49 -->|defined in| 2d095452_70a7_4606_a1b1_4650d16b5343
  28bc0529_3070_278b_cfbe_477195e650e6["from_texts()"]
  28bc0529_3070_278b_cfbe_477195e650e6 -->|calls| 9128ff96_4cd0_27f4_f5dd_984a9334eb49
  487bbb1f_037e_061d_cefc_2408b8b04c84["_generate_rest_batches()"]
  9128ff96_4cd0_27f4_f5dd_984a9334eb49 -->|calls| 487bbb1f_037e_061d_cefc_2408b8b04c84
  style 9128ff96_4cd0_27f4_f5dd_984a9334eb49 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/qdrant/langchain_qdrant/vectorstores.py lines 146–180

    def add_texts(
        self,
        texts: Iterable[str],
        metadatas: list[dict] | None = None,
        ids: Sequence[str] | None = None,
        batch_size: int = 64,
        **kwargs: Any,
    ) -> list[str]:
        """Run more texts through the embeddings and add to the `VectorStore`.

        Args:
            texts: Iterable of strings to add to the `VectorStore`.
            metadatas: Optional list of metadatas associated with the texts.
            ids:
                Optional list of ids to associate with the texts. Ids have to be
                uuid-like strings.
            batch_size:
                How many vectors upload per-request.
                Default: `64`
            **kwargs: Additional keyword arguments.

        Returns:
            List of ids from adding the texts into the `VectorStore`.

        """
        added_ids = []
        for batch_ids, points in self._generate_rest_batches(
            texts, metadatas, ids, batch_size
        ):
            self.client.upsert(
                collection_name=self.collection_name, points=points, **kwargs
            )
            added_ids.extend(batch_ids)

        return added_ids

Domain

Subdomains

Called By

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free