Skip to content

Upgrade to redisvl 0.4.0 #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,714 changes: 157 additions & 1,557 deletions python-recipes/RAG/01_redisvl.ipynb

Large diffs are not rendered by default.

257 changes: 200 additions & 57 deletions python-recipes/RAG/02_langchain.ipynb

Large diffs are not rendered by default.

108 changes: 37 additions & 71 deletions python-recipes/RAG/03_llamaindex.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,11 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"outputs": [],
"source": [
"%pip install -q llama-index llama-index-vector-stores-redis llama-index-embeddings-cohere llama-index-embeddings-openai"
"%pip install -q llama-index \"llama-index-vector-stores-redis>=0.4.0\" llama-index-embeddings-cohere llama-index-embeddings-openai"
]
},
{
Expand Down Expand Up @@ -132,7 +124,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -171,7 +163,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
Expand All @@ -184,13 +176,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Sample doc Doc ID: c013353e-dae7-4d17-befd-9e784c8acf79\n",
"Text: UNITED STATES SECURITIES AND EXCHANGE COMMISSION Washington,\n",
"D.C. 20549 FORM 10-K (Mark One) ☒ ANNUAL REPORT PURSUANT T O SECTION\n",
"13 OR 15(d) OF THE SECURITIES EXCHANGE ACT OF 1934 For the fiscal year\n",
"ended September 24, 2022 or ☐ TRANSITION REPORT PURSUANT T O SECTION\n",
"13 OR 15(d) OF THE SECURITIES EXCHANGE ACT OF 1934 For the transition\n",
"period...\n"
"Sample doc Doc ID: b90e8ae9-7204-4e86-87ff-16cc68f9fff4\n",
"Text: 2022 COLORADO\n"
]
}
],
Expand All @@ -209,7 +196,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -229,7 +216,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -251,7 +238,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -269,30 +256,30 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Node ID: d2e6cd9c-0716-49d8-8563-407a00d05445\n",
"Text: Table of Contents FISCAL 2023 NIKE BRAND REVENUE HIGHLIGHTS The\n",
"Node ID: 023a5d47-4560-4591-ab20-37e4522863aa\n",
"Text: Table of Contents FISCAL 2023 NIKE BRAND REVENUE HIGHLIGHTSThe\n",
"following tables present NIKE Brand revenues disaggregated by\n",
"reportable operating segment, distribution channel and major product\n",
"line: FISCAL 2023 COMPARED TO FISCAL 2022 •NIKE, Inc. Revenues were\n",
"line: FISCAL 2023 COMPARED TO FISCAL 2022 • NIKE, Inc. Revenues were\n",
"$51.2 billion in fiscal 2023, which increased 10% and 16% compared to\n",
"fiscal 2022 on...\n",
"Score: 0.900\n",
"Score: 0.899\n",
"\n",
"Node ID: 28542d3b-b345-4e9e-b675-f62361ec85d9\n",
"Text: Table of Contents NORTH AMERICA (Dollars in millions) FISCAL\n",
"2023FISCAL 2022 % CHANGE% CHANGE EXCLUDING CURRENCY CHANGESFISCAL 2021\n",
"% CHANGE% CHANGE EXCLUDING CURRENCY CHANGES Revenues by: Footwear $\n",
"14,897 $ 12,228 22 % 22 %$ 11,644 5 % 5 % Apparel 5,947 5,492 8 % 9 %\n",
"5,028 9 % 9 % Equipment 764 633 21 % 21 % 507 25 % 25 % TOTAL REVENUES\n",
"$ 21,6...\n",
"Score: 0.885\n",
"Node ID: 10b3b6b1-112c-4279-a75a-d4d866c07f6b\n",
"Text: Sales through NIKE Direct Global Brand Divisions in FISCAL 2023\n",
"amounted to $21,308 million. Total NIKE Brand Wholesale Equivalent\n",
"Revenues for FISCAL 2023 were $48,763 million, with a 10% rise from\n",
"FISCAL 2022. NIKE Brand Wholesale Equivalent Revenues included sales\n",
"from Men's, Women's, and NIKE Kids' categories. Jordan Brand revenues\n",
"increased...\n",
"Score: 0.883\n",
"\n"
]
}
Expand All @@ -313,7 +300,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"metadata": {},
"outputs": [
{
Expand All @@ -322,7 +309,7 @@
"\"NIKE's revenue in fiscal 23 was $51.2 billion.\""
]
},
"execution_count": 7,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -347,7 +334,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -388,7 +375,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 11,
"metadata": {},
"outputs": [
{
Expand All @@ -397,7 +384,7 @@
"IndexInfo(name='custom_index', prefix='docs', key_separator=':', storage_type=<StorageType.HASH: 'hash'>)"
]
},
"execution_count": 9,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -408,7 +395,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 12,
"metadata": {},
"outputs": [
{
Expand All @@ -422,7 +409,7 @@
" 'vector': HNSWVectorField(name='vector', type='vector', path=None, attrs=HNSWVectorFieldAttributes(dims=1536, algorithm=<VectorIndexAlgorithm.HNSW: 'HNSW'>, datatype=<VectorDataType.FLOAT32: 'FLOAT32'>, distance_metric=<VectorDistanceMetric.COSINE: 'COSINE'>, initial_cap=None, m=16, ef_construction=200, ef_runtime=10, epsilon=0.01))}"
]
},
"execution_count": 10,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -433,28 +420,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"# from datetime import datetime\n",
"\n",
"\n",
"# def date_to_timestamp(date_string: str) -> int:\n",
"# date_format: str = \"%Y-%m-%d\"\n",
"# return int(datetime.strptime(date_string, date_format).timestamp())\n",
"\n",
"\n",
"# # iterate through documents and add new field\n",
"# for document in docs:\n",
"# document.metadata[\"updated_at\"] = date_to_timestamp(\n",
"# document.metadata[\"last_modified_date\"]\n",
"# )"
]
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -482,7 +448,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -510,23 +476,23 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Node ID: cd0c5d8f-e3b1-4cbb-aa6a-5960003cdb2d\n",
"Node ID: 013f339e-7fda-4fc7-baf0-afbb3dadf47d\n",
"Text: Table of Contents valuation. In the ordinary course of our\n",
"business, there are many transactions and calculations for which the\n",
"ultimate tax determination is uncertain. Significant judgment is\n",
"required in evaluating and estimating our tax expense, assets, and\n",
"liabilities. We are also subject to tax controversies in various\n",
"jurisdictions that can...\n",
"Score: 0.746\n",
"Score: 0.747\n",
"\n",
"Node ID: 6745f668-4c7a-43bf-a9c3-9b04e1a497f8\n",
"Node ID: ac3f2b03-0520-4a50-ba3e-a97ad0a6f643\n",
"Text: Table of Contents Included in other income (expense), net in\n",
"2021 and 2022 is a marketable equity securities valuation gain (loss)\n",
"of $11.8 billion and $(12.7) billion from our equity investment in\n",
Expand All @@ -535,7 +501,7 @@
"observable changes in ...\n",
"Score: 0.740\n",
"\n",
"Node ID: 717666fe-fea5-488b-999c-84e6d8b9a0db\n",
"Node ID: 62ef1673-dcfe-4ba0-a437-7b142cda4114\n",
"Text: Exhibit 31.1 CERTIFICATIONS I, Andrew R. Jassy, certify that: 1.\n",
"I have reviewed this Form 10-K of Amazon.com, Inc.; 2. Based on my\n",
"knowledge, this report does not contain any untrue statement of a\n",
Expand Down
Loading