Fix sample in FAISS section (#7050)

This PR fixes a sample in the FAISS section in the reference docs.
pull/7072/head
Johnny Lim 1 year ago committed by GitHub
parent be93775ebc
commit a081e419a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,7 +1,6 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"id": "683953b3",
"metadata": {},
@ -30,7 +29,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "38237514-b3fa-44a4-9cff-30cd6bf50073",
"metadata": {},
@ -58,7 +56,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 1,
"id": "aac9563e",
"metadata": {
"tags": []
@ -73,7 +71,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 2,
"id": "a3c3999a",
"metadata": {
"tags": []
@ -132,7 +130,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "f13473b5",
"metadata": {},
@ -174,7 +171,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "f34420cf",
"metadata": {},
@ -194,7 +190,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "31bda7fd",
"metadata": {},
@ -255,7 +250,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "57da60d4",
"metadata": {},
@ -350,7 +344,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "f4294b96",
"metadata": {},
@ -361,7 +354,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 3,
"id": "d5bf812c",
"metadata": {},
"outputs": [
@ -396,7 +389,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "3d33c126",
"metadata": {},
@ -426,7 +418,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "0be136e0",
"metadata": {},
@ -456,7 +447,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "1b4ecd86",
"metadata": {},
@ -466,7 +456,7 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 4,
"id": "1fd60fd1",
"metadata": {},
"outputs": [
@ -474,15 +464,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Content: foo, Metadata: {'page': 1}, Score: 5.159960813797904e-15\n",
"Content: bar, Metadata: {'page': 1}, Score: 0.3131446838378906\n"
"Content: foo, Metadata: {'page': 1}\n"
]
}
],
"source": [
"results = db.similarity_search(\"foo\", filter=dict(page=1), k=1, fetch_k=4)\n",
"for doc, score in results_with_scores:\n",
" print(f\"Content: {doc.page_content}, Metadata: {doc.metadata}, Score: {score}\")"
"for doc in results:\n",
" print(f\"Content: {doc.page_content}, Metadata: {doc.metadata}\")"
]
}
],
@ -502,7 +491,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
"version": "3.10.9"
}
},
"nbformat": 4,

Loading…
Cancel
Save