From 80a4b69aef08dea462be945dbae17e051c536f53 Mon Sep 17 00:00:00 2001 From: "shanhaikang.shk" Date: Wed, 18 Dec 2024 17:54:25 +0800 Subject: [PATCH] fix lint error Signed-off-by: shanhaikang.shk --- .../integrations/vectorstores/oceanbase.ipynb | 34 +++++++------------ 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/docs/docs/integrations/vectorstores/oceanbase.ipynb b/docs/docs/integrations/vectorstores/oceanbase.ipynb index 2cea7a5ba2922..e4d5b782e8855 100644 --- a/docs/docs/integrations/vectorstores/oceanbase.ipynb +++ b/docs/docs/integrations/vectorstores/oceanbase.ipynb @@ -140,7 +140,7 @@ " connection_args=connection_args,\n", " vidx_metric_type=\"l2\",\n", " drop_old=True,\n", - ")\n" + ")" ] }, { @@ -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", @@ -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\"])" @@ -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}]\")" ] @@ -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}]\")" ] @@ -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\")" ] },