base.py — langchain Source File
Architecture documentation for base.py, a python file in the langchain codebase. 14 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR c3ed6b51_a344_0c0c_cf56_b617f175e3d8["base.py"] 2a7f66a7_8738_3d47_375b_70fcaa6ac169["logging"] c3ed6b51_a344_0c0c_cf56_b617f175e3d8 --> 2a7f66a7_8738_3d47_375b_70fcaa6ac169 6d7cdba5_8e52_34b5_6742_57caf6500c80["math"] c3ed6b51_a344_0c0c_cf56_b617f175e3d8 --> 6d7cdba5_8e52_34b5_6742_57caf6500c80 0c635125_6987_b8b3_7ff7_d60249aecde7["warnings"] c3ed6b51_a344_0c0c_cf56_b617f175e3d8 --> 0c635125_6987_b8b3_7ff7_d60249aecde7 cccbe73e_4644_7211_4d55_e8fb133a8014["abc"] c3ed6b51_a344_0c0c_cf56_b617f175e3d8 --> cccbe73e_4644_7211_4d55_e8fb133a8014 436f77bc_653d_0edb_555c_c2679d5a59ac["itertools"] c3ed6b51_a344_0c0c_cf56_b617f175e3d8 --> 436f77bc_653d_0edb_555c_c2679d5a59ac 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"] c3ed6b51_a344_0c0c_cf56_b617f175e3d8 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3 6e58aaea_f08e_c099_3cc7_f9567bfb1ae7["pydantic"] c3ed6b51_a344_0c0c_cf56_b617f175e3d8 --> 6e58aaea_f08e_c099_3cc7_f9567bfb1ae7 91721f45_4909_e489_8c1f_084f8bd87145["typing_extensions"] c3ed6b51_a344_0c0c_cf56_b617f175e3d8 --> 91721f45_4909_e489_8c1f_084f8bd87145 c554676d_b731_47b2_a98f_c1c2d537c0aa["langchain_core.documents"] c3ed6b51_a344_0c0c_cf56_b617f175e3d8 --> c554676d_b731_47b2_a98f_c1c2d537c0aa bc46b61d_cfdf_3f6b_a9dd_ac2a328d84b3["langchain_core.embeddings"] c3ed6b51_a344_0c0c_cf56_b617f175e3d8 --> bc46b61d_cfdf_3f6b_a9dd_ac2a328d84b3 38bc5323_3713_7377_32f8_091293bea54b["langchain_core.retrievers"] c3ed6b51_a344_0c0c_cf56_b617f175e3d8 --> 38bc5323_3713_7377_32f8_091293bea54b 2971f9da_6393_a3e3_610e_ace3d35ee978["langchain_core.runnables.config"] c3ed6b51_a344_0c0c_cf56_b617f175e3d8 --> 2971f9da_6393_a3e3_610e_ace3d35ee978 cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7["collections.abc"] c3ed6b51_a344_0c0c_cf56_b617f175e3d8 --> cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7 e8ec017e_6c91_4b34_675f_2a96c5aa9be6["langchain_core.callbacks.manager"] c3ed6b51_a344_0c0c_cf56_b617f175e3d8 --> e8ec017e_6c91_4b34_675f_2a96c5aa9be6 style c3ed6b51_a344_0c0c_cf56_b617f175e3d8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""A vector store stores embedded data and performs vector search.
One of the most common ways to store and search over unstructured data is to
embed it and store the resulting embedding vectors, and then query the store
and retrieve the data that are 'most similar' to the embedded query.
"""
from __future__ import annotations
import logging
import math
import warnings
from abc import ABC, abstractmethod
from itertools import cycle
from typing import (
TYPE_CHECKING,
Any,
ClassVar,
TypeVar,
)
from pydantic import ConfigDict, Field, model_validator
from typing_extensions import Self, override
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings
from langchain_core.retrievers import BaseRetriever, LangSmithRetrieverParams
from langchain_core.runnables.config import run_in_executor
if TYPE_CHECKING:
from collections.abc import Callable, Collection, Iterable, Iterator, Sequence
from langchain_core.callbacks.manager import (
AsyncCallbackManagerForRetrieverRun,
CallbackManagerForRetrieverRun,
)
logger = logging.getLogger(__name__)
VST = TypeVar("VST", bound="VectorStore")
class VectorStore(ABC):
"""Interface for vector store."""
def add_texts(
self,
texts: Iterable[str],
metadatas: list[dict] | None = None,
*,
ids: list[str] | None = None,
**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 associated with the texts.
**kwargs: `VectorStore` specific parameters.
// ... (1052 more lines)
Domain
Subdomains
Functions
Classes
Dependencies
- abc
- collections.abc
- itertools
- langchain_core.callbacks.manager
- langchain_core.documents
- langchain_core.embeddings
- langchain_core.retrievers
- langchain_core.runnables.config
- logging
- math
- pydantic
- typing
- typing_extensions
- warnings
Source
Frequently Asked Questions
What does base.py do?
base.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, RunnableInterface subdomain.
What functions are defined in base.py?
base.py defines 1 function(s): collections.
What does base.py depend on?
base.py imports 14 module(s): abc, collections.abc, itertools, langchain_core.callbacks.manager, langchain_core.documents, langchain_core.embeddings, langchain_core.retrievers, langchain_core.runnables.config, and 6 more.
Where is base.py in the architecture?
base.py is located at libs/core/langchain_core/vectorstores/base.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/core/langchain_core/vectorstores).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free