Skip to content

Commit 7a81d4b

Browse files
remove redundant section
1 parent 0740512 commit 7a81d4b

File tree

1 file changed

+3
-69
lines changed

1 file changed

+3
-69
lines changed

python-recipes/RAG/07_user_role_based_rag.ipynb

Lines changed: 3 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@
477477
"source": [
478478
"## 3. Document Management (Using LangChain)\n",
479479
"\n",
480-
"Here, we'll use **LangChain** for document loading, chunking, and vectorizing. Then,. we’ll **store documents** in Redis as JSON. Each document will look like:\n",
480+
"Here, we'll use **LangChain** for document loading, chunking, and vectorizing. Then, we’ll **store documents** in Redis as JSON. Each document will look like:\n",
481481
"\n",
482482
"```json\n",
483483
"{\n",
@@ -492,72 +492,6 @@
492492
"```"
493493
]
494494
},
495-
{
496-
"cell_type": "markdown",
497-
"id": "0429e94c",
498-
"metadata": {
499-
"id": "0429e94c"
500-
},
501-
"source": [
502-
"### Redis doc index creation\n",
503-
"Below we use RedisVL to prepare a search index where we will load our docs."
504-
]
505-
},
506-
{
507-
"cell_type": "code",
508-
"execution_count": 9,
509-
"id": "b33c23e0",
510-
"metadata": {
511-
"id": "b33c23e0"
512-
},
513-
"outputs": [],
514-
"source": [
515-
"from redisvl.index import SearchIndex\n",
516-
"from redisvl.schema import IndexSchema\n",
517-
"\n",
518-
"\n",
519-
"schema = IndexSchema.from_dict({\n",
520-
" \"index\": {\n",
521-
" \"name\": \"docs\",\n",
522-
" \"prefix\": \"doc\",\n",
523-
" \"storage_type\": \"json\"\n",
524-
" },\n",
525-
" \"fields\": [\n",
526-
" {\n",
527-
" \"name\": \"doc_id\",\n",
528-
" \"type\": \"tag\",\n",
529-
" },\n",
530-
" {\n",
531-
" \"name\": \"chunk_id\",\n",
532-
" \"type\": \"tag\",\n",
533-
" },\n",
534-
" {\n",
535-
" \"name\": \"allowed_roles\",\n",
536-
" \"path\": \"$.allowed_roles[*]\",\n",
537-
" \"type\": \"tag\",\n",
538-
" },\n",
539-
" {\n",
540-
" \"name\": \"content\",\n",
541-
" \"type\": \"text\",\n",
542-
" },\n",
543-
" {\n",
544-
" \"name\": \"embedding\",\n",
545-
" \"type\": \"vector\",\n",
546-
" \"attrs\": {\n",
547-
" \"dims\": 768,\n",
548-
" \"distance_metric\": \"cosine\",\n",
549-
" \"algorithm\": \"flat\",\n",
550-
" \"datatype\": \"float32\"\n",
551-
" }\n",
552-
" }\n",
553-
" ]\n",
554-
"})\n",
555-
"\n",
556-
"\n",
557-
"index = SearchIndex(schema, redis_client=redis_client)\n",
558-
"index.create(overwrite=True, drop=False)"
559-
]
560-
},
561495
{
562496
"cell_type": "markdown",
563497
"id": "d3cJ5DSP5vXt",
@@ -742,7 +676,7 @@
742676
" )\n",
743677
" )\n",
744678
" \n",
745-
" return results\n"
679+
" return results"
746680
]
747681
},
748682
{
@@ -824,7 +758,7 @@
824758
" 4. Return top-K results.\n",
825759
" \"\"\"\n",
826760
" # 1. Load & validate user roles\n",
827-
" user_obj = User.get(index.client, user_id)\n",
761+
" user_obj = User.get(redis_client, user_id)\n",
828762
" if not user_obj:\n",
829763
" raise ValueError(f\"User {user_id} not found.\")\n",
830764
"\n",

0 commit comments

Comments
 (0)