Skip to content

Commit

Permalink
community: Cassandra Vector Store: modernize implementation (#27253)
Browse files Browse the repository at this point in the history
**Description:** 

This PR updates `CassandraGraphVectorStore` to be based off
`CassandraVectorStore`, instead of using a custom CQL implementation.
This allows users using a `CassandraVectorStore` to upgrade to a
`GraphVectorStore` without having to change their database schema or
re-embed documents.

This PR also updates the documentation of the `GraphVectorStore` base
class and contains native async implementations for the standard graph
methods: `traversal_search` and `mmr_traversal_search` in
`CassandraVectorStore`.

**Issue:** No issue number.

**Dependencies:** #27078
(already-merged)

**Lint and test**: 
- Lint and tests all pass, including existing
`CassandraGraphVectorStore` tests.
- Also added numerous additional tests based of the tests in
`langchain-astradb` which cover many more scenarios than the existing
tests for `Cassandra` and `CassandraGraphVectorStore`

** BREAKING CHANGE**

Note that this is a breaking change for existing users of
`CassandraGraphVectorStore`. They will need to wipe their database table
and restart.

However:
- The interfaces have not changed. Just the underlying storage
mechanism.
- Any one using `langchain_community.vectorstores.Cassandra` can instead
use `langchain_community.graph_vectorstores.CassandraGraphVectorStore`
and they will gain Graph capabilities without having to re-embed their
existing documents. This is the primary goal of this PR.

---------

Co-authored-by: Erick Friis <[email protected]>
  • Loading branch information
2 people authored and ccurme committed Oct 22, 2024
1 parent a376906 commit 6932960
Show file tree
Hide file tree
Showing 9 changed files with 4,058 additions and 667 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,13 @@
from langchain_community.graph_vectorstores.links import (
Link,
)
from langchain_community.graph_vectorstores.mmr_helper import MmrHelper

__all__ = [
"GraphVectorStore",
"GraphVectorStoreRetriever",
"Node",
"Link",
"CassandraGraphVectorStore",
"MmrHelper",
]
108 changes: 76 additions & 32 deletions libs/community/langchain_community/graph_vectorstores/base.py

Large diffs are not rendered by default.

Loading

0 comments on commit 6932960

Please sign in to comment.