{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "f5c4c3f9", "metadata": {}, "outputs": [], "source": [ "from sqlitesearch import TextSearchIndex\n", "\n", "sqlite_index = TextSearchIndex(\n", " text_fields=['question', 'section', 'answer'],\n", " keyword_fields=['course'],\n", " db_path='faq.db'\n", ")" ] }, { "cell_type": "code", "execution_count": 3, "id": "ae6c74e1", "metadata": {}, "outputs": [], "source": [ "from dotenv import load_dotenv\n", "load_dotenv()\n", "\n", "from openai import OpenAI\n", "openai_client = OpenAI()" ] }, { "cell_type": "code", "execution_count": 4, "id": "312ec56f", "metadata": {}, "outputs": [], "source": [ "from rag_helper import RAGBase\n", "\n", "assistant = RAGBase(sqlite_index, openai_client)" ] }, { "cell_type": "code", "execution_count": 5, "id": "a6905528", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'Yes, but if you want to receive a certificate, you need to submit your project while the course is still accepting submissions.'" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "assistant.rag('I just discovered the course, can I still join?')" ] }, { "cell_type": "code", "execution_count": null, "id": "6616419a", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "20a366eb", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "llm-zoomcamp-2026-code", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.1" } }, "nbformat": 4, "nbformat_minor": 5 }