Skip to content
Open
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
81 changes: 36 additions & 45 deletions 01-intro/rag-intro.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
"--2024-06-06 12:12:51-- https://raw.githubusercontent.com/alexeygrigorev/minsearch/main/minsearch.py\n",
"Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.111.133, 185.199.110.133, 185.199.108.133, ...\n",
"Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.111.133|:443... connected.\n",
"HTTP request sent, awaiting response... 200 OK\n",
"Length: 3832 (3.7K) [text/plain]\n",
"Saving to: ‘minsearch.py’\n",
"\n",
"minsearch.py 100%[===================>] 3.74K --.-KB/s in 0s \n",
"\n",
"2024-06-06 12:12:51 (32.2 MB/s) - ‘minsearch.py’ saved [3832/3832]\n",
"\n"
"\u001b7\u001b[1A\u001b[1G\u001b[27G[Files: 0 Bytes: 0 [0 B/s] Re]\u001b8\u001b7\u001b[2A\u001b[1G\u001b[27G[https://raw.githubusercontent.]\u001b8\u001b7\u001b[1A\u001b[1G\u001b[27G[Files: 0 Bytes: 0 [0 B/s] Re]\u001b8\u001b7\u001b[1S\u001b[3A\u001b[1G\u001b[0JSaving 'minsearch.py'\n",
"\u001b8\u001b7\u001b[2A\u001b[1Gminsearch.py 100% [=============================>] 1.17K --.-KB/s\u001b8\u001b7\u001b[1S\u001b[3A\u001b[1G\u001b[0JHTTP response 200 [https://raw.githubusercontent.com/alexeygrigorev/minsearch/main/minsearch.py]\n",
"\u001b8\u001b7\u001b[2A\u001b[1Gminsearch.py 100% [=============================>] 1.17K --.-KB/s\u001b8\u001b7\u001b[1A\u001b[1G\u001b[27G[Files: 1 Bytes: 1.17K [1000 B]\u001b8\u001b[m\u001b[m\u001b[m\u001b[m"
]
}
],
Expand All @@ -30,7 +24,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"id": "63b0fd25-41a2-48ad-b9bf-3f1265308bd4",
"metadata": {},
"outputs": [],
Expand All @@ -40,7 +34,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"id": "9b37cce2-ed84-408b-9106-d61360aa82c9",
"metadata": {},
"outputs": [],
Expand All @@ -50,7 +44,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"id": "5bdaf6ce-2540-494f-989c-5b94b1b6626c",
"metadata": {},
"outputs": [],
Expand All @@ -61,7 +55,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"id": "42b9b1f9-3c90-42b0-beb4-cb419f9cdcea",
"metadata": {},
"outputs": [],
Expand All @@ -76,7 +70,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"id": "57de60e5-b96c-499c-a7cf-0f30fc33b324",
"metadata": {},
"outputs": [
Expand All @@ -89,7 +83,7 @@
" 'course': 'data-engineering-zoomcamp'}"
]
},
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -100,7 +94,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"id": "c499838b-73b3-44be-8ba6-f46d3693aa59",
"metadata": {},
"outputs": [],
Expand All @@ -121,7 +115,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"id": "a8d8ea88-7412-49c1-8a8e-44d0d0862a17",
"metadata": {},
"outputs": [],
Expand All @@ -131,17 +125,17 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"id": "ce7d0d18-5c07-4010-9f90-bbd021f110c8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<minsearch.Index at 0x7d0d016b8760>"
"<minsearch.Index at 0x7fa9066053a0>"
]
},
"execution_count": 8,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -152,7 +146,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"id": "aa755a08-b98d-4e92-8994-04e6108499d9",
"metadata": {},
"outputs": [],
Expand All @@ -162,7 +156,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 11,
"id": "ef8e9cdc-dfd4-4e54-a332-4b9bde4e6047",
"metadata": {},
"outputs": [],
Expand All @@ -172,17 +166,17 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 12,
"id": "e7da9664-ecb3-4d89-87da-9b2b942444d0",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\"It's not uncommon for courses to accept enrollments even after they have started, but policies can vary widely depending on the institution or provider offering the course. Here are a few steps you can take to find out if you can still enroll:\\n\\n1. **Check the Course Platform**: If the course is offered online, visit the course's webpage for information about late enrollment policies.\\n\\n2. **Contact the Instructor**: Reach out to the course instructor or lead facilitator. They may be willing to make an exception or provide you with the necessary information.\\n\\n3. **Reach Out to Administrative Offices**: Contact the academic or administrative office responsible for course enrollments. This might be the registrar's office, student services, or a similar department.\\n\\n4. **Review Deadlines and Policies**: Look for any publicly available documentation outlining the deadlines and policies regarding late enrollments.\\n\\n5. **Consider Catching Up**: Be prepared to quickly catch up on any missed material if you are allowed to enroll late. This shows commitment and can make it easier for instructors or administration to accommodate your request.\\n\\nRemember, clear and courteous communication will always help you in these situations. Good luck!\""
"\"Whether you can still enroll in a course that has already started depends on the specific policies of the institution or program offering the course. Here are a few steps you can take:\\n\\n1. **Check Enrollment Policies**: Visit the course or institution's website to review their enrollment policies, as some allow late registrations.\\n\\n2. **Contact the Instructor or Registrar**: Reach out to the course instructor or the registrar's office directly. They can provide you with information about late enrollment options and any conditions that might apply.\\n\\n3. **Consider Alternative Options**: If late enrollment is not permitted, ask about similar courses or upcoming sessions that you could join instead.\\n\\n4. **Understand the Impact**: If allowed to enroll late, inquire about how it might affect your ability to keep up with the coursework and any materials you may have missed.\\n\\nEach institution varies, so reaching out directly is the best approach.\""
]
},
"execution_count": 11,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -198,7 +192,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 13,
"id": "b21237c3-80e9-429c-a089-d45428087046",
"metadata": {},
"outputs": [],
Expand All @@ -218,7 +212,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 14,
"id": "8cc5784e-6515-42e5-be62-8fb915df1088",
"metadata": {},
"outputs": [],
Expand All @@ -245,7 +239,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 15,
"id": "97d35dec-c25f-472d-b961-20d5c30902ae",
"metadata": {},
"outputs": [],
Expand All @@ -261,7 +255,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 16,
"id": "8602f40b-ad3b-49c9-b3cc-051a79c888bc",
"metadata": {},
"outputs": [],
Expand All @@ -277,21 +271,10 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 18,
"id": "5fd4497b-c5d5-4258-b950-6b35d1af4ec5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\"To run Kafka, follow the relevant instructions based on your use case:\\n\\n### For Java:\\nNavigate to your project directory and use the following command in the terminal to run a Kafka producer/consumer/KStreams, etc.:\\n```shell\\njava -cp build/libs/<jar_name>-1.0-SNAPSHOT.jar:out src/main/java/org/example/JsonProducer.java\\n```\\nReplace `<jar_name>` with the actual name of your JAR file.\\n\\n### For Python:\\nIf you're running Python Kafka, ensure you have your virtual environment set up and activate it. Here’s how you can do it:\\n\\n1. **Create a virtual environment and install required packages (run only once):**\\n ```shell\\n python -m venv env\\n source env/bin/activate\\n pip install -r ../requirements.txt\\n ```\\n\\n2. **Activate the virtual environment (run this every time you need it):**\\n ```shell\\n source env/bin/activate\\n ```\\n\\n3. **Deactivate the virtual environment when done:**\\n ```shell\\n deactivate\\n ```\\n\\nNote: On Windows, the activation command would be slightly different:\\n```shell\\nenv\\\\Scripts\\\\activate\\n```\\n\\nMake sure that your Docker images are up and running if they are part of your setup.\""
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"rag(query)"
]
Expand Down Expand Up @@ -396,7 +379,15 @@
"\n",
"index_name = \"course-questions\"\n",
"\n",
"es_client.indices.create(index=index_name, body=index_settings)"
"if not es_client.indices.exists(index=index_name):\n",
" es_client.indices.create(\n",
" index=index_name,\n",
" settings=index_settings['settings'],\n",
" mappings=index_settings['mappings']\n",
" )\n",
" print(f\"Created index '{index_name}'\")\n",
"else:\n",
" print(f\"Index '{index_name}' already exists\")"
]
},
{
Expand Down Expand Up @@ -439,7 +430,7 @@
}
],
"source": [
"from tqdm.auto import tqdm"
"from tqdm import tqdm"
]
},
{
Expand Down Expand Up @@ -569,7 +560,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.12.7"
}
},
"nbformat": 4,
Expand Down