Skip to content

Commit

Permalink
community: use NeuralDB object to initialize NeuralDBVectorStore (#17272
Browse files Browse the repository at this point in the history
)

**Description:** This PR adds an `__init__` method to the
NeuralDBVectorStore class, which takes in a NeuralDB object to
instantiate the state of NeuralDBVectorStore.
**Issue:** N/A
**Dependencies:** N/A
**Twitter handle:** N/A
  • Loading branch information
kartikTAI authored Feb 22, 2024
1 parent a51a257 commit 9cf6661
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,22 @@


class NeuralDBVectorStore(VectorStore):
"""Vectorstore that uses ThirdAI's NeuralDB."""
"""Vectorstore that uses ThirdAI's NeuralDB.
To use, you should have the ``thirdai[neural_db]`` python package installed.
Example:
.. code-block:: python
from langchain_community.vectorstores import NeuralDBVectorStore
from thirdai import neural_db as ndb
db = ndb.NeuralDB()
vectorstore = NeuralDBVectorStore(db=db)
"""

def __init__(self, db):
self.db = db

db: Any = None #: :meta private:
"""NeuralDB instance"""
Expand Down Expand Up @@ -322,7 +337,6 @@ def similarity_search(
metadata={
"id": ref.id,
"upvote_ids": ref.upvote_ids,
"text": ref.text,
"source": ref.source,
"metadata": ref.metadata,
"score": ref.score,
Expand Down

0 comments on commit 9cf6661

Please sign in to comment.