mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-09 04:50:37 +00:00
community: use NeuralDB object to initialize NeuralDBVectorStore (#17272)
**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
This commit is contained in:
parent
a51a257575
commit
9cf6661dc5
@ -12,7 +12,22 @@ from langchain_core.vectorstores import VectorStore
|
|||||||
|
|
||||||
|
|
||||||
class NeuralDBVectorStore(VectorStore):
|
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:
|
db: Any = None #: :meta private:
|
||||||
"""NeuralDB instance"""
|
"""NeuralDB instance"""
|
||||||
@ -322,7 +337,6 @@ class NeuralDBVectorStore(VectorStore):
|
|||||||
metadata={
|
metadata={
|
||||||
"id": ref.id,
|
"id": ref.id,
|
||||||
"upvote_ids": ref.upvote_ids,
|
"upvote_ids": ref.upvote_ids,
|
||||||
"text": ref.text,
|
|
||||||
"source": ref.source,
|
"source": ref.source,
|
||||||
"metadata": ref.metadata,
|
"metadata": ref.metadata,
|
||||||
"score": ref.score,
|
"score": ref.score,
|
||||||
|
Loading…
Reference in New Issue
Block a user