{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "id": "2N8psBL6-wfJ" }, "outputs": [], "source": [ "# !cp -rf /content/drive/MyDrive/ML\\ Projects/Gemini-Pro/docs /content/" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "9AkjB4x3ybTb", "outputId": "7b4fa13a-cb14-4e59-f5b7-c426a3fbea35" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Collecting langchain\n", " Downloading langchain-0.1.0-py3-none-any.whl (797 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m798.0/798.0 KB\u001b[0m \u001b[31m604.5 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", "\u001b[?25hCollecting tenacity<9.0.0,>=8.1.0\n", " Using cached tenacity-8.2.3-py3-none-any.whl (24 kB)\n", "Collecting dataclasses-json<0.7,>=0.5.7\n", " Downloading dataclasses_json-0.6.3-py3-none-any.whl (28 kB)\n", "Collecting SQLAlchemy<3,>=1.4\n", " Downloading SQLAlchemy-2.0.25-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m3.1/3.1 MB\u001b[0m \u001b[31m1.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", "\u001b[?25hCollecting requests<3,>=2\n", " Using cached requests-2.31.0-py3-none-any.whl (62 kB)\n", "Collecting numpy<2,>=1\n", " Downloading numpy-1.26.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.2 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m18.2/18.2 MB\u001b[0m \u001b[31m2.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", "\u001b[?25hCollecting langchain-core<0.2,>=0.1.7\n", " Using cached langchain_core-0.1.10-py3-none-any.whl (216 kB)\n", "Collecting langchain-community<0.1,>=0.0.9\n", " Downloading langchain_community-0.0.12-py3-none-any.whl (1.6 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.6/1.6 MB\u001b[0m \u001b[31m1.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0meta \u001b[36m0:00:01\u001b[0m\n", "\u001b[?25hCollecting langsmith<0.1.0,>=0.0.77\n", " Downloading langsmith-0.0.80-py3-none-any.whl (48 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m48.3/48.3 KB\u001b[0m \u001b[31m594.8 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m \u001b[36m0:00:01\u001b[0m\n", "\u001b[?25hCollecting PyYAML>=5.3\n", " Using cached PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (705 kB)\n", "Collecting aiohttp<4.0.0,>=3.8.3\n", " Downloading aiohttp-3.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.2/1.2 MB\u001b[0m \u001b[31m524.5 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:04\u001b[0m\n", "\u001b[?25hCollecting async-timeout<5.0.0,>=4.0.0\n", " Using cached async_timeout-4.0.3-py3-none-any.whl (5.7 kB)\n", "Collecting pydantic<3,>=1\n", " Using cached pydantic-2.5.3-py3-none-any.whl (381 kB)\n", "Collecting jsonpatch<2.0,>=1.33\n", " Using cached jsonpatch-1.33-py2.py3-none-any.whl (12 kB)\n", "Collecting aiosignal>=1.1.2\n", " Using cached aiosignal-1.3.1-py3-none-any.whl (7.6 kB)\n", "Collecting multidict<7.0,>=4.5\n", " Using cached multidict-6.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (114 kB)\n", "Collecting yarl<2.0,>=1.0\n", " Downloading yarl-1.9.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (301 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m301.6/301.6 KB\u001b[0m \u001b[31m867.8 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", "\u001b[?25hCollecting frozenlist>=1.1.1\n", " Downloading frozenlist-1.4.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (239 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m239.5/239.5 KB\u001b[0m \u001b[31m1.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", "\u001b[?25hCollecting attrs>=17.3.0\n", " Downloading attrs-23.2.0-py3-none-any.whl (60 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m60.8/60.8 KB\u001b[0m \u001b[31m7.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hCollecting marshmallow<4.0.0,>=3.18.0\n", " Downloading marshmallow-3.20.2-py3-none-any.whl (49 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m49.4/49.4 KB\u001b[0m \u001b[31m17.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hCollecting typing-inspect<1,>=0.4.0\n", " Using cached typing_inspect-0.9.0-py3-none-any.whl (8.8 kB)\n", "Collecting jsonpointer>=1.9\n", " Using cached jsonpointer-2.4-py2.py3-none-any.whl (7.8 kB)\n", "Requirement already satisfied: packaging<24.0,>=23.2 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from langchain-core<0.2,>=0.1.7->langchain) (23.2)\n", "Collecting anyio<5,>=3\n", " Using cached anyio-4.2.0-py3-none-any.whl (85 kB)\n", "Collecting annotated-types>=0.4.0\n", " Using cached annotated_types-0.6.0-py3-none-any.whl (12 kB)\n", "Collecting typing-extensions>=4.6.1\n", " Using cached typing_extensions-4.9.0-py3-none-any.whl (32 kB)\n", "\u001b[33mWARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))': /simple/pydantic-core/\u001b[0m\u001b[33m\n", "\u001b[0mCollecting pydantic-core==2.14.6\n", " Using cached pydantic_core-2.14.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB)\n", "Collecting certifi>=2017.4.17\n", " Using cached certifi-2023.11.17-py3-none-any.whl (162 kB)\n", "Collecting urllib3<3,>=1.21.1\n", " Using cached urllib3-2.1.0-py3-none-any.whl (104 kB)\n", "Collecting idna<4,>=2.5\n", " Using cached idna-3.6-py3-none-any.whl (61 kB)\n", "Collecting charset-normalizer<4,>=2\n", " Using cached charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (142 kB)\n", "Collecting greenlet!=0.4.17\n", " Downloading greenlet-3.0.3-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (616 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m616.0/616.0 KB\u001b[0m \u001b[31m1.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", "\u001b[?25hCollecting sniffio>=1.1\n", " Using cached sniffio-1.3.0-py3-none-any.whl (10 kB)\n", "Requirement already satisfied: exceptiongroup>=1.0.2 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from anyio<5,>=3->langchain-core<0.2,>=0.1.7->langchain) (1.2.0)\n", "Collecting mypy-extensions>=0.3.0\n", " Using cached mypy_extensions-1.0.0-py3-none-any.whl (4.7 kB)\n", "Installing collected packages: urllib3, typing-extensions, tenacity, sniffio, PyYAML, numpy, mypy-extensions, multidict, marshmallow, jsonpointer, idna, greenlet, frozenlist, charset-normalizer, certifi, attrs, async-timeout, annotated-types, yarl, typing-inspect, SQLAlchemy, requests, pydantic-core, jsonpatch, anyio, aiosignal, pydantic, dataclasses-json, aiohttp, langsmith, langchain-core, langchain-community, langchain\n", "Successfully installed PyYAML-6.0.1 SQLAlchemy-2.0.25 aiohttp-3.9.1 aiosignal-1.3.1 annotated-types-0.6.0 anyio-4.2.0 async-timeout-4.0.3 attrs-23.2.0 certifi-2023.11.17 charset-normalizer-3.3.2 dataclasses-json-0.6.3 frozenlist-1.4.1 greenlet-3.0.3 idna-3.6 jsonpatch-1.33 jsonpointer-2.4 langchain-0.1.0 langchain-community-0.0.12 langchain-core-0.1.10 langsmith-0.0.80 marshmallow-3.20.2 multidict-6.0.4 mypy-extensions-1.0.0 numpy-1.26.3 pydantic-2.5.3 pydantic-core-2.14.6 requests-2.31.0 sniffio-1.3.0 tenacity-8.2.3 typing-extensions-4.9.0 typing-inspect-0.9.0 urllib3-2.1.0 yarl-1.9.4\n", "Collecting pypdf\n", " Downloading pypdf-3.17.4-py3-none-any.whl (278 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m278.2/278.2 KB\u001b[0m \u001b[31m898.7 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", "\u001b[?25hInstalling collected packages: pypdf\n", "Successfully installed pypdf-3.17.4\n", "Collecting langchain_google_genai\n", " Using cached langchain_google_genai-0.0.6-py3-none-any.whl (15 kB)\n", "Collecting google-generativeai<0.4.0,>=0.3.1\n", " Using cached google_generativeai-0.3.2-py3-none-any.whl (146 kB)\n", "Requirement already satisfied: langchain-core<0.2,>=0.1 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from langchain_google_genai) (0.1.10)\n", "Collecting google-api-core\n", " Using cached google_api_core-2.15.0-py3-none-any.whl (121 kB)\n", "Collecting google-ai-generativelanguage==0.4.0\n", " Using cached google_ai_generativelanguage-0.4.0-py3-none-any.whl (598 kB)\n", "Collecting protobuf\n", " Downloading protobuf-4.25.2-cp37-abi3-manylinux2014_x86_64.whl (294 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m294.6/294.6 KB\u001b[0m \u001b[31m891.6 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", "\u001b[?25hCollecting google-auth\n", " Downloading google_auth-2.26.2-py2.py3-none-any.whl (186 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m186.5/186.5 KB\u001b[0m \u001b[31m1.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", "\u001b[?25hRequirement already satisfied: typing-extensions in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from google-generativeai<0.4.0,>=0.3.1->langchain_google_genai) (4.9.0)\n", "Collecting tqdm\n", " Using cached tqdm-4.66.1-py3-none-any.whl (78 kB)\n", "Collecting proto-plus<2.0.0dev,>=1.22.3\n", " Using cached proto_plus-1.23.0-py3-none-any.whl (48 kB)\n", "Requirement already satisfied: requests<3,>=2 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from langchain-core<0.2,>=0.1->langchain_google_genai) (2.31.0)\n", "Requirement already satisfied: langsmith<0.1.0,>=0.0.63 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from langchain-core<0.2,>=0.1->langchain_google_genai) (0.0.80)\n", "Requirement already satisfied: pydantic<3,>=1 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from langchain-core<0.2,>=0.1->langchain_google_genai) (2.5.3)\n", "Requirement already satisfied: PyYAML>=5.3 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from langchain-core<0.2,>=0.1->langchain_google_genai) (6.0.1)\n", "Requirement already satisfied: anyio<5,>=3 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from langchain-core<0.2,>=0.1->langchain_google_genai) (4.2.0)\n", "Requirement already satisfied: packaging<24.0,>=23.2 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from langchain-core<0.2,>=0.1->langchain_google_genai) (23.2)\n", "Requirement already satisfied: tenacity<9.0.0,>=8.1.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from langchain-core<0.2,>=0.1->langchain_google_genai) (8.2.3)\n", "Requirement already satisfied: jsonpatch<2.0,>=1.33 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from langchain-core<0.2,>=0.1->langchain_google_genai) (1.33)\n", "Requirement already satisfied: sniffio>=1.1 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from anyio<5,>=3->langchain-core<0.2,>=0.1->langchain_google_genai) (1.3.0)\n", "Requirement already satisfied: idna>=2.8 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from anyio<5,>=3->langchain-core<0.2,>=0.1->langchain_google_genai) (3.6)\n", "Requirement already satisfied: exceptiongroup>=1.0.2 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from anyio<5,>=3->langchain-core<0.2,>=0.1->langchain_google_genai) (1.2.0)\n", "Requirement already satisfied: jsonpointer>=1.9 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from jsonpatch<2.0,>=1.33->langchain-core<0.2,>=0.1->langchain_google_genai) (2.4)\n", "Requirement already satisfied: pydantic-core==2.14.6 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from pydantic<3,>=1->langchain-core<0.2,>=0.1->langchain_google_genai) (2.14.6)\n", "Requirement already satisfied: annotated-types>=0.4.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from pydantic<3,>=1->langchain-core<0.2,>=0.1->langchain_google_genai) (0.6.0)\n", "Requirement already satisfied: charset-normalizer<4,>=2 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from requests<3,>=2->langchain-core<0.2,>=0.1->langchain_google_genai) (3.3.2)\n", "Requirement already satisfied: urllib3<3,>=1.21.1 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from requests<3,>=2->langchain-core<0.2,>=0.1->langchain_google_genai) (2.1.0)\n", "Requirement already satisfied: certifi>=2017.4.17 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from requests<3,>=2->langchain-core<0.2,>=0.1->langchain_google_genai) (2023.11.17)\n", "Collecting googleapis-common-protos<2.0.dev0,>=1.56.2\n", " Downloading googleapis_common_protos-1.62.0-py2.py3-none-any.whl (228 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m228.7/228.7 KB\u001b[0m \u001b[31m1.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", "\u001b[?25hCollecting cachetools<6.0,>=2.0.0\n", " Using cached cachetools-5.3.2-py3-none-any.whl (9.3 kB)\n", "Collecting pyasn1-modules>=0.2.1\n", " Using cached pyasn1_modules-0.3.0-py2.py3-none-any.whl (181 kB)\n", "Collecting rsa<5,>=3.1.4\n", " Using cached rsa-4.9-py3-none-any.whl (34 kB)\n", "Collecting grpcio<2.0dev,>=1.33.2\n", " Using cached grpcio-1.60.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.4 MB)\n", "Collecting grpcio-status<2.0.dev0,>=1.33.2\n", " Using cached grpcio_status-1.60.0-py3-none-any.whl (14 kB)\n", "Collecting pyasn1<0.6.0,>=0.4.6\n", " Downloading pyasn1-0.5.1-py2.py3-none-any.whl (84 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m84.9/84.9 KB\u001b[0m \u001b[31m974.7 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", "\u001b[?25hInstalling collected packages: tqdm, pyasn1, protobuf, grpcio, cachetools, rsa, pyasn1-modules, proto-plus, googleapis-common-protos, grpcio-status, google-auth, google-api-core, google-ai-generativelanguage, google-generativeai, langchain_google_genai\n", "Successfully installed cachetools-5.3.2 google-ai-generativelanguage-0.4.0 google-api-core-2.15.0 google-auth-2.26.2 google-generativeai-0.3.2 googleapis-common-protos-1.62.0 grpcio-1.60.0 grpcio-status-1.60.0 langchain_google_genai-0.0.6 proto-plus-1.23.0 protobuf-4.25.2 pyasn1-0.5.1 pyasn1-modules-0.3.0 rsa-4.9 tqdm-4.66.1\n", "Requirement already satisfied: google-generativeai in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (0.3.2)\n", "Requirement already satisfied: google-auth in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from google-generativeai) (2.26.2)\n", "Requirement already satisfied: google-api-core in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from google-generativeai) (2.15.0)\n", "Requirement already satisfied: protobuf in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from google-generativeai) (4.25.2)\n", "Requirement already satisfied: google-ai-generativelanguage==0.4.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from google-generativeai) (0.4.0)\n", "Requirement already satisfied: tqdm in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from google-generativeai) (4.66.1)\n", "Requirement already satisfied: typing-extensions in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from google-generativeai) (4.9.0)\n", "Requirement already satisfied: proto-plus<2.0.0dev,>=1.22.3 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from google-ai-generativelanguage==0.4.0->google-generativeai) (1.23.0)\n", "Requirement already satisfied: requests<3.0.0.dev0,>=2.18.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from google-api-core->google-generativeai) (2.31.0)\n", "Requirement already satisfied: googleapis-common-protos<2.0.dev0,>=1.56.2 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from google-api-core->google-generativeai) (1.62.0)\n", "Requirement already satisfied: cachetools<6.0,>=2.0.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from google-auth->google-generativeai) (5.3.2)\n", "Requirement already satisfied: pyasn1-modules>=0.2.1 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from google-auth->google-generativeai) (0.3.0)\n", "Requirement already satisfied: rsa<5,>=3.1.4 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from google-auth->google-generativeai) (4.9)\n", "Requirement already satisfied: grpcio<2.0dev,>=1.33.2 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from google-api-core->google-generativeai) (1.60.0)\n", "Requirement already satisfied: grpcio-status<2.0.dev0,>=1.33.2 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from google-api-core->google-generativeai) (1.60.0)\n", "Requirement already satisfied: pyasn1<0.6.0,>=0.4.6 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from pyasn1-modules>=0.2.1->google-auth->google-generativeai) (0.5.1)\n", "Requirement already satisfied: certifi>=2017.4.17 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from requests<3.0.0.dev0,>=2.18.0->google-api-core->google-generativeai) (2023.11.17)\n", "Requirement already satisfied: charset-normalizer<4,>=2 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from requests<3.0.0.dev0,>=2.18.0->google-api-core->google-generativeai) (3.3.2)\n", "Requirement already satisfied: urllib3<3,>=1.21.1 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from requests<3.0.0.dev0,>=2.18.0->google-api-core->google-generativeai) (2.1.0)\n", "Requirement already satisfied: idna<4,>=2.5 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from requests<3.0.0.dev0,>=2.18.0->google-api-core->google-generativeai) (3.6)\n", "Collecting chromadb\n", " Downloading chromadb-0.4.22-py3-none-any.whl (509 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m509.0/509.0 KB\u001b[0m \u001b[31m945.6 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", "\u001b[?25hCollecting overrides>=7.3.1\n", " Using cached overrides-7.4.0-py3-none-any.whl (17 kB)\n", "Collecting opentelemetry-api>=1.2.0\n", " Downloading opentelemetry_api-1.22.0-py3-none-any.whl (57 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m57.9/57.9 KB\u001b[0m \u001b[31m861.5 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:--:--\u001b[0m\n", "\u001b[?25hRequirement already satisfied: typing-extensions>=4.5.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from chromadb) (4.9.0)\n", "Collecting pulsar-client>=3.1.0\n", " Downloading pulsar_client-3.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.4 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m5.4/5.4 MB\u001b[0m \u001b[31m1.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", "\u001b[?25hCollecting mmh3>=4.0.1\n", " Downloading mmh3-4.1.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (67 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m67.6/67.6 KB\u001b[0m \u001b[31m6.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hCollecting onnxruntime>=1.14.1\n", " Downloading onnxruntime-1.16.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.4 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m6.4/6.4 MB\u001b[0m \u001b[31m2.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", "\u001b[?25hCollecting typer>=0.9.0\n", " Using cached typer-0.9.0-py3-none-any.whl (45 kB)\n", "Requirement already satisfied: grpcio>=1.58.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from chromadb) (1.60.0)\n", "Requirement already satisfied: numpy>=1.22.5 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from chromadb) (1.26.3)\n", "Collecting opentelemetry-instrumentation-fastapi>=0.41b0\n", " Downloading opentelemetry_instrumentation_fastapi-0.43b0-py3-none-any.whl (11 kB)\n", "Requirement already satisfied: requests>=2.28 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from chromadb) (2.31.0)\n", "Collecting pypika>=0.48.9\n", " Using cached PyPika-0.48.9-py2.py3-none-any.whl\n", "Requirement already satisfied: pydantic>=1.9 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from chromadb) (2.5.3)\n", "Collecting opentelemetry-exporter-otlp-proto-grpc>=1.2.0\n", " Downloading opentelemetry_exporter_otlp_proto_grpc-1.22.0-py3-none-any.whl (18 kB)\n", "Collecting opentelemetry-sdk>=1.2.0\n", " Downloading opentelemetry_sdk-1.22.0-py3-none-any.whl (105 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m105.6/105.6 KB\u001b[0m \u001b[31m6.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hCollecting kubernetes>=28.1.0\n", " Downloading kubernetes-29.0.0-py2.py3-none-any.whl (1.6 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.6/1.6 MB\u001b[0m \u001b[31m1.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", "\u001b[?25hCollecting uvicorn[standard]>=0.18.3\n", " Using cached uvicorn-0.25.0-py3-none-any.whl (60 kB)\n", "Collecting posthog>=2.4.0\n", " Downloading posthog-3.3.1-py2.py3-none-any.whl (40 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m40.6/40.6 KB\u001b[0m \u001b[31m455.0 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m \u001b[36m0:00:01\u001b[0m\n", "\u001b[?25hRequirement already satisfied: tenacity>=8.2.3 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from chromadb) (8.2.3)\n", "Requirement already satisfied: PyYAML>=6.0.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from chromadb) (6.0.1)\n", "Requirement already satisfied: tqdm>=4.65.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from chromadb) (4.66.1)\n", "Collecting tokenizers>=0.13.2\n", " Using cached tokenizers-0.15.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.8 MB)\n", "Collecting bcrypt>=4.0.1\n", " Downloading bcrypt-4.1.2-cp39-abi3-manylinux_2_28_x86_64.whl (698 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m698.9/698.9 KB\u001b[0m \u001b[31m1.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", "\u001b[?25hCollecting fastapi>=0.95.2\n", " Downloading fastapi-0.109.0-py3-none-any.whl (92 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m92.0/92.0 KB\u001b[0m \u001b[31m9.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hCollecting build>=1.0.3\n", " Downloading build-1.0.3-py3-none-any.whl (18 kB)\n", "Collecting importlib-resources\n", " Using cached importlib_resources-6.1.1-py3-none-any.whl (33 kB)\n", "Collecting chroma-hnswlib==0.7.3\n", " Using cached chroma_hnswlib-0.7.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.4 MB)\n", "Collecting pyproject_hooks\n", " Downloading pyproject_hooks-1.0.0-py3-none-any.whl (9.3 kB)\n", "Collecting tomli>=1.1.0\n", " Using cached tomli-2.0.1-py3-none-any.whl (12 kB)\n", "Requirement already satisfied: packaging>=19.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from build>=1.0.3->chromadb) (23.2)\n", "Collecting starlette<0.36.0,>=0.35.0\n", " Downloading starlette-0.35.1-py3-none-any.whl (71 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m71.1/71.1 KB\u001b[0m \u001b[31m2.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hCollecting oauthlib>=3.2.2\n", " Using cached oauthlib-3.2.2-py3-none-any.whl (151 kB)\n", "Requirement already satisfied: python-dateutil>=2.5.3 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from kubernetes>=28.1.0->chromadb) (2.8.2)\n", "Requirement already satisfied: urllib3>=1.24.2 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from kubernetes>=28.1.0->chromadb) (2.1.0)\n", "Requirement already satisfied: google-auth>=1.0.1 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from kubernetes>=28.1.0->chromadb) (2.26.2)\n", "Requirement already satisfied: six>=1.9.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from kubernetes>=28.1.0->chromadb) (1.16.0)\n", "Collecting requests-oauthlib\n", " Using cached requests_oauthlib-1.3.1-py2.py3-none-any.whl (23 kB)\n", "Collecting websocket-client!=0.40.0,!=0.41.*,!=0.42.*,>=0.32.0\n", " Downloading websocket_client-1.7.0-py3-none-any.whl (58 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.5/58.5 KB\u001b[0m \u001b[31m3.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: certifi>=14.05.14 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from kubernetes>=28.1.0->chromadb) (2023.11.17)\n", "Collecting flatbuffers\n", " Using cached flatbuffers-23.5.26-py2.py3-none-any.whl (26 kB)\n", "Collecting coloredlogs\n", " Using cached coloredlogs-15.0.1-py2.py3-none-any.whl (46 kB)\n", "Collecting sympy\n", " Using cached sympy-1.12-py3-none-any.whl (5.7 MB)\n", "Requirement already satisfied: protobuf in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from onnxruntime>=1.14.1->chromadb) (4.25.2)\n", "Collecting deprecated>=1.2.6\n", " Using cached Deprecated-1.2.14-py2.py3-none-any.whl (9.6 kB)\n", "Collecting importlib-metadata<7.0,>=6.0\n", " Downloading importlib_metadata-6.11.0-py3-none-any.whl (23 kB)\n", "Collecting backoff<3.0.0,>=1.10.0\n", " Using cached backoff-2.2.1-py3-none-any.whl (15 kB)\n", "Collecting opentelemetry-proto==1.22.0\n", " Downloading opentelemetry_proto-1.22.0-py3-none-any.whl (50 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m50.8/50.8 KB\u001b[0m \u001b[31m1.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hCollecting opentelemetry-exporter-otlp-proto-common==1.22.0\n", " Downloading opentelemetry_exporter_otlp_proto_common-1.22.0-py3-none-any.whl (17 kB)\n", "Requirement already satisfied: googleapis-common-protos~=1.52 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from opentelemetry-exporter-otlp-proto-grpc>=1.2.0->chromadb) (1.62.0)\n", "Collecting opentelemetry-instrumentation-asgi==0.43b0\n", " Downloading opentelemetry_instrumentation_asgi-0.43b0-py3-none-any.whl (14 kB)\n", "Collecting opentelemetry-semantic-conventions==0.43b0\n", " Downloading opentelemetry_semantic_conventions-0.43b0-py3-none-any.whl (36 kB)\n", "Collecting opentelemetry-util-http==0.43b0\n", " Downloading opentelemetry_util_http-0.43b0-py3-none-any.whl (6.9 kB)\n", "Collecting opentelemetry-instrumentation==0.43b0\n", " Downloading opentelemetry_instrumentation-0.43b0-py3-none-any.whl (28 kB)\n", "Collecting wrapt<2.0.0,>=1.0.0\n", " Using cached wrapt-1.16.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (80 kB)\n", "Requirement already satisfied: setuptools>=16.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from opentelemetry-instrumentation==0.43b0->opentelemetry-instrumentation-fastapi>=0.41b0->chromadb) (59.6.0)\n", "Collecting asgiref~=3.0\n", " Downloading asgiref-3.7.2-py3-none-any.whl (24 kB)\n", "Collecting monotonic>=1.5\n", " Downloading monotonic-1.6-py2.py3-none-any.whl (8.2 kB)\n", "Requirement already satisfied: annotated-types>=0.4.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from pydantic>=1.9->chromadb) (0.6.0)\n", "Requirement already satisfied: pydantic-core==2.14.6 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from pydantic>=1.9->chromadb) (2.14.6)\n", "Requirement already satisfied: idna<4,>=2.5 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from requests>=2.28->chromadb) (3.6)\n", "Requirement already satisfied: charset-normalizer<4,>=2 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from requests>=2.28->chromadb) (3.3.2)\n", "Collecting huggingface_hub<1.0,>=0.16.4\n", " Using cached huggingface_hub-0.20.2-py3-none-any.whl (330 kB)\n", "Collecting click<9.0.0,>=7.1.1\n", " Using cached click-8.1.7-py3-none-any.whl (97 kB)\n", "Collecting h11>=0.8\n", " Using cached h11-0.14.0-py3-none-any.whl (58 kB)\n", "Collecting websockets>=10.4\n", " Downloading websockets-12.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (130 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m130.2/130.2 KB\u001b[0m \u001b[31m1.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", "\u001b[?25hCollecting python-dotenv>=0.13\n", " Using cached python_dotenv-1.0.0-py3-none-any.whl (19 kB)\n", "Collecting httptools>=0.5.0\n", " Using cached httptools-0.6.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (341 kB)\n", "Collecting watchfiles>=0.13\n", " Using cached watchfiles-0.21.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB)\n", "Collecting uvloop!=0.15.0,!=0.15.1,>=0.14.0\n", " Using cached uvloop-0.19.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.4 MB)\n", "Requirement already satisfied: rsa<5,>=3.1.4 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from google-auth>=1.0.1->kubernetes>=28.1.0->chromadb) (4.9)\n", "Requirement already satisfied: cachetools<6.0,>=2.0.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from google-auth>=1.0.1->kubernetes>=28.1.0->chromadb) (5.3.2)\n", "Requirement already satisfied: pyasn1-modules>=0.2.1 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from google-auth>=1.0.1->kubernetes>=28.1.0->chromadb) (0.3.0)\n", "Collecting filelock\n", " Using cached filelock-3.13.1-py3-none-any.whl (11 kB)\n", "Collecting fsspec>=2023.5.0\n", " Using cached fsspec-2023.12.2-py3-none-any.whl (168 kB)\n", "Collecting zipp>=0.5\n", " Downloading zipp-3.17.0-py3-none-any.whl (7.4 kB)\n", "Requirement already satisfied: anyio<5,>=3.4.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from starlette<0.36.0,>=0.35.0->fastapi>=0.95.2->chromadb) (4.2.0)\n", "Collecting humanfriendly>=9.1\n", " Using cached humanfriendly-10.0-py2.py3-none-any.whl (86 kB)\n", "Collecting mpmath>=0.19\n", " Using cached mpmath-1.3.0-py3-none-any.whl (536 kB)\n", "Requirement already satisfied: exceptiongroup>=1.0.2 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from anyio<5,>=3.4.0->starlette<0.36.0,>=0.35.0->fastapi>=0.95.2->chromadb) (1.2.0)\n", "Requirement already satisfied: sniffio>=1.1 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from anyio<5,>=3.4.0->starlette<0.36.0,>=0.35.0->fastapi>=0.95.2->chromadb) (1.3.0)\n", "Requirement already satisfied: pyasn1<0.6.0,>=0.4.6 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from pyasn1-modules>=0.2.1->google-auth>=1.0.1->kubernetes>=28.1.0->chromadb) (0.5.1)\n", "Installing collected packages: pypika, mpmath, monotonic, mmh3, flatbuffers, zipp, wrapt, websockets, websocket-client, uvloop, tomli, sympy, python-dotenv, pulsar-client, overrides, opentelemetry-util-http, opentelemetry-semantic-conventions, opentelemetry-proto, oauthlib, importlib-resources, humanfriendly, httptools, h11, fsspec, filelock, click, chroma-hnswlib, bcrypt, backoff, asgiref, watchfiles, uvicorn, typer, starlette, requests-oauthlib, pyproject_hooks, posthog, opentelemetry-exporter-otlp-proto-common, importlib-metadata, huggingface_hub, deprecated, coloredlogs, tokenizers, opentelemetry-api, onnxruntime, kubernetes, fastapi, build, opentelemetry-sdk, opentelemetry-instrumentation, opentelemetry-instrumentation-asgi, opentelemetry-exporter-otlp-proto-grpc, opentelemetry-instrumentation-fastapi, chromadb\n", "Successfully installed asgiref-3.7.2 backoff-2.2.1 bcrypt-4.1.2 build-1.0.3 chroma-hnswlib-0.7.3 chromadb-0.4.22 click-8.1.7 coloredlogs-15.0.1 deprecated-1.2.14 fastapi-0.109.0 filelock-3.13.1 flatbuffers-23.5.26 fsspec-2023.12.2 h11-0.14.0 httptools-0.6.1 huggingface_hub-0.20.2 humanfriendly-10.0 importlib-metadata-6.11.0 importlib-resources-6.1.1 kubernetes-29.0.0 mmh3-4.1.0 monotonic-1.6 mpmath-1.3.0 oauthlib-3.2.2 onnxruntime-1.16.3 opentelemetry-api-1.22.0 opentelemetry-exporter-otlp-proto-common-1.22.0 opentelemetry-exporter-otlp-proto-grpc-1.22.0 opentelemetry-instrumentation-0.43b0 opentelemetry-instrumentation-asgi-0.43b0 opentelemetry-instrumentation-fastapi-0.43b0 opentelemetry-proto-1.22.0 opentelemetry-sdk-1.22.0 opentelemetry-semantic-conventions-0.43b0 opentelemetry-util-http-0.43b0 overrides-7.4.0 posthog-3.3.1 pulsar-client-3.4.0 pypika-0.48.9 pyproject_hooks-1.0.0 python-dotenv-1.0.0 requests-oauthlib-1.3.1 starlette-0.35.1 sympy-1.12 tokenizers-0.15.0 tomli-2.0.1 typer-0.9.0 uvicorn-0.25.0 uvloop-0.19.0 watchfiles-0.21.0 websocket-client-1.7.0 websockets-12.0 wrapt-1.16.0 zipp-3.17.0\n", "Collecting gradio\n", " Using cached gradio-4.14.0-py3-none-any.whl (16.6 MB)\n", "Requirement already satisfied: packaging in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from gradio) (23.2)\n", "Requirement already satisfied: pyyaml<7.0,>=5.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from gradio) (6.0.1)\n", "Requirement already satisfied: pydantic>=2.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from gradio) (2.5.3)\n", "Requirement already satisfied: typing-extensions~=4.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from gradio) (4.9.0)\n", "Collecting tomlkit==0.12.0\n", " Using cached tomlkit-0.12.0-py3-none-any.whl (37 kB)\n", "Collecting pydub\n", " Using cached pydub-0.25.1-py2.py3-none-any.whl (32 kB)\n", "Collecting httpx\n", " Using cached httpx-0.26.0-py3-none-any.whl (75 kB)\n", "Collecting altair<6.0,>=4.2.0\n", " Using cached altair-5.2.0-py3-none-any.whl (996 kB)\n", "Requirement already satisfied: typer[all]<1.0,>=0.9 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from gradio) (0.9.0)\n", "Requirement already satisfied: importlib-resources<7.0,>=1.3 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from gradio) (6.1.1)\n", "Requirement already satisfied: fastapi in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from gradio) (0.109.0)\n", "Collecting python-multipart\n", " Using cached python_multipart-0.0.6-py3-none-any.whl (45 kB)\n", "Requirement already satisfied: huggingface-hub>=0.19.3 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from gradio) (0.20.2)\n", "Collecting gradio-client==0.8.0\n", " Using cached gradio_client-0.8.0-py3-none-any.whl (305 kB)\n", "Collecting jinja2<4.0\n", " Downloading Jinja2-3.1.3-py3-none-any.whl (133 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m133.2/133.2 KB\u001b[0m \u001b[31m917.4 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", "\u001b[?25hCollecting ffmpy\n", " Using cached ffmpy-0.3.1-py3-none-any.whl\n", "Collecting orjson~=3.0\n", " Using cached orjson-3.9.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (138 kB)\n", "Requirement already satisfied: uvicorn>=0.14.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from gradio) (0.25.0)\n", "Requirement already satisfied: numpy~=1.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from gradio) (1.26.3)\n", "Collecting matplotlib~=3.0\n", " Using cached matplotlib-3.8.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.6 MB)\n", "Collecting semantic-version~=2.0\n", " Using cached semantic_version-2.10.0-py2.py3-none-any.whl (15 kB)\n", "Collecting pillow<11.0,>=8.0\n", " Downloading pillow-10.2.0-cp310-cp310-manylinux_2_28_x86_64.whl (4.5 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m4.5/4.5 MB\u001b[0m \u001b[31m1.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", "\u001b[?25hCollecting aiofiles<24.0,>=22.0\n", " Using cached aiofiles-23.2.1-py3-none-any.whl (15 kB)\n", "Collecting pandas<3.0,>=1.0\n", " Using cached pandas-2.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.3 MB)\n", "Collecting markupsafe~=2.0\n", " Using cached MarkupSafe-2.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)\n", "Requirement already satisfied: fsspec in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from gradio-client==0.8.0->gradio) (2023.12.2)\n", "Collecting websockets<12.0,>=10.0\n", " Using cached websockets-11.0.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (129 kB)\n", "Collecting toolz\n", " Using cached toolz-0.12.0-py3-none-any.whl (55 kB)\n", "Collecting jsonschema>=3.0\n", " Using cached jsonschema-4.20.0-py3-none-any.whl (84 kB)\n", "Requirement already satisfied: tqdm>=4.42.1 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from huggingface-hub>=0.19.3->gradio) (4.66.1)\n", "Requirement already satisfied: filelock in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from huggingface-hub>=0.19.3->gradio) (3.13.1)\n", "Requirement already satisfied: requests in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from huggingface-hub>=0.19.3->gradio) (2.31.0)\n", "Collecting kiwisolver>=1.3.1\n", " Using cached kiwisolver-1.4.5-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.6 MB)\n", "Collecting pyparsing>=2.3.1\n", " Using cached pyparsing-3.1.1-py3-none-any.whl (103 kB)\n", "Collecting contourpy>=1.0.1\n", " Using cached contourpy-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (310 kB)\n", "Collecting cycler>=0.10\n", " Using cached cycler-0.12.1-py3-none-any.whl (8.3 kB)\n", "Requirement already satisfied: python-dateutil>=2.7 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from matplotlib~=3.0->gradio) (2.8.2)\n", "Collecting fonttools>=4.22.0\n", " Downloading fonttools-4.47.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.6 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m4.6/4.6 MB\u001b[0m \u001b[31m2.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", "\u001b[?25hCollecting pytz>=2020.1\n", " Using cached pytz-2023.3.post1-py2.py3-none-any.whl (502 kB)\n", "Collecting tzdata>=2022.1\n", " Using cached tzdata-2023.4-py2.py3-none-any.whl (346 kB)\n", "Requirement already satisfied: pydantic-core==2.14.6 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from pydantic>=2.0->gradio) (2.14.6)\n", "Requirement already satisfied: annotated-types>=0.4.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from pydantic>=2.0->gradio) (0.6.0)\n", "Requirement already satisfied: click<9.0.0,>=7.1.1 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from typer[all]<1.0,>=0.9->gradio) (8.1.7)\n", "Collecting shellingham<2.0.0,>=1.3.0\n", " Using cached shellingham-1.5.4-py2.py3-none-any.whl (9.8 kB)\n", "Collecting colorama<0.5.0,>=0.4.3\n", " Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)\n", "Collecting rich<14.0.0,>=10.11.0\n", " Using cached rich-13.7.0-py3-none-any.whl (240 kB)\n", "Requirement already satisfied: h11>=0.8 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from uvicorn>=0.14.0->gradio) (0.14.0)\n", "Requirement already satisfied: starlette<0.36.0,>=0.35.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from fastapi->gradio) (0.35.1)\n", "Requirement already satisfied: sniffio in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from httpx->gradio) (1.3.0)\n", "Requirement already satisfied: idna in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from httpx->gradio) (3.6)\n", "Requirement already satisfied: certifi in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from httpx->gradio) (2023.11.17)\n", "Collecting httpcore==1.*\n", " Using cached httpcore-1.0.2-py3-none-any.whl (76 kB)\n", "Requirement already satisfied: anyio in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from httpx->gradio) (4.2.0)\n", "Collecting referencing>=0.28.4\n", " Downloading referencing-0.32.1-py3-none-any.whl (26 kB)\n", "Collecting jsonschema-specifications>=2023.03.6\n", " Using cached jsonschema_specifications-2023.12.1-py3-none-any.whl (18 kB)\n", "Requirement already satisfied: attrs>=22.2.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio) (23.2.0)\n", "Collecting rpds-py>=0.7.1\n", " Downloading rpds_py-0.17.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.2/1.2 MB\u001b[0m \u001b[31m2.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0mm\n", "\u001b[?25hRequirement already satisfied: six>=1.5 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from python-dateutil>=2.7->matplotlib~=3.0->gradio) (1.16.0)\n", "Collecting markdown-it-py>=2.2.0\n", " Using cached markdown_it_py-3.0.0-py3-none-any.whl (87 kB)\n", "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from rich<14.0.0,>=10.11.0->typer[all]<1.0,>=0.9->gradio) (2.17.2)\n", "Requirement already satisfied: exceptiongroup>=1.0.2 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from anyio->httpx->gradio) (1.2.0)\n", "Requirement already satisfied: urllib3<3,>=1.21.1 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from requests->huggingface-hub>=0.19.3->gradio) (2.1.0)\n", "Requirement already satisfied: charset-normalizer<4,>=2 in /home/vasim/Khatir/Programming/ML Projects/gemini-pro with docs/.venv/lib/python3.10/site-packages (from requests->huggingface-hub>=0.19.3->gradio) (3.3.2)\n", "Collecting mdurl~=0.1\n", " Using cached mdurl-0.1.2-py3-none-any.whl (10.0 kB)\n", "Installing collected packages: pytz, pydub, ffmpy, websockets, tzdata, toolz, tomlkit, shellingham, semantic-version, rpds-py, python-multipart, pyparsing, pillow, orjson, mdurl, markupsafe, kiwisolver, httpcore, fonttools, cycler, contourpy, colorama, aiofiles, referencing, pandas, matplotlib, markdown-it-py, jinja2, httpx, rich, jsonschema-specifications, gradio-client, jsonschema, altair, gradio\n", " Attempting uninstall: websockets\n", " Found existing installation: websockets 12.0\n", " Uninstalling websockets-12.0:\n", " Successfully uninstalled websockets-12.0\n", "Successfully installed aiofiles-23.2.1 altair-5.2.0 colorama-0.4.6 contourpy-1.2.0 cycler-0.12.1 ffmpy-0.3.1 fonttools-4.47.2 gradio-4.14.0 gradio-client-0.8.0 httpcore-1.0.2 httpx-0.26.0 jinja2-3.1.3 jsonschema-4.20.0 jsonschema-specifications-2023.12.1 kiwisolver-1.4.5 markdown-it-py-3.0.0 markupsafe-2.1.3 matplotlib-3.8.2 mdurl-0.1.2 orjson-3.9.10 pandas-2.1.4 pillow-10.2.0 pydub-0.25.1 pyparsing-3.1.1 python-multipart-0.0.6 pytz-2023.3.post1 referencing-0.32.1 rich-13.7.0 rpds-py-0.17.1 semantic-version-2.10.0 shellingham-1.5.4 tomlkit-0.12.0 toolz-0.12.0 tzdata-2023.4 websockets-11.0.3\n", "Collecting faiss-cpu\n", " Using cached faiss_cpu-1.7.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.6 MB)\n", "Installing collected packages: faiss-cpu\n", "Successfully installed faiss-cpu-1.7.4\n" ] } ], "source": [ "# !pip install langchain\n", "# !pip install pypdf\n", "# !pip install langchain_google_genai\n", "# !pip install google-generativeai\n", "# !pip install chromadb\n", "# !pip install gradio\n", "# !pip install faiss-cpu" ] }, { "cell_type": "code", "execution_count": 2, "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" ] } ], "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 dotenv import load_dotenv" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "id": "PVfL-AcM8jnE" }, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\n", "load_dotenv()\n", "\n", "# genai.configure(api_key=userdata.get(\"GOOGLE_API_KEY\"))" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "id": "L4kAmlMpzA6X" }, "outputs": [], "source": [ "# document=[]\n", "# for file in os.listdir(\"docs\"):\n", "# if file.endswith(\".pdf\"):\n", "# pdf_path=\"./docs/\"+file\n", "# loader=PyPDFLoader(pdf_path)\n", "# document.extend(loader.load())\n", "# elif file.endswith('.docx') or file.endswith('.doc'):\n", "# doc_path=\"./docs/\"+file\n", "# loader=Docx2txtLoader(doc_path)\n", "# document.extend(loader.load())\n", "# elif file.endswith('.txt'):\n", "# text_path=\"./docs/\"+file\n", "# loader=TextLoader(text_path)\n", "# document.extend(loader.load())" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "id": "65o268jqzN7O" }, "outputs": [], "source": [ "def extract_text(docs):\n", " documents = []\n", " files = os.listdir(docs)\n", " \n", " if len(files) == 0:\n", " return \"Directory is empty\"\n", "\n", " base_dir = docs.split(\"/\")\n", " base_dir = \"/\".join(base_dir)\n", " \n", " print(files)\n", " print(base_dir)\n", "\n", " for file in files:\n", " if file.endswith(\".pdf\"):\n", " pdf_path=os.path.join(base_dir, file)\n", " loader=PyPDFLoader(pdf_path)\n", " documents.extend(loader.load())\n", " elif file.endswith('.docx') or file.endswith('.doc'):\n", " doc_path=os.path.join(base_dir, file)\n", " loader=Docx2txtLoader(doc_path)\n", " documents.extend(loader.load())\n", " elif file.endswith('.txt'):\n", " text_path=os.path.join(base_dir, file)\n", " loader=TextLoader(text_path)\n", " documents.extend(loader.load())\n", " return documents" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "id": "0gT5m9cD_cM7" }, "outputs": [], "source": [ "doc_dir = \"../docs\"" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "id": "Svi3z1Rdzjbm" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['profile.txt', 'llm-research.pdf']\n", "../docs\n" ] } ], "source": [ "documents = extract_text(doc_dir)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "ryjhUUWN7TnP", "outputId": "d862304d-16d7-4960-89e8-12e73842c897" }, "outputs": [ { "data": { "text/plain": [ "Document(page_content='PREPRINT 1\\nA Comprehensive Overview of\\nLarge Language Models\\nHumza Naveed1, Asad Ullah Khan1,∗, Shi Qiu2,∗, Muhammad Saqib3,4,∗,\\nSaeed Anwar5,6, Muhammad Usman5,6, Naveed Akhtar7, Nick Barnes8, Ajmal Mian9\\n1University of Engineering and Technology (UET), Lahore, Pakistan\\n2The Chinese University of Hong Kong (CUHK), HKSAR, China\\n3University of Technology Sydney (UTS), Sydney, Australia\\n4Commonwealth Scientific and Industrial Research Organisation (CSIRO), Sydney, Australia\\n5King Fahd University of Petroleum and Minerals (KFUPM), Dhahran, Saudi Arabia\\n6SDAIA-KFUPM Joint Research Center for Artificial Intelligence (JRCAI), Dhahran, Saudi Arabia\\n7The University of Melbourne (UoM), Melbourne, Australia\\n8Australian National University (ANU), Canberra, Australia\\n9The University of Western Australia (UWA), Perth, Australia\\nAbstract —\\nLarge Language Models (LLMs) have recently demonstrated\\nremarkable capabilities in natural language processing tasks and\\nbeyond. This success of LLMs has led to a large influx of research\\ncontributions in this direction. These works encompass diverse\\ntopics such as architectural innovations, better training strategies,\\ncontext length improvements, fine-tuning, multi-modal LLMs,\\nrobotics, datasets, benchmarking, efficiency, and more. With the\\nrapid development of techniques and regular breakthroughs in\\nLLM research, it has become considerably challenging to perceive\\nthe bigger picture of the advances in this direction. Considering\\nthe rapidly emerging plethora of literature on LLMs, it is\\nimperative that the research community is able to benefit from a\\nconcise yet comprehensive overview of the recent developments\\nin this field. This article provides an overview of the existing\\nliterature on a broad range of LLM-related concepts. Our self-\\ncontained comprehensive overview of LLMs discusses relevant\\nbackground concepts along with covering the advanced topics\\nat the frontier of research in LLMs. This review article is\\nintended to not only provide a systematic survey but also a quick\\ncomprehensive reference for the researchers and practitioners\\nto draw insights from extensive informative summaries of the\\nexisting works to advance the LLM research.\\nIndex Terms —\\nLarge Language Models, LLMs, chatGPT, Augmented LLMs,\\nMultimodal LLMs, LLM training, LLM Benchmarking\\nI. I NTRODUCTION\\nLanguage plays a fundamental role in facilitating commu-\\nnication and self-expression for humans, and their interaction\\nwith machines. The need for generalized models stems from\\n* is for equal contribution\\nContact e-mail: humza_naveed@yahoo.com\\nEmail: humza_naveed@yahoo.com, aukhanee@gmail.com,\\nshiqiu@cse.cuhk.edu.hk, muhammad.saqib@data61.csiro.au,\\nsaeed.anwar@kfupm.edu.sa, muhammad.usman@kfupm.edu.sa,\\nnaveed.akhtar1@unimelb.edu.au, nick.barnes@anu.edu.au,\\najmal.mian@uwa.edu.au\\nRepo: https://github.com/humza909/LLM_Survey.git\\nFig. 1: The trends in the number of LLM models introduced\\nover the years.\\nthe growing demand for machines to handle complex lan-\\nguage tasks, including translation, summarization, information\\nretrieval, conversational interactions, etc. Recently, signifi-\\ncant breakthroughs have been witnessed in language models,\\nprimarily attributed to transformers [1], increased computa-\\ntional capabilities, and the availability of large-scale training\\ndata. These developments have brought about a revolutionary\\ntransformation by enabling the creation of LLMs that can\\napproximate human-level performance on various tasks [2],\\n[3]. Large Language Models (LLMs) have emerged as cutting-\\nedge artificial intelligence systems that can process and gen-\\nerate text with coherent communication [4], and generalize to\\nmultiple tasks [5], [6].\\nThe historical progress in natural language processing (NLP)\\nevolved from statistical to neural language modeling and then\\nfrom pre-trained language models (PLMs) to LLMs. While\\nconventional language modeling (LM) trains task-specificarXiv:2307.06435v7 [cs.CL] 27 Dec 2023', metadata={'source': '../docs/llm-research.pdf', 'page': 0})" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "documents[1]" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "47" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(documents)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "id": "hMr64jFWts5V" }, "outputs": [], "source": [ "# embeddings = GoogleGenerativeAIEmbeddings(model = \"models/embedding-001\")\n", "# embeddings.embed_query(\"I am good\")" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "id": "CRe5WNKC0D88" }, "outputs": [], "source": [ "def get_text_chunks(text):\n", " text_splitter = RecursiveCharacterTextSplitter(chunk_size=10000, chunk_overlap=1000)\n", " chunks = text_splitter.split_documents(text)\n", " return chunks\n", "\n", "def get_vector_store(text_chunks, save=False):\n", " embeddings = GoogleGenerativeAIEmbeddings(model = \"models/embedding-001\")\n", " vector_store = FAISS.from_documents(text_chunks, embedding=embeddings)\n", " if not save:\n", " vector_store.save_local(\"faiss_index\")\n", " return vector_store" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "id": "2bfL_ejE63zE" }, "outputs": [], "source": [ "documents = get_text_chunks(documents)" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "colab": { "background_save": true }, "id": "9GgV19-K8T1h" }, "outputs": [], "source": [ "db = get_vector_store(documents)" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "id": "oVFkWCOw2UQt" }, "outputs": [], "source": [ "def get_conversational_chain():\n", "\n", " prompt_template = \"\"\"\n", " Answer the question as detailed as possible from the provided context, make sure to provide all the details, if the answer is not in\n", " provided context just say, \"answer is not available in the context\", don't provide the wrong answer\\n\\n\n", " Context:\\n {context}?\\n\n", " Question: \\n{question}\\n\n", "\n", " Answer:\n", " \"\"\"\n", "\n", " model = ChatGoogleGenerativeAI(model=\"gemini-pro\",temperature=0.3)\n", "\n", " prompt = PromptTemplate(template = prompt_template, input_variables = [\"context\", \"question\"])\n", " chain = load_qa_chain(llm=model, chain_type=\"stuff\", prompt=prompt)\n", "\n", " return chain" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "AIMessage(content='Hello! How can I assist you today?')" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "llm = ChatGoogleGenerativeAI(model=\"gemini-pro\",temperature=0.3)\n", "llm.invoke(\"HII\")" ] }, { "cell_type": "code", "execution_count": 32, "metadata": {}, "outputs": [], "source": [ "agent = get_conversational_chain()\n", "def answer(question,agent=agent, db=db):\n", " docs = db.similarity_search(question)\n", " print(docs)\n", " response = agent(\n", " {\"input_documents\":docs, \"question\": question}\n", " ,return_only_outputs=True)\n", " return response" ] }, { "cell_type": "code", "execution_count": 33, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Document(page_content='PREPRINT 5\\n2. Relative: To pass the information on the relative depen-\\ndencies of different tokens appearing at different locations in\\nthe sequence, a relative positional encoding is calculated by\\nsome kind of learning. Two famous types of relative encodings\\nare:\\nAlibi: [65] In this approach, a scalar bias is subtracted from\\nthe attention score calculated using two tokens which increases\\nwith the distance between the positions of the tokens. This\\nlearned approach effectively favors using recent tokens for\\nattention.\\nRoPE: Keys, queries, and values are all vectors in the LLMs.\\nRoPE [66] involves the rotation of the query and key represen-\\ntations at an angle proportional to their absolute positions of\\nthe tokens in the input sequence. This step results in a relative\\npositional encoding scheme which decays with the distance\\nbetween the tokens.\\nE. Activation Functions\\nThe activation functions serve a crucial role in the curve-\\nfitting abilities of the neural networks, as proved in [68]. The\\nmodern activation functions used in LLMs are different from\\nthe earlier squashing functions but are critical to the success\\nof LLMs. We discuss these activation functions in this section.\\n1. ReLU [69]: Rectified linear unit (ReLU) is defined as\\nReLU (x) =max(0, x) (1)\\n2. GeLU [70]: Gaussian Error Linear Unit (GeLU) is the\\ncombination of ReLU, dropout [71] and zoneout [72]. It is the\\nmost widely used activation function in contemporary LLM\\nliterature.\\n3. GLU variants [73]: Gated Linear Unit [74] is a neural\\nnetwork layer that is an element-wise product ( ⊗) of a linear\\ntransformation and a sigmoid transformed ( σ) linear projection\\nof the input given as\\nGLU (x, W, V, b, c ) = (xW+b)⊗σ(xV+c), (2)\\nwhere Xis the input of layer and l,W, b, V andcare learned\\nparameters.\\nGLU was modified in [73] to evaluate the effect of different\\nvariations in the training and testing of transformers, resulting\\nin better empirical results. Here are the different GLU varia-\\ntions introduced in [73] and used in LLMs.\\nReGLU (x, W, V, b, c ) =max(0, xW +b)⊗,\\nGEGLU (x, W, V, b, c ) =GELU (xW+b)⊗(xV+c),\\nSwiGLU (x, W, V, b, c, β ) =Swishβ (xW+b)⊗(xV+c).\\nF . Layer Normalization\\nLayer normalization leads to faster convergence and is a\\nwidely used component in transformers. In this section, we\\nprovide different normalization techniques widely used in\\nLLM literature.1. LayerNorm: Layer norm computes statistics over all the\\nhidden units in a layer (l)as follows:\\nul=1\\nnnX\\nial\\ni σl=vuut1\\nnnX\\ni(al\\ni−ul)2, (3)\\nwhere nis the number of neurons in the layer landal\\niis the\\nsummed input of the ineuron in layer l. LayerNorm provides\\ninvariance to rescaling of the weights and re-centering of the\\ndistribution.\\n2. RMSNorm: [75] proposed that the invariance properties\\nof LayerNorm are spurious, and we can achieve the same\\nperformance benefits as we get from LayerNorm by using a\\ncomputationally efficient normalization technique that trades\\noff re-centering invariance with speed. LayerNorm gives the\\nnormalized summed input to layer las follows\\nal\\ni=al\\ni−ul\\nσgl\\ni (4)\\nwhere gl\\niis the gain parameter. RMSNorm [75] modifies al\\ni\\nas\\nal\\ni=al\\ni\\nRMS(al)gl\\ni,where RMS (al) =vuut1\\nnnX\\ni(al\\ni)2.(5)\\n3. Pre-Norm and Post-Norm: LLMs use transformer [62]\\narchitecture with some variations. The original implementa-\\ntion [62] used layer normalization after the residual con-\\nnection, commonly called post-LN, concerning the order of\\nMultihead attention – Residual – LN . There is another order\\nof the normalization, referred to as pre-LN [76] due to the\\nposition of the normalization step before the self-attention\\nlayer as in LN – Multihead attention – Residual . Pre-LN is\\nknown to provide more stability in the training [77].\\n4. DeepNorm: While pre-LN has certain benefits over post-\\nLN training, pre-LN training has an unwanted effect on the\\ngradients [77]. The earlier layers have larger gradients than\\nthose at the bottom. DeepNorm [78] mitigates these adverse\\neffects on the gradients. It is given as\\nxlf=LN(αxlp+Glp(xlp, θlp), (6)\\nwhere αis a constant and θlprepresents the parameters of\\nlayer lp. These parameters are scaled by another constant β.\\nBoth of these constants depend only on the architecture.\\nG. Distributed LLM Training\\nThis section describes distributed LLM training approaches\\nbriefly. More details are available in [13], [37], [79], [80].\\n1. Data Parallelism: Data parallelism replicates the model\\non multiple devices where data in a batch gets divided across\\ndevices. At the end of each training iteration weights are\\nsynchronized across all devices.\\n2. Tensor Parallelism: Tensor parallelism shards a tensor\\ncomputation across devices. It is also known as horizontal\\nparallelism or intra-layer model parallelism.', metadata={'source': '../docs/llm-research.pdf', 'page': 4})" ] }, "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ "documents[5]" ] }, { "cell_type": "code", "execution_count": 34, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[Document(page_content='HI, this is vasim an AI Engineer', metadata={'source': '../docs/profile.txt'}), Document(page_content='PREPRINT 23\\nTABLE V: Architecture details of LLMs. Here, “PE” is the positional embedding, “nL” is the number of layers, “nH” is the\\nnumber of attention heads, “HS” is the size of hidden states.\\nModels TypeTraining\\nObjectiveAttention Vocab Tokenizer Norm PE Activation Bias nL nH HS\\nT5 (11B) Enc-Dec Span Corruption Standard 32k SentencePiece Pre-RMS Relative ReLU × 24 128 1024\\nGPT3 (175B) Causal-Dec Next Token Dense+Sparse - - Layer Learned GeLU ✓ 96 96 12288\\nmT5 (13B) Enc-Dec Span Corruption Standard 250k SentencePiece Pre-RMS Relative ReLU - - - -\\nPanGu- α(200B) Causal-Dec Next Token Standard 40k BPE Layer - - - 64 128 16384\\nCPM-2 (198B) Enc-Dec Span Corruption Standard 250k SentencePiece Pre-RMS Relative ReLU - 24 64 -\\nCodex (12B) Causal-Dec Next Token Standard - BPE+ Pre-Layer Learned GeLU - 96 96 12288\\nERNIE 3.0 (10B) Causal-Dec Next Token Standard - WordPiece Post-Layer Relative GeLU - 48 64 4096\\nJurassic-1 (178B) Causal-Dec Next Token Standard 256k SentencePiece∗Pre-Layer Learned GeLU ✓ 76 96 13824\\nHyperCLOV A (82B) Causal-Dec Next Token Dense+Sparse - BPE* Pre-Layer Learned GeLU - 64 80 10240\\nYuan 1.0 (245B) Causal-Dec Next Token Standard - - - - - - 76 -16384\\nGopher (280B) Causal-Dec Next Token Standard 32k SentencePiece Pre-RMS Relative GeLU ✓ 80 128 16384\\nERNIE 3.0 Titan (260B) Causal-Dec Next Token Standard - WordPiece Post-Layer Relative GeLU - 48 192 12288\\nGPT-NeoX-20B Causal-Dec Next Token Parallel 50k BPE Layer Rotary GeLU ✓ 44 64 -\\nOPT (175B) Causal-Dec Next Token Standard - BPE - - ReLU ✓ 96 96 -\\nBLOOM (176B) Causal-Dec Next Token Standard 250k BPE Layer ALiBi GeLU ✓ 70 112 14336\\nGalactica (120B) Causal-Dec Next Token Standard 50k BPE+custom Layer Learned GeLU × 96 80 10240\\nGLaM (1.2T) MoE-Dec Next Token Standard 256k SentencePiece Layer Relative GeLU ✓ 64 128 32768\\nLaMDA (137B) Causal-Dec Next Token Standard 32k BPE Layer Relative GeGLU - 64 128 8192\\nMT-NLG (530B) Causal-Dec Next Token Standard 50k BPE Pre-Layer Learned GeLU ✓ 105 128 20480\\nAlphaCode (41B) Enc-Dec Next Token Multi-query 8k SentencePiece - - - - 64 128 6144\\nChinchilla (70B) Causal-Dec Next Token Standard 32k SentencePiece-NFKC Pre-RMS Relative GeLU ✓ 80 64 8192\\nPaLM (540B) Causal-Dec Next Token Parallel+Multi-query 256k SentencePiece Layer RoPE SwiGLU × 118 48 18432\\nAlexaTM (20B) Enc-Dec Denoising Standard 150k SentencePiece Pre-Layer Learned GeLU ✓ 78 32 4096\\nSparrow (70B) Causal-Dec Pref.&Rule RM - 32k SentencePiece-NFKC Pre-RMS Relative GeLU ✓ 16∗64 8192\\nU-PaLM (540B) Non-Causal-Dec MoD Parallel+Multi-query 256k SentencePiece Layer RoPE SwiGLU × 118 48 18432\\nUL2 (20B) Enc-Dec MoD Standard 32k SentencePiece - - - - 64 16 4096\\nGLM (130B) Non-Causal-Dec AR Blank Infilling Standard 130k SentencePiece Deep RoPE GeGLU ✓ 70 96 12288\\nCodeGen (16B) Causal-Dec Next Token Parallel - BPE Layer RoPE - - 34 24 -\\nLLaMA (65B) Causal-Dec Next Token Standard 32k BPE Pre-RMS RoPE SwiGLU - 80 64 8192\\nPanGu- Σ(1085B) Causal-Dec Next Token Standard - BPE Fused Layer - FastGeLU - 40 40 5120\\nBloombergGPT (50B) Causal-Dec Next Token Standard 131k Unigram Layer ALiBi GeLU ✓ 70 40 7680\\nXuan Yuan 2.0 (176B) Causal-Dec Next Token Self 250k BPE Layer ALiBi GeLU ✓ 70 112 14336\\nCodeT5+ (16B) Enc-Dec SC+NT+Cont.+Match Standard - Code-Specific - - - - - - -\\nStarCoder (15.5B) Causal-Dec FIM Multi-query 49k BPE - Learned - - 40 48 6144\\nLLaMA (70B) Causal-Dec Next Token Grouped-query 32k BPE Pre-RMS RoPE SwiGLUE - - - -\\nPaLM-2 - MoD Parallel - - - - - - - - -\\nTABLE VI: Summary of optimization settings used for pre-trained LLMs. The values for weight decay, gradient clipping, and\\ndropout are 0.1, 1.0, and 0.1, respectively, for most of the LLMs.\\nSequence LR Optimizers Precision Weight Grad\\nModels Batch Size Length LR Warmup Decay AdaFactor Adam AdamW FP16 BF16 Mixed Decay Clip Dropout\\nT5 (11B) 211512 0.01 × inverse square root ✓ - - - - - ✓\\nGPT3 (175B) 32K - 6e-5 ✓ cosine ✓ ✓ ✓ ✓ -\\nmT5 (13B) 1024 1024 0.01 - inverse square root ✓ - - - - - ✓\\nPanGu- α(200B) - 1024 2e-5 - - - - - - ✓ - - - -\\nCPM-2 (198B) 1024 1024 0.001 - - ✓ - - - - - ✓\\nCodex (12B) - - 6e-5 ✓ cosine ✓ ✓ ✓ - -\\nERNIE 3.0 (12B) 6144 512 1e-4 ✓ linear ✓ - - - ✓ - -\\nJurassic-1 (178B) 3.2M 2048 6e-5 ✓ cosine ✓ ✓ ✓ ✓ -\\nHyperCLOV A (82B) 1024 - 6e-5 - cosine ✓ - - - ✓ - -\\nYuan 1.0 (245B) <10M 2048 1.6e-4 ✓ cosine decay to 10% ✓ - - - ✓ - -\\nGopher (280B) 3M 2048 4e-5 ✓ cosine decay to 10% ✓ ✓ - ✓ -\\nERNIE 3.0 Titan (260B) - 512 1e-4 ✓ linear ✓ ✓ ✓ ✓ -\\nGPT-NeoX-20B 1538 2048 0.97e-5 ✓ cosine ✓ ✓ ✓ ✓ ×\\nOPT (175B) 2M 2048 1.2e-4 - linear ✓ ✓ ✓ ✓ ✓\\nBLOOM (176B) 2048 2048 6e-5 ✓ cosine ✓ ✓ ✓ ✓ ×\\nGalactica (120B) 2M 2048 7e-6 ✓ linear decay to 10% ✓ - - - ✓ ✓ ✓\\nGLaM (1.2T) 1M 1024 0.01 - inverse square root ✓ FP32 + ✓ - ✓ ×\\nLaMDA (137B) 256K - - - - - - - - - - - - -\\nMT-NLG (530B) 1920 2048 5e-5 ✓ cosine decay to 10% ✓ ✓ ✓ ✓ -\\nAlphaCode (41B) 2048 1536+768 1e-4 ✓ cosine decay to 10% ✓ ✓ ✓ ✓ -\\nChinchilla (70B) 1.5M 2048 1e-4 ✓ cosine decay to 10% ✓ ✓ - - -\\nPaLM (540B) 2048 2048 0.01 - inverse square root ✓ - - - ✓ ✓ ×\\nAlexaTM (20B) 2M 1024 1e-4 - linear decay to 5% ✓ ✓ ✓ - ✓\\nU-PaLM (540B) 32 2048 1e-4 - cosine ✓ - - - - - -\\nUL2 (20B) 1024 1024 - - inverse square root - - - - - - × - -\\nGLM (130B) 4224 2048 8e-5 ✓ cosine ✓ ✓ ✓ ✓ ✓\\nCodeGen (16B) 2M 2048 5e-5 ✓ cosine ✓ - - - ✓ ✓ -\\nLLaMA (65B) 4M Tokens 2048 1.5e-4 ✓ cosine decay to 10% ✓ - - - ✓ ✓ -\\nPanGu- Σ(1.085T) 512 1024 2e-5 ✓ - ✓ ✓ - - -\\nBloombergGPT (50B) 2048 2048 6e-5 ✓ cosine ✓ ✓ ✓ ✓ ×\\nXuan Yuan 2.0 (176B) 2048 2048 6e-5 ✓ cosine ✓ ✓ ✓ ✓ -\\nCodeT5+ (16B) 2048 1024 2e-4 - linear ✓ ✓ ✓ - -\\nStarCoder (15.5B) 512 8k 3e-4 ✓ cosine ✓ ✓ ✓ - -\\nLLaMA-2 (70B) 4M Tokens 4k 1.5e-4 ✓ cosine ✓ ✓ ✓ ✓ -', metadata={'source': '../docs/llm-research.pdf', 'page': 22}), Document(page_content='PREPRINT 3\\nFig. 3: A broader overview of LLMs, dividing LLMs into five branches: 1. Training 2. Inference 3. Evaluation 4. Applications\\n5. Challenges\\nLLMs literature in surveys [46], [47], [48], [49], and topic-\\nspecific surveys in [50], [51], [52], [53], [54]. In contrast\\nto these surveys, our contribution focuses on providing a\\ncomprehensive yet concise overview of the general direction\\nof LLM research. This article summarizes architectural and\\ntraining details of pre-trained LLMs and delves deeper into\\nthe details of concepts like fine-tuning, multi-modal LLMs,\\nrobotics, augmented LLMs, datasets, evaluation, and others\\nto provide a self-contained comprehensive overview. Our key\\ncontributions are summarized as follows.\\n•We present a survey on the developments in LLM re-\\nsearch with the specific aim of providing a concise yet\\ncomprehensive overview of the direction.\\n•We present extensive summaries of pre-trained models\\nthat include fine-grained details of architecture and train-ing details.\\n•Besides paying special attention to the chronological\\norder of LLMs throughout the article, we also summarize\\nmajor findings of the popular contributions and provide\\ndetailed discussion on the key design and development\\naspects of LLMs to help practitioners to effectively\\nleverage this technology.\\n•In this self-contained article, we cover a range of concepts\\nto comprehend the general direction of LLMs comprehen-\\nsively, including background, pre-training, fine-tuning,\\nrobotics, multi-modal LLMs, augmented LLMs, datasets,\\nevaluation, etc.\\nWe loosely follow the existing terminologies to ensure pro-\\nviding a more standardized outlook of this research direction.\\nFor instance, following [46], our survey discusses pre-trained', metadata={'source': '../docs/llm-research.pdf', 'page': 2}), Document(page_content='PREPRINT 4\\nLLMs with 10B parameters or more. We refer the readers\\ninterested in smaller pre-trained models to [47], [48], [49].\\nThe organization of this paper is as follows. Section II dis-\\ncusses the background of LLMs. Section III focuses on LLMs\\noverview, architectures, training pipelines and strategies, and\\nutilization in different aspects. Section IV presents the key\\nfindings derived from each LLM. Section V highlights the\\nconfiguration and parameters that play a crucial role in the\\nfunctioning of these models. Summary and discussions are\\npresented in section VIII. The LLM training and evaluation,\\ndatasets and benchmarks are discussed in section VI, followed\\nby challenges and future directions and conclusion in sec-\\ntions IX and X, respectively.\\nII. B ACKGROUND\\nWe provide the relevant background to understand the\\nfundamentals related to LLMs in this section. Aligned with\\nour objective of providing a comprehensive overview of this\\ndirection, this section offers a comprehensive yet concise\\noutline of the basic concepts. We focus more on the intuitive\\naspects and refer the readers interested in details to the original\\nworks.\\nA. Tokenization\\nLLMs are trained on text to predict text, and similar to\\nother natural language processing systems, they use tokeniza-\\ntion [55] as the essential preprocessing step. It aims to parse\\nthe text into non-decomposing units called tokens. Tokens\\ncan be characters, subwords [56], symbols [57], or words,\\ndepending on the size and type of the model. Some of the\\ncommonly used tokenization schemes in LLMs are briefed\\nhere. Readers are encouraged to refer to [58] for a detailed\\nsurvey.\\n1. WordPiece [59]: It was introduced in [59] as a novel text\\nsegmentation technique for Japanese and Korean languages to\\nimprove the language model for voice search systems. Word-\\nPiece selects tokens that increase the likelihood of an n-gram-\\nbased language model trained on the vocabulary composed of\\ntokens.\\n2. BPE [57]: Byte Pair Encoding (BPE) has its origin in\\ncompression algorithms. It is an iterative process of generating\\ntokens where pairs of adjacent symbols are replaced by a new\\nsymbol, and the occurrences of the most occurring symbols in\\nthe input text are merged.\\n3. UnigramLM [56]: In this tokenization, a simple unigram\\nlanguage model (LM) is trained using an initial vocabulary\\nofsubword units. The vocabulary is pruned iteratively by\\nremoving the lowest probability items from the list, which\\nare the worst performing on the unigram LM.\\nB. Attention\\nAttention, particularly selective attention , has been widely\\nstudied under perception, psychophysics, and psychology. Se-\\nlective attention can be conceived as “the programming by\\nthe O of which stimuli will be processed or encoded and in\\nwhat order this will occur” [60]. While this definition has itsroots in visual perception, it has uncanny similarities with the\\nrecently formulated attention [61], [62] (which stimuli will\\nbe processed) and positional encoding (in what order this\\nwill occur) [62] in LLMs. We discuss both in sections II-C\\nand II-D, respectively.\\nC. Attention in LLMs\\nThe attention mechanism computes a representation of the\\ninput sequences by relating different positions ( tokens ) of these\\nsequences. There are various approaches to calculating and\\nimplementing attention, out of which some famous types are\\ngiven below.\\n1. Self-Attention [62]: The self-attention is also known as\\nintra-attention since all the queries, keys, and values come\\nfrom the same block (encoder or decoder). The self-attention\\nlayer connects all the sequence positions with O(1)space\\ncomplexity which is highly desirable for learning long-range\\ndependencies in the input.\\n2. Cross Attention: In encoder-decoder architectures, the\\noutputs of the encoder blocks act as the queries to the\\nintermediate representation of the decoder, which provides the\\nkeys and values to calculate a representation of the decoder\\nconditioned on the encoder. This attention is called cross-\\nattention.\\n3. Full Attention: The naive implementation of calculating\\nself-attention is known as full attention.\\n4. Sparse Attention [63]: The self-attention has a time\\ncomplexity of O(n2), which becomes prohibitive when scaling\\nthe LLMs to large context windows. An approximation to the\\nself-attention was proposed in [63], which greatly enhanced\\nthe capacity of GPT series LLMs to process a greater number\\nof input tokens in a reasonable time.\\n5. Flash Attention [64]: The bottleneck for calculating the\\nattention using GPUs lies in the memory access rather than the\\ncomputational speed. Flash Attention uses the classical input\\ntiling approach to process the blocks of the input in GPU on-\\nchip SRAM rather than doing IO for every token from the High\\nBandwith Memory (HBM). An extension of this approach to\\nsparse attention follows the speed gains of the full attention\\nimplementation. This trick allows even greater context-length\\nwindows in the LLMs as compared to those LLMs with sparse\\nattention.\\nD. Encoding Positions\\nTheattention modules do not consider the order of process-\\ning by design. Transformer [62] introduced “positional encod-\\nings” to feed information about the position of the tokens in\\ninput sequences. Several variants of positional encoding have\\nbeen proposed [65], [66]. Interestingly, a recent study [67]\\nsuggests that adding this information may not matter for the\\nstate-of-the-art decoder-only Transformers.\\n1. Absolute: This is the most straightforward approach to\\nadding the sequence order information by assigning a unique\\nidentifier to each position of the sequence before passing it to\\nthe attention module.', metadata={'source': '../docs/llm-research.pdf', 'page': 3})]\n" ] }, { "data": { "text/plain": [ "{'output_text': ' answer is not available in the context'}" ] }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ "answer(\"what are the tokens\")" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "colab": { "background_save": true }, "id": "a8tNUutJB9EA" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Running on local URL: http://127.0.0.1:7861\n", "\n", "To create a public link, set `share=True` in `launch()`.\n" ] }, { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Gradio App\n", "import gradio as gr\n", "\n", "title = \"\"\n", "description = f\"Chat with any docs\"\n", "\n", "def answer_query(message, history):\n", " docs = db.similarity_search(message)\n", " message = agent(\n", " {\"input_documents\":docs, \"question\": message}\n", " ,return_only_outputs=True)\n", " return message['output_text']\n", "\n", "\n", "demo = gr.ChatInterface(\n", " answer_query,\n", " title= title,\n", " description=description,\n", " examples=[\n", " [\"What is a Large Language Model?\"],\n", " [\"What's 9+2-1?\"],\n", " [\"Write Python code to print the Fibonacci sequence\"]\n", " ]\n", ")\n", "\n", "if __name__ == \"__main__\":\n", " demo.queue().launch()\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "colab": { "provenance": [] }, "kernelspec": { "display_name": "Python 3", "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.10.12" } }, "nbformat": 4, "nbformat_minor": 0 }