Skip to content

Commit

Permalink
update example notebook
Browse files Browse the repository at this point in the history
Signed-off-by: shanhaikang.shk <[email protected]>
  • Loading branch information
GITHUBear committed Jan 6, 2025
1 parent 08c1552 commit 1bb3a4c
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions docs/vectorstores.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
]
},
{
"cell_type": "raw",
"cell_type": "code",
"execution_count": null,
"id": "a7b92118",
"metadata": {},
"outputs": [],
"source": [
"%docker run --name=ob433 -e MODE=mini -e OB_SERVER_IP=127.0.0.1 -p 2881:2881 -d quay.io/oceanbase/oceanbase-ce:4.3.3.1-101000012024102216"
]
Expand All @@ -47,13 +49,11 @@
]
},
{
"cell_type": "raw",
"cell_type": "code",
"execution_count": null,
"id": "64e28aa6",
"metadata": {
"vscode": {
"languageId": "raw"
}
},
"metadata": {},
"outputs": [],
"source": [
"%pip install -qU \"langchain-oceanbase\""
]
Expand Down Expand Up @@ -118,7 +118,9 @@
"outputs": [],
"source": [
"import os\n",
"\n",
"from langchain_community.embeddings import DashScopeEmbeddings\n",
"\n",
"from langchain_oceanbase.vectorstores import OceanbaseVectorStore\n",
"\n",
"DASHSCOPE_API = os.environ.get(\"DASHSCOPE_API_KEY\", \"\")\n",
Expand Down Expand Up @@ -276,9 +278,7 @@
}
],
"source": [
"results = vector_store.similarity_search(query=\"thud\",k=1,filter={\"source\":\"https://another-example.com\"})\n",
"for doc in results:\n",
" print(f\"* {doc.page_content} [{doc.metadata}]\")"
"results = vector_store.similarity_search(query=\"thud\",k=1,filter={\"source\":\"https://another-example.com\"})"
]
},
{
Expand All @@ -304,9 +304,7 @@
}
],
"source": [
"results = vector_store.similarity_search_with_score(query=\"thud\",k=1,filter={\"source\":\"https://example.com\"})\n",
"for doc, score in results:\n",
" print(f\"* [SIM={score:3f}] {doc.page_content} [{doc.metadata}]\")"
"results = vector_store.similarity_search_with_score(query=\"thud\",k=1,filter={\"source\":\"https://example.com\"})"
]
},
{
Expand Down

0 comments on commit 1bb3a4c

Please sign in to comment.