{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "id": "ylbT549oymIl" }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import os\n", "from langchain.document_loaders import (\n", " PyPDFLoader,\n", " TextLoader,\n", " Docx2txtLoader\n", ")\n", "\n", "from langchain.text_splitter import CharacterTextSplitter\n", "# from PyPDF2 import PdfReader\n", "from langchain.text_splitter import RecursiveCharacterTextSplitter\n", "from langchain_google_genai import GoogleGenerativeAIEmbeddings\n", "import google.generativeai as genai\n", "from langchain.vectorstores import FAISS\n", "from langchain_google_genai import ChatGoogleGenerativeAI\n", "from langchain.chains.question_answering import load_qa_chain\n", "from langchain.prompts import PromptTemplate\n", "from langchain.memory import ConversationBufferMemory\n", "from dotenv import load_dotenv\n", "load_dotenv()" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "os.chdir(\"../\")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "from src.utils import (\n", " process_files, answer_query, extract_text_from_file\n", ")" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "colab": { "background_save": true }, "id": "a8tNUutJB9EA" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Running on local URL: http://127.0.0.1:7862\n", "\n", "To create a public link, set `share=True` in `launch()`.\n" ] }, { "data": { "text/html": [ "
" ], "text/plain": [ "