Skip to content

Commit 89a3061

Browse files
committed
update llamaindex example
1 parent caa4d23 commit 89a3061

File tree

2 files changed

+28
-34
lines changed

2 files changed

+28
-34
lines changed

python-recipes/RAG/01_redisvl.ipynb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,16 +167,6 @@
167167
"REDIS_URL = f\"redis://:{REDIS_PASSWORD}@{REDIS_HOST}:{REDIS_PORT}\""
168168
]
169169
},
170-
{
171-
"cell_type": "code",
172-
"execution_count": 116,
173-
"metadata": {},
174-
"outputs": [],
175-
"source": [
176-
"import redisvl\n",
177-
"assert redisvl.__version__ == '0.3.0'"
178-
]
179-
},
180170
{
181171
"cell_type": "markdown",
182172
"metadata": {},

python-recipes/RAG/03_llamaindex.ipynb

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
},
149149
{
150150
"cell_type": "code",
151-
"execution_count": 2,
151+
"execution_count": 1,
152152
"metadata": {},
153153
"outputs": [],
154154
"source": [
@@ -187,7 +187,7 @@
187187
},
188188
{
189189
"cell_type": "code",
190-
"execution_count": 3,
190+
"execution_count": 2,
191191
"metadata": {
192192
"colab": {
193193
"base_uri": "https://localhost:8080/"
@@ -200,7 +200,7 @@
200200
"name": "stdout",
201201
"output_type": "stream",
202202
"text": [
203-
"Sample doc Doc ID: dca6856a-186a-409d-b388-7c2baa7883e9\n",
203+
"Sample doc Doc ID: 67e07154-6ea0-4822-8957-ac1d212fc9ee\n",
204204
"Text: UNITED STATES SECURITIES AND EXCHANGE COMMISSION Washington,\n",
205205
"D.C. 20549 FORM 10-K (Mark One) ☒ ANNUAL REPORT PURSUANT T O SECTION\n",
206206
"13 OR 15(d) OF THE SECURITIES EXCHANGE ACT OF 1934 For the fiscal year\n",
@@ -225,7 +225,7 @@
225225
},
226226
{
227227
"cell_type": "code",
228-
"execution_count": 4,
228+
"execution_count": 3,
229229
"metadata": {},
230230
"outputs": [],
231231
"source": [
@@ -245,16 +245,13 @@
245245
},
246246
{
247247
"cell_type": "code",
248-
"execution_count": 5,
248+
"execution_count": 10,
249249
"metadata": {},
250250
"outputs": [],
251251
"source": [
252252
"from llama_index.core import StorageContext\n",
253-
"from redis import Redis\n",
254-
"\n",
255-
"redis_client = Redis.from_url(REDIS_URL)\n",
256253
"\n",
257-
"vector_store = RedisVectorStore(redis_client=redis_client, overwrite=True)\n",
254+
"vector_store = RedisVectorStore(redis_url=REDIS_URL, index_name=\"llama\", overwrite=True)\n",
258255
"\n",
259256
"storage_context = StorageContext.from_defaults(vector_store=vector_store)\n",
260257
"\n",
@@ -270,7 +267,7 @@
270267
},
271268
{
272269
"cell_type": "code",
273-
"execution_count": 6,
270+
"execution_count": 11,
274271
"metadata": {},
275272
"outputs": [],
276273
"source": [
@@ -288,30 +285,30 @@
288285
},
289286
{
290287
"cell_type": "code",
291-
"execution_count": 7,
288+
"execution_count": 12,
292289
"metadata": {},
293290
"outputs": [
294291
{
295292
"name": "stdout",
296293
"output_type": "stream",
297294
"text": [
298-
"Node ID: 83736c26-06ac-4eb3-aaa0-52757d0cd84f\n",
295+
"Node ID: b561dd17-5545-4d3a-bc4f-18cb39c7c01e\n",
299296
"Text: Table of Contents FISCAL 2023 NIKE BRAND REVENUE HIGHLIGHTS The\n",
300297
"following tables present NIKE Brand revenues disaggregated by\n",
301298
"reportable operating segment, distribution channel and major product\n",
302299
"line: FISCAL 2023 COMPARED TO FISCAL 2022 •NIKE, Inc. Revenues were\n",
303300
"$51.2 billion in fiscal 2023, which increased 10% and 16% compared to\n",
304301
"fiscal 2022 on...\n",
305-
"Score: 0.899\n",
302+
"Score: 0.900\n",
306303
"\n",
307-
"Node ID: 5b56a72c-905a-4ef8-b7fd-a0b271defdf5\n",
308-
"Text: NIKE, Inc. Revenues in FISCAL 2023 totaled $51,217 million,\n",
309-
"showing a 10% increase compared to FISCAL 2022. NIKE Brand Revenues in\n",
310-
"FISCAL 2023 were divided by category: Footwear was $33,135 million,\n",
311-
"Apparel was $13,843 million, and Equipment was $1,727 million. Total\n",
312-
"NIKE Brand Revenues in FISCAL 2023 amounted to $48,763 million.\n",
313-
"Converse Corpor...\n",
314-
"Score: 0.891\n",
304+
"Node ID: 0415f059-9258-426b-8b21-34b287b3c21b\n",
305+
"Text: Table of Contents NORTH AMERICA (Dollars in millions) FISCAL\n",
306+
"2023FISCAL 2022 % CHANGE% CHANGE EXCLUDING CURRENCY CHANGESFISCAL 2021\n",
307+
"% CHANGE% CHANGE EXCLUDING CURRENCY CHANGES Revenues by: Footwear $\n",
308+
"14,897 $ 12,228 22 % 22 %$ 11,644 5 % 5 % Apparel 5,947 5,492 8 % 9 %\n",
309+
"5,028 9 % 9 % Equipment 764 633 21 % 21 % 507 25 % 25 % TOTAL REVENUES\n",
310+
"$ 21,6...\n",
311+
"Score: 0.886\n",
315312
"\n"
316313
]
317314
}
@@ -332,7 +329,7 @@
332329
},
333330
{
334331
"cell_type": "code",
335-
"execution_count": 8,
332+
"execution_count": 13,
336333
"metadata": {},
337334
"outputs": [
338335
{
@@ -341,7 +338,7 @@
341338
"\"NIKE's revenue in fiscal 23 was $51.2 billion.\""
342339
]
343340
},
344-
"execution_count": 8,
341+
"execution_count": 13,
345342
"metadata": {},
346343
"output_type": "execute_result"
347344
}
@@ -350,6 +347,13 @@
350347
"response = query_engine.query(\"What was nike's revenue in fiscal 23?\")\n",
351348
"response.response"
352349
]
350+
},
351+
{
352+
"cell_type": "code",
353+
"execution_count": null,
354+
"metadata": {},
355+
"outputs": [],
356+
"source": []
353357
}
354358
],
355359
"metadata": {
@@ -372,7 +376,7 @@
372376
"name": "python",
373377
"nbconvert_exporter": "python",
374378
"pygments_lexer": "ipython3",
375-
"version": "3.11.9"
379+
"version": "3.9.12"
376380
},
377381
"widgets": {
378382
"application/vnd.jupyter.widget-state+json": {

0 commit comments

Comments
 (0)