removing client+namespace in favor of collection (#5610)

removing client+namespace in favor of collection for an easier
instantiation and to be similar to the typescript library

@dev2049
This commit is contained in:
Paul-Emile Brotons
2023-06-04 01:27:31 +02:00
committed by GitHub
parent ad09367a92
commit 92f218207b
3 changed files with 30 additions and 46 deletions

View File

@@ -118,15 +118,14 @@
"\n",
"db_name = \"lanchain_db\"\n",
"collection_name = \"langchain_col\"\n",
"namespace = f\"{db_name}.{collection_name}\"\n",
"collection = client[db_name][collection_name]\n",
"index_name = \"langchain_demo\"\n",
"\n",
"# insert the documents in MongoDB Atlas with their embedding\n",
"docsearch = MongoDBAtlasVectorSearch.from_documents(\n",
" docs,\n",
" embeddings,\n",
" client=client,\n",
" namespace=namespace,\n",
" collection=collection,\n",
" index_name=index_name\n",
")\n",
"\n",