langchain_community.vectorstores.astradb.AstraDB¶
class langchain_community.vectorstores.astradb.AstraDB(*, embedding: Embeddings, collection_name: str, token: Optional[str] = None, api_endpoint: Optional[str] = None, astra_db_client: Optional[Any] = None, namespace: Optional[str] = None, metric: Optional[str] = None, batch_size: Optional[int] = None, bulk_insert_batch_concurrency: Optional[int] = None, bulk_insert_overwrite_concurrency: Optional[int] = None, bulk_delete_concurrency: Optional[int] = None, pre_delete_collection: bool = False)[source]¶
Wrapper around DataStax Astra DB for vector-store workloads.
To use it, you need a recent installation of the astrapy library
and an Astra DB cloud database.
For quickstart and details, visit:docs.datastax.com/en/astra/home/astra.html
Example
      from langchain_community.vectorstores import AstraDB
      from langchain_community.embeddings.openai import OpenAIEmbeddings
      embeddings = OpenAIEmbeddings()
      vectorstore = AstraDB(
        embedding=embeddings,
        collection_name="my_store",
        token="AstraCS:...",
        api_endpoint="https://<DB-ID>-us-east1.apps.astra.datastax.com"
      )
      vectorstore.add_texts(["Giraffes", "All good here"])
      results = vectorstore.similarity_search("Everything's ok", k=1)
Constructor Args (only keyword-arguments accepted):
    embedding (Embeddings): embedding function to use.
    collection_name (str): name of the Astra DB collection to create/use.
    token (Optional[str]): API token for Astra DB usage.
    api_endpoint (Optional[str]): full URL to the API endpoint,