Skip to main content

Cassandra

Apache Cassandra® is a NoSQL, row-oriented, highly scalable and highly available database. Starting with version 5.0, the database ships with vector search capabilities.

The integrations outlined in this page can be used with Cassandra as well as other CQL-compatible databases, i.e. those using the Cassandra Query Language protocol.

Installation and Setup

Install the following Python package:

pip install "cassio>=0.1.4"

Vector Store

from langchain_community.vectorstores import Cassandra

API Reference:

Learn more in the example notebook.

Chat message history

from langchain_community.chat_message_histories import CassandraChatMessageHistory

Learn more in the example notebook.

LLM Cache

from langchain.globals import set_llm_cache
from langchain_community.cache import CassandraCache
set_llm_cache(CassandraCache())

Learn more in the example notebook (scroll to the Cassandra section).

Semantic LLM Cache

from langchain.globals import set_llm_cache
from langchain_community.cache import CassandraSemanticCache
set_llm_cache(CassandraSemanticCache(
embedding=my_embedding,
table_name="my_store",
))

Learn more in the example notebook (scroll to the appropriate section).

Document loader

from langchain_community.document_loaders import CassandraLoader

API Reference:

Learn more in the example notebook.

Attribution statement

Apache Cassandra, Cassandra and Apache are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.


Help us out by providing feedback on this documentation page: