跳到主要内容
您可以使用本地 NucliaDB 实例或使用Nuclia Cloud 使用本地实例时,您需要一个 Nuclia Understanding API 密钥,以便您的文本能够正确地向量化和索引。您可以通过在https://nuclia.cloud创建免费帐户,然后创建 NUA 密钥来获取密钥。
pip install -qU  langchain langchain-community nuclia

与 nuclia.cloud 一起使用

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 设置为 https://: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)

以编程方式连接这些文档到 Claude、VSCode 等,通过 MCP 获取实时答案。
© . This site is unofficial and not affiliated with LangChain, Inc.