# Astra DB

This page lists the integrations available with [Astra DB](https://docs.datastax.com/en/astra/home/astra.html) and [Apache Cassandra®](https://cassandra.apache.org/).

### Setup

Install the following Python package:

```bash
pip install "astrapy>=0.5.3"
```

## Astra DB

> DataStax [Astra DB](https://docs.datastax.com/en/astra/home/astra.html) is a serverless vector-capable database built on Cassandra and made conveniently available
> through an easy-to-use JSON API.

### Vector Store

```python
from langchain.vectorstores import AstraDB
vector_store = AstraDB(
  embedding=my_embedding,
  collection_name="my_store",
  api_endpoint="...",
  token="...",
)
```

Learn more in the [example notebook](/docs/integrations/vectorstores/astradb).


## Apache Cassandra and Astra DB through CQL

> [Cassandra](https://cassandra.apache.org/) is a NoSQL, row-oriented, highly scalable and highly available database.
> Starting with version 5.0, the database ships with [vector search capabilities](https://cassandra.apache.org/doc/trunk/cassandra/vector-search/overview.html).
> DataStax [Astra DB through CQL](https://docs.datastax.com/en/astra-serverless/docs/vector-search/quickstart.html) is a managed serverless database built on Cassandra, offering the same interface and strengths.

These databases use the CQL protocol (Cassandra Query Language).
Hence, a different set of connectors, outlined below, shall be used.

### Vector Store

```python
from langchain.vectorstores import Cassandra
vector_store = Cassandra(
  embedding=my_embedding,
  table_name="my_store",
)
```

Learn more in the [example notebook](/docs/integrations/vectorstores/astradb) (scroll down to the CQL-specific section).


### Memory

```python
from langchain.memory import CassandraChatMessageHistory
message_history = CassandraChatMessageHistory(session_id="my-session")
```

Learn more in the [example notebook](/docs/integrations/memory/cassandra_chat_message_history).


### LLM Cache

```python
from langchain.cache import CassandraCache
langchain.llm_cache = CassandraCache()
```

Learn more in the [example notebook](/docs/integrations/llms/llm_caching) (scroll to the Cassandra section).


### Semantic LLM Cache

```python
from langchain.cache import CassandraSemanticCache
cassSemanticCache = CassandraSemanticCache(
  embedding=my_embedding,
  table_name="my_store",
)
```

Learn more in the [example notebook](/docs/integrations/llms/llm_caching) (scroll to the appropriate section).
