mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-06 13:18:12 +00:00
Fix sample in FAISS section (#7050)
This PR fixes a sample in the FAISS section in the reference docs.
This commit is contained in:
parent
be93775ebc
commit
a081e419a0
@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "683953b3",
|
"id": "683953b3",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -30,7 +29,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "38237514-b3fa-44a4-9cff-30cd6bf50073",
|
"id": "38237514-b3fa-44a4-9cff-30cd6bf50073",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -58,7 +56,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 3,
|
"execution_count": 1,
|
||||||
"id": "aac9563e",
|
"id": "aac9563e",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"tags": []
|
"tags": []
|
||||||
@ -73,7 +71,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 10,
|
"execution_count": 2,
|
||||||
"id": "a3c3999a",
|
"id": "a3c3999a",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"tags": []
|
"tags": []
|
||||||
@ -132,7 +130,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "f13473b5",
|
"id": "f13473b5",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -174,7 +171,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "f34420cf",
|
"id": "f34420cf",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -194,7 +190,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "31bda7fd",
|
"id": "31bda7fd",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -255,7 +250,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "57da60d4",
|
"id": "57da60d4",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -350,7 +344,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "f4294b96",
|
"id": "f4294b96",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -361,7 +354,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 25,
|
"execution_count": 3,
|
||||||
"id": "d5bf812c",
|
"id": "d5bf812c",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@ -396,7 +389,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "3d33c126",
|
"id": "3d33c126",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -426,7 +418,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "0be136e0",
|
"id": "0be136e0",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -456,7 +447,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "1b4ecd86",
|
"id": "1b4ecd86",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -466,7 +456,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 28,
|
"execution_count": 4,
|
||||||
"id": "1fd60fd1",
|
"id": "1fd60fd1",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@ -474,15 +464,14 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Content: foo, Metadata: {'page': 1}, Score: 5.159960813797904e-15\n",
|
"Content: foo, Metadata: {'page': 1}\n"
|
||||||
"Content: bar, Metadata: {'page': 1}, Score: 0.3131446838378906\n"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"results = db.similarity_search(\"foo\", filter=dict(page=1), k=1, fetch_k=4)\n",
|
"results = db.similarity_search(\"foo\", filter=dict(page=1), k=1, fetch_k=4)\n",
|
||||||
"for doc, score in results_with_scores:\n",
|
"for doc in results:\n",
|
||||||
" print(f\"Content: {doc.page_content}, Metadata: {doc.metadata}, Score: {score}\")"
|
" print(f\"Content: {doc.page_content}, Metadata: {doc.metadata}\")"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -502,7 +491,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.9.16"
|
"version": "3.10.9"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
Loading…
Reference in New Issue
Block a user