Skip to content

Commit

Permalink
fix lint error
Browse files Browse the repository at this point in the history
Signed-off-by: shanhaikang.shk <[email protected]>
  • Loading branch information
GITHUBear committed Dec 18, 2024
1 parent 8332514 commit 80a4b69
Showing 1 changed file with 12 additions and 22 deletions.
34 changes: 12 additions & 22 deletions docs/docs/integrations/vectorstores/oceanbase.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
" connection_args=connection_args,\n",
" vidx_metric_type=\"l2\",\n",
" drop_old=True,\n",
")\n"
")"
]
},
{
Expand Down Expand Up @@ -175,20 +175,9 @@
"source": [
"from langchain_core.documents import Document\n",
"\n",
"document_1 = Document(\n",
" page_content=\"foo\",\n",
" metadata={\"source\": \"https://foo.com\"}\n",
")\n",
"\n",
"document_2 = Document(\n",
" page_content=\"bar\",\n",
" metadata={\"source\": \"https://bar.com\"}\n",
")\n",
"\n",
"document_3 = Document(\n",
" page_content=\"baz\",\n",
" metadata={\"source\": \"https://baz.com\"}\n",
")\n",
"document_1 = Document(page_content=\"foo\", metadata={\"source\": \"https://foo.com\"})\n",
"document_2 = Document(page_content=\"bar\", metadata={\"source\": \"https://bar.com\"})\n",
"document_3 = Document(page_content=\"baz\", metadata={\"source\": \"https://baz.com\"})\n",
"\n",
"documents = [document_1, document_2, document_3]\n",
"\n",
Expand Down Expand Up @@ -222,8 +211,7 @@
],
"source": [
"updated_document = Document(\n",
" page_content=\"qux\",\n",
" metadata={\"source\": \"https://another-example.com\"}\n",
" page_content=\"qux\", metadata={\"source\": \"https://another-example.com\"}\n",
")\n",
"\n",
"vector_store.add_documents(documents=[updated_document],ids=[\"1\"])"
Expand Down Expand Up @@ -276,7 +264,9 @@
}
],
"source": [
"results = vector_store.similarity_search(query=\"thud\",k=1,filter={\"source\":\"https://another-example.com\"})\n",
"results = vector_store.similarity_search(\n",
" query=\"thud\", k=1, filter={\"source\":\"https://another-example.com\"}\n",
")\n",
"for doc in results:\n",
" print(f\"* {doc.page_content} [{doc.metadata}]\")"
]
Expand Down Expand Up @@ -304,7 +294,9 @@
}
],
"source": [
"results = vector_store.similarity_search_with_score(query=\"thud\",k=1,filter={\"source\":\"https://example.com\"})\n",
"results = vector_store.similarity_search_with_score(\n",
" query=\"thud\", k=1, filter={\"source\":\"https://example.com\"}\n",
")\n",
"for doc, score in results:\n",
" print(f\"* [SIM={score:3f}] {doc.page_content} [{doc.metadata}]\")"
]
Expand Down Expand Up @@ -337,9 +329,7 @@
}
],
"source": [
"retriever = vector_store.as_retriever(\n",
" search_kwargs={\"k\": 1}\n",
")\n",
"retriever = vector_store.as_retriever(search_kwargs={\"k\": 1})\n",
"retriever.invoke(\"thud\")"
]
},
Expand Down

0 comments on commit 80a4b69

Please sign in to comment.