diff --git a/labs/00-setup/README.md b/labs/00-setup/README.md index 60c3d90..c3131fb 100644 --- a/labs/00-setup/README.md +++ b/labs/00-setup/README.md @@ -34,7 +34,8 @@ You can see above that we have a *completions* model `gpt-35-turbo` and an *embe Make a note of both the deployment name and the model name for each of the two deployments. -5. Finally, we need to update a configuration file in this repo so that the labs are able to make use of your Azure OpenAI service. In the root of this repository, you will see a file named `env.example`. Make a copy of this file in the same location (the root of the repository) and rename the file to `.env` (don't forget the period at the beginning of the filename!) +## Environment Configuration +We need to update a configuration file in this repo so that the labs are able to make use of your Azure OpenAI service. In the root of this repository, you will see a file named `env.example`. Make a copy of this file in the same location (the root of the repository) and rename the file to `.env` (don't forget the period at the beginning of the filename!) Here's a detailed list of what you need to enter into the `.env` file and where to find the information you need to supply. @@ -96,6 +97,6 @@ The final value is the name of the deployment for the embeddings model and can b AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME = "embedding" ``` -6. With all of the above updates to the `.env` file made, make sure you save the file and then you are ready to start the labs. +With all of the above updates to the `.env` file made, make sure you save the file and then you are ready to start the labs. **NOTE**: The `.gitignore` file in this repo is configured to ignore the `.env` file, so the secrets such as the API key will not be uploaded to a public repo. \ No newline at end of file diff --git a/labs/02-integrating-ai/00-PythonModules/pythonmodules.ipynb b/labs/02-integrating-ai/00-PythonModules/pythonmodules.ipynb new file mode 100644 index 0000000..77a6e68 --- /dev/null +++ b/labs/02-integrating-ai/00-PythonModules/pythonmodules.ipynb @@ -0,0 +1,134 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Python Modules\n", + "\n", + "A handful of Python modules are necessary to use the labs in this repo. The module names are listed in the `requirements.txt` file which can be found in the `labs` folder.\n", + "\n", + "Run the below to install the required packages." + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Collecting openai\n", + " Using cached openai-0.27.8-py3-none-any.whl (73 kB)\n", + "Collecting tiktoken\n", + " Downloading tiktoken-0.4.0-cp311-cp311-macosx_11_0_arm64.whl (761 kB)\n", + "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m761.4/761.4 kB\u001b[0m \u001b[31m6.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m[31m6.5 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\n", + "\u001b[?25hCollecting langchain\n", + " Downloading langchain-0.0.250-py3-none-any.whl (1.4 MB)\n", + "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.4/1.4 MB\u001b[0m \u001b[31m7.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m:01\u001b[0m\n", + "\u001b[?25hCollecting python-dotenv\n", + " Using cached python_dotenv-1.0.0-py3-none-any.whl (19 kB)\n", + "Collecting requests\n", + " Using cached requests-2.31.0-py3-none-any.whl (62 kB)\n", + "Collecting tqdm\n", + " Using cached tqdm-4.65.0-py3-none-any.whl (77 kB)\n", + "Collecting aiohttp\n", + " Downloading aiohttp-3.8.5-cp311-cp311-macosx_11_0_arm64.whl (339 kB)\n", + "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m339.6/339.6 kB\u001b[0m \u001b[31m7.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m[31m8.5 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\n", + "\u001b[?25hCollecting regex>=2022.1.18\n", + " Using cached regex-2023.6.3-cp311-cp311-macosx_11_0_arm64.whl (288 kB)\n", + "Collecting PyYAML>=5.4.1\n", + " Downloading PyYAML-6.0.1-cp311-cp311-macosx_11_0_arm64.whl (167 kB)\n", + "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m167.5/167.5 kB\u001b[0m \u001b[31m6.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hCollecting SQLAlchemy<3,>=1.4\n", + " Downloading SQLAlchemy-2.0.19-cp311-cp311-macosx_11_0_arm64.whl (2.0 MB)\n", + "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.0/2.0 MB\u001b[0m \u001b[31m7.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m[31m7.8 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\n", + "\u001b[?25hCollecting dataclasses-json<0.6.0,>=0.5.7\n", + " Downloading dataclasses_json-0.5.14-py3-none-any.whl (26 kB)\n", + "Collecting langsmith<0.1.0,>=0.0.11\n", + " Downloading langsmith-0.0.16-py3-none-any.whl (29 kB)\n", + "Collecting numexpr<3.0.0,>=2.8.4\n", + " Using cached numexpr-2.8.4-cp311-cp311-macosx_11_0_arm64.whl (89 kB)\n", + "Collecting numpy<2,>=1\n", + " Downloading numpy-1.25.2-cp311-cp311-macosx_11_0_arm64.whl (14.0 MB)\n", + "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m14.0/14.0 MB\u001b[0m \u001b[31m8.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0mm eta \u001b[36m0:00:01\u001b[0m[36m0:00:01\u001b[0m\n", + "\u001b[?25hCollecting openapi-schema-pydantic<2.0,>=1.2\n", + " Using cached openapi_schema_pydantic-1.2.4-py3-none-any.whl (90 kB)\n", + "Collecting pydantic<2,>=1\n", + " Downloading pydantic-1.10.12-cp311-cp311-macosx_11_0_arm64.whl (2.5 MB)\n", + "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.5/2.5 MB\u001b[0m \u001b[31m7.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m:01\u001b[0m\n", + "\u001b[?25hCollecting tenacity<9.0.0,>=8.1.0\n", + " Using cached tenacity-8.2.2-py3-none-any.whl (24 kB)\n", + "Collecting charset-normalizer<4,>=2\n", + " Downloading charset_normalizer-3.2.0-cp311-cp311-macosx_11_0_arm64.whl (122 kB)\n", + "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m122.8/122.8 kB\u001b[0m \u001b[31m5.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hCollecting idna<4,>=2.5\n", + " Using cached idna-3.4-py3-none-any.whl (61 kB)\n", + "Collecting urllib3<3,>=1.21.1\n", + " Downloading urllib3-2.0.4-py3-none-any.whl (123 kB)\n", + "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m123.9/123.9 kB\u001b[0m \u001b[31m5.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hCollecting certifi>=2017.4.17\n", + " Downloading certifi-2023.7.22-py3-none-any.whl (158 kB)\n", + "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m158.3/158.3 kB\u001b[0m \u001b[31m7.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hCollecting attrs>=17.3.0\n", + " Using cached attrs-23.1.0-py3-none-any.whl (61 kB)\n", + "Collecting multidict<7.0,>=4.5\n", + " Using cached multidict-6.0.4-cp311-cp311-macosx_11_0_arm64.whl (29 kB)\n", + "Collecting async-timeout<5.0,>=4.0.0a3\n", + " Using cached async_timeout-4.0.2-py3-none-any.whl (5.8 kB)\n", + "Collecting yarl<2.0,>=1.0\n", + " Using cached yarl-1.9.2-cp311-cp311-macosx_11_0_arm64.whl (61 kB)\n", + "Collecting frozenlist>=1.1.1\n", + " Downloading frozenlist-1.4.0-cp311-cp311-macosx_11_0_arm64.whl (46 kB)\n", + "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m46.7/46.7 kB\u001b[0m \u001b[31m2.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hCollecting aiosignal>=1.1.2\n", + " Using cached aiosignal-1.3.1-py3-none-any.whl (7.6 kB)\n", + "Collecting marshmallow<4.0.0,>=3.18.0\n", + " Downloading marshmallow-3.20.1-py3-none-any.whl (49 kB)\n", + "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m49.4/49.4 kB\u001b[0m \u001b[31m3.3 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 typing-extensions>=4.2.0\n", + " Downloading typing_extensions-4.7.1-py3-none-any.whl (33 kB)\n", + "Requirement already satisfied: packaging>=17.0 in /Users/mark/repos/intro-to-intelligent-apps/.venv/lib/python3.11/site-packages (from marshmallow<4.0.0,>=3.18.0->dataclasses-json<0.6.0,>=0.5.7->langchain->-r ../../requirements.txt (line 3)) (23.1)\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, tqdm, tenacity, regex, PyYAML, python-dotenv, numpy, mypy-extensions, multidict, marshmallow, idna, frozenlist, charset-normalizer, certifi, attrs, async-timeout, yarl, typing-inspect, SQLAlchemy, requests, pydantic, numexpr, aiosignal, tiktoken, openapi-schema-pydantic, langsmith, dataclasses-json, aiohttp, openai, langchain\n", + "Successfully installed PyYAML-6.0.1 SQLAlchemy-2.0.19 aiohttp-3.8.5 aiosignal-1.3.1 async-timeout-4.0.2 attrs-23.1.0 certifi-2023.7.22 charset-normalizer-3.2.0 dataclasses-json-0.5.14 frozenlist-1.4.0 idna-3.4 langchain-0.0.250 langsmith-0.0.16 marshmallow-3.20.1 multidict-6.0.4 mypy-extensions-1.0.0 numexpr-2.8.4 numpy-1.25.2 openai-0.27.8 openapi-schema-pydantic-1.2.4 pydantic-1.10.12 python-dotenv-1.0.0 regex-2023.6.3 requests-2.31.0 tenacity-8.2.2 tiktoken-0.4.0 tqdm-4.65.0 typing-extensions-4.7.1 typing-inspect-0.9.0 urllib3-2.0.4 yarl-1.9.2\n", + "\n", + "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.0.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.2.1\u001b[0m\n", + "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", + "Note: you may need to restart the kernel to use updated packages.\n" + ] + } + ], + "source": [ + "pip install -r ../../requirements.txt" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": ".venv", + "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.11.4" + }, + "orig_nbformat": 4 + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/labs/requirements.txt b/labs/requirements.txt index 2f80c16..6ed651b 100644 --- a/labs/requirements.txt +++ b/labs/requirements.txt @@ -1,4 +1,5 @@ openai tiktoken langchain -python-dotenv \ No newline at end of file +python-dotenv +requests \ No newline at end of file