mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-13 08:27:03 +00:00
cr
This commit is contained in:
parent
8c4e29240c
commit
b1644bc9ad
@ -89,7 +89,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"vector_db = TencentVectorDB(embedding_function=embeddings, connection_params=conn_params)\n",
|
||||
"vector_db = TencentVectorDB(embeddings, conn_params)\n",
|
||||
"\n",
|
||||
"vector_db.add_texts([\"Ankush went to Princeton\"])\n",
|
||||
"query = \"Where did Ankush go to college?\"\n",
|
||||
@ -114,7 +114,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.9.17"
|
||||
"version": "3.9.1"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
@ -78,7 +78,7 @@ class TencentVectorDB(VectorStore):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
embedding_function: Embeddings,
|
||||
embedding: Embeddings,
|
||||
connection_params: ConnectionParams,
|
||||
index_params: IndexParams = IndexParams(128),
|
||||
database_name: str = "LangChainDatabase",
|
||||
@ -87,7 +87,7 @@ class TencentVectorDB(VectorStore):
|
||||
):
|
||||
self.document = guard_import("tcvectordb.model.document")
|
||||
tcvectordb = guard_import("tcvectordb")
|
||||
self.embedding_func = embedding_function
|
||||
self.embedding_func = embedding
|
||||
self.index_params = index_params
|
||||
self.vdb_client = tcvectordb.VectorDBClient(
|
||||
url=connection_params.url,
|
||||
@ -193,7 +193,7 @@ class TencentVectorDB(VectorStore):
|
||||
else:
|
||||
index_params.dimension = dimension
|
||||
vector_db = cls(
|
||||
embedding_function=embedding,
|
||||
embedding=embedding,
|
||||
connection_params=connection_params,
|
||||
index_params=index_params,
|
||||
database_name=database_name,
|
||||
|
@ -83,11 +83,3 @@ def test_tencent_vector_db_no_drop() -> None:
|
||||
time.sleep(3)
|
||||
output = docsearch.similarity_search("foo", k=10)
|
||||
assert len(output) == 6
|
||||
|
||||
|
||||
# if __name__ == "__main__":
|
||||
# test_tencent_vector_db()
|
||||
# test_tencent_vector_db_with_score()
|
||||
# test_tencent_vector_db_max_marginal_relevance_search()
|
||||
# test_tencent_vector_db_add_extra()
|
||||
# test_tencent_vector_db_no_drop()
|
||||
|
Loading…
Reference in New Issue
Block a user