Python
使用 LangChain Python 与 Nucliadb 向量存储集成。
pip install -qU langchain langchain-community nuclia
from langchain_community.vectorstores.nucliadb import NucliaDB API_KEY = "YOUR_API_KEY" ndb = NucliaDB(knowledge_box="YOUR_KB_ID", local=False, api_key=API_KEY)
backend
http://localhost:8080
from langchain_community.vectorstores.nucliadb import NucliaDB ndb = NucliaDB(knowledge_box="YOUR_KB_ID", local=True, backend="http://my-local-server")
ids = ndb.add_texts(["This is a new test", "This is a second test"])
ndb.delete(ids=ids)
results = ndb.similarity_search("Who was inspired by Ada Lovelace?") print(results[0].page_content)