From 69029d09a755098ea44e1e6ecb0ab900eea032f9 Mon Sep 17 00:00:00 2001 From: Pamela Fox Date: Mon, 2 Dec 2024 19:27:04 +0000 Subject: [PATCH 1/5] Pin all the requirements --- .devcontainer/devcontainer.json | 2 +- .github/workflows/evaluate.yaml | 1 + README.md | 1 + docs/evaluation.md | 1 + requirements-dev.txt | 1 - src/backend/pyproject.toml | 1 + src/backend/requirements.txt | 303 +++++++++++++++++++++++++++++++- 7 files changed, 307 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e95b058..d9f30db 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -17,7 +17,7 @@ "nodeGypDependencies": false }, "ghcr.io/azure/azure-dev/azd:latest": { - "version": "1.10.3" + "version": "1.11.0" }, "ghcr.io/prulloac/devcontainer-features/ollama:1": {}, // az CLI is helpful for being able to login correctly with DefaultAzureCredential: diff --git a/.github/workflows/evaluate.yaml b/.github/workflows/evaluate.yaml index 19152f1..ceb3eeb 100644 --- a/.github/workflows/evaluate.yaml +++ b/.github/workflows/evaluate.yaml @@ -115,6 +115,7 @@ jobs: - name: Install dependencies run: | uv pip install -r requirements-dev.txt + uv pip install -r evals/requirements.txt - name: Install app as editable app run: | diff --git a/README.md b/README.md index 9e90668..ac05221 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,7 @@ Since the local app uses OpenAI models, you should first deploy it for the optim 1. Run these commands to install the web app as a local package (named `fastapi_app`), set up the local database, and seed it with test data: ```bash + python -m pip install -r src/backend/requirements.txt python -m pip install -e src/backend python ./src/backend/fastapi_app/setup_postgres_database.py python ./src/backend/fastapi_app/setup_postgres_seeddata.py diff --git a/docs/evaluation.md b/docs/evaluation.md index de62cee..e2c83b9 100644 --- a/docs/evaluation.md +++ b/docs/evaluation.md @@ -38,6 +38,7 @@ Install all the dependencies for the evaluation script by running the following ```bash pip install -r requirements-dev.txt +pip install -r evals/requirements.txt ``` ## Generate ground truth data diff --git a/requirements-dev.txt b/requirements-dev.txt index e091fa5..e73ac0c 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,4 @@ -r src/backend/requirements.txt --r evals/requirements.txt ruff mypy types-requests diff --git a/src/backend/pyproject.toml b/src/backend/pyproject.toml index 139a48d..f34fba9 100644 --- a/src/backend/pyproject.toml +++ b/src/backend/pyproject.toml @@ -4,6 +4,7 @@ version = "1.0.0" description = "Create a RAG application with FastAPI and PostgreSQL" dependencies = [ "fastapi>=0.111.0,<1.0.0", + "uvicorn>=0.30.1,<1.0.0", "python-dotenv>=1.0.1,<2.0.0", "environs>=11.0.0,<12.0.0", "azure-identity>=1.16.1,<2.0.0", diff --git a/src/backend/requirements.txt b/src/backend/requirements.txt index 5bfba05..cc0c666 100644 --- a/src/backend/requirements.txt +++ b/src/backend/requirements.txt @@ -1 +1,302 @@ -uvicorn>=0.30.1,<1.0.0 +# This file was autogenerated by uv via the following command: +# uv pip compile pyproject.toml -o requirements.txt +aiohappyeyeballs==2.4.4 + # via aiohttp +aiohttp==3.11.9 + # via fastapi-app (pyproject.toml) +aiosignal==1.3.1 + # via aiohttp +annotated-types==0.7.0 + # via pydantic +anyio==4.6.2.post1 + # via + # httpx + # openai + # starlette +asgiref==3.8.1 + # via opentelemetry-instrumentation-asgi +asyncpg==0.30.0 + # via fastapi-app (pyproject.toml) +attrs==24.2.0 + # via aiohttp +azure-core==1.32.0 + # via + # azure-core-tracing-opentelemetry + # azure-identity + # azure-monitor-opentelemetry + # azure-monitor-opentelemetry-exporter + # msrest +azure-core-tracing-opentelemetry==1.0.0b11 + # via azure-monitor-opentelemetry +azure-identity==1.19.0 + # via fastapi-app (pyproject.toml) +azure-monitor-opentelemetry==1.6.3 + # via fastapi-app (pyproject.toml) +azure-monitor-opentelemetry-exporter==1.0.0b32 + # via azure-monitor-opentelemetry +certifi==2024.8.30 + # via + # httpcore + # httpx + # msrest + # requests +cffi==1.17.1 + # via cryptography +charset-normalizer==3.4.0 + # via requests +click==8.1.7 + # via uvicorn +cryptography==44.0.0 + # via + # azure-identity + # msal + # pyjwt +deprecated==1.2.15 + # via + # opentelemetry-api + # opentelemetry-semantic-conventions +distro==1.9.0 + # via openai +environs==11.2.1 + # via fastapi-app (pyproject.toml) +fastapi==0.115.5 + # via fastapi-app (pyproject.toml) +fixedint==0.1.6 + # via azure-monitor-opentelemetry-exporter +frozenlist==1.5.0 + # via + # aiohttp + # aiosignal +greenlet==3.1.1 + # via sqlalchemy +h11==0.14.0 + # via + # httpcore + # uvicorn +httpcore==1.0.7 + # via httpx +httpx==0.28.0 + # via openai +idna==3.10 + # via + # anyio + # httpx + # requests + # yarl +importlib-metadata==8.4.0 + # via + # opentelemetry-api + # opentelemetry-instrumentation-flask +isodate==0.7.2 + # via msrest +jiter==0.8.0 + # via openai +marshmallow==3.23.1 + # via environs +msal==1.31.1 + # via + # azure-identity + # msal-extensions +msal-extensions==1.2.0 + # via azure-identity +msrest==0.7.1 + # via azure-monitor-opentelemetry-exporter +multidict==6.1.0 + # via + # aiohttp + # yarl +numpy==2.1.3 + # via pgvector +oauthlib==3.2.2 + # via requests-oauthlib +openai==1.55.3 + # via + # fastapi-app (pyproject.toml) + # openai-messages-token-helper +openai-messages-token-helper==0.1.10 + # via fastapi-app (pyproject.toml) +opentelemetry-api==1.27.0 + # via + # azure-core-tracing-opentelemetry + # azure-monitor-opentelemetry-exporter + # opentelemetry-instrumentation + # opentelemetry-instrumentation-aiohttp-client + # opentelemetry-instrumentation-asgi + # opentelemetry-instrumentation-dbapi + # opentelemetry-instrumentation-django + # opentelemetry-instrumentation-fastapi + # opentelemetry-instrumentation-flask + # opentelemetry-instrumentation-openai + # opentelemetry-instrumentation-psycopg2 + # opentelemetry-instrumentation-requests + # opentelemetry-instrumentation-sqlalchemy + # opentelemetry-instrumentation-urllib + # opentelemetry-instrumentation-urllib3 + # opentelemetry-instrumentation-wsgi + # opentelemetry-sdk + # opentelemetry-semantic-conventions +opentelemetry-instrumentation==0.48b0 + # via + # opentelemetry-instrumentation-aiohttp-client + # opentelemetry-instrumentation-asgi + # opentelemetry-instrumentation-dbapi + # opentelemetry-instrumentation-django + # opentelemetry-instrumentation-fastapi + # opentelemetry-instrumentation-flask + # opentelemetry-instrumentation-openai + # opentelemetry-instrumentation-psycopg2 + # opentelemetry-instrumentation-requests + # opentelemetry-instrumentation-sqlalchemy + # opentelemetry-instrumentation-urllib + # opentelemetry-instrumentation-urllib3 + # opentelemetry-instrumentation-wsgi +opentelemetry-instrumentation-aiohttp-client==0.48b0 + # via fastapi-app (pyproject.toml) +opentelemetry-instrumentation-asgi==0.48b0 + # via opentelemetry-instrumentation-fastapi +opentelemetry-instrumentation-dbapi==0.48b0 + # via opentelemetry-instrumentation-psycopg2 +opentelemetry-instrumentation-django==0.48b0 + # via azure-monitor-opentelemetry +opentelemetry-instrumentation-fastapi==0.48b0 + # via azure-monitor-opentelemetry +opentelemetry-instrumentation-flask==0.48b0 + # via azure-monitor-opentelemetry +opentelemetry-instrumentation-openai==0.33.9 + # via fastapi-app (pyproject.toml) +opentelemetry-instrumentation-psycopg2==0.48b0 + # via azure-monitor-opentelemetry +opentelemetry-instrumentation-requests==0.48b0 + # via azure-monitor-opentelemetry +opentelemetry-instrumentation-sqlalchemy==0.48b0 + # via fastapi-app (pyproject.toml) +opentelemetry-instrumentation-urllib==0.48b0 + # via azure-monitor-opentelemetry +opentelemetry-instrumentation-urllib3==0.48b0 + # via azure-monitor-opentelemetry +opentelemetry-instrumentation-wsgi==0.48b0 + # via + # opentelemetry-instrumentation-django + # opentelemetry-instrumentation-flask +opentelemetry-resource-detector-azure==0.1.5 + # via azure-monitor-opentelemetry +opentelemetry-sdk==1.27.0 + # via + # azure-monitor-opentelemetry + # azure-monitor-opentelemetry-exporter + # opentelemetry-resource-detector-azure +opentelemetry-semantic-conventions==0.48b0 + # via + # opentelemetry-instrumentation-aiohttp-client + # opentelemetry-instrumentation-asgi + # opentelemetry-instrumentation-dbapi + # opentelemetry-instrumentation-django + # opentelemetry-instrumentation-fastapi + # opentelemetry-instrumentation-flask + # opentelemetry-instrumentation-openai + # opentelemetry-instrumentation-requests + # opentelemetry-instrumentation-sqlalchemy + # opentelemetry-instrumentation-urllib + # opentelemetry-instrumentation-urllib3 + # opentelemetry-instrumentation-wsgi + # opentelemetry-sdk +opentelemetry-semantic-conventions-ai==0.4.2 + # via opentelemetry-instrumentation-openai +opentelemetry-util-http==0.48b0 + # via + # opentelemetry-instrumentation-aiohttp-client + # opentelemetry-instrumentation-asgi + # opentelemetry-instrumentation-django + # opentelemetry-instrumentation-fastapi + # opentelemetry-instrumentation-flask + # opentelemetry-instrumentation-requests + # opentelemetry-instrumentation-urllib + # opentelemetry-instrumentation-urllib3 + # opentelemetry-instrumentation-wsgi +packaging==24.2 + # via + # marshmallow + # opentelemetry-instrumentation-flask + # opentelemetry-instrumentation-sqlalchemy +pgvector==0.3.6 + # via fastapi-app (pyproject.toml) +pillow==11.0.0 + # via openai-messages-token-helper +portalocker==2.10.1 + # via msal-extensions +propcache==0.2.1 + # via + # aiohttp + # yarl +psutil==5.9.8 + # via azure-monitor-opentelemetry-exporter +pycparser==2.22 + # via cffi +pydantic==2.10.2 + # via + # fastapi + # openai +pydantic-core==2.27.1 + # via pydantic +pyjwt==2.10.1 + # via msal +python-dotenv==1.0.1 + # via + # fastapi-app (pyproject.toml) + # environs +regex==2024.11.6 + # via tiktoken +requests==2.32.3 + # via + # azure-core + # msal + # msrest + # requests-oauthlib + # tiktoken +requests-oauthlib==2.0.0 + # via msrest +setuptools==75.6.0 + # via opentelemetry-instrumentation +six==1.16.0 + # via azure-core +sniffio==1.3.1 + # via + # anyio + # openai +sqlalchemy==2.0.36 + # via fastapi-app (pyproject.toml) +starlette==0.41.3 + # via fastapi +tiktoken==0.7.0 + # via + # fastapi-app (pyproject.toml) + # openai-messages-token-helper + # opentelemetry-instrumentation-openai +tqdm==4.67.1 + # via openai +typing-extensions==4.12.2 + # via + # azure-core + # azure-identity + # fastapi + # openai + # opentelemetry-sdk + # pydantic + # pydantic-core + # sqlalchemy +urllib3==2.2.3 + # via requests +uvicorn==0.32.1 + # via fastapi-app (pyproject.toml) +wrapt==1.17.0 + # via + # deprecated + # opentelemetry-instrumentation + # opentelemetry-instrumentation-aiohttp-client + # opentelemetry-instrumentation-dbapi + # opentelemetry-instrumentation-sqlalchemy + # opentelemetry-instrumentation-urllib3 +yarl==1.18.3 + # via aiohttp +zipp==3.21.0 + # via importlib-metadata From b9a8445564ce5a5d93c90a69a4ef7114bfa40036 Mon Sep 17 00:00:00 2001 From: Pamela Fox Date: Mon, 2 Dec 2024 19:36:42 +0000 Subject: [PATCH 2/5] Add rich to requirements for evals --- evals/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/evals/requirements.txt b/evals/requirements.txt index 7559267..0e233e5 100644 --- a/evals/requirements.txt +++ b/evals/requirements.txt @@ -1 +1,2 @@ git+https://github.com/Azure-Samples/ai-rag-chat-evaluator/@installable +rich \ No newline at end of file From a1c5f01a928bcba4e2327be3c806a8f66c152b43 Mon Sep 17 00:00:00 2001 From: Pamela Fox Date: Mon, 2 Dec 2024 20:12:50 +0000 Subject: [PATCH 3/5] Install rich --- .github/workflows/app-tests.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/app-tests.yaml b/.github/workflows/app-tests.yaml index c4a99f7..087ef8a 100644 --- a/.github/workflows/app-tests.yaml +++ b/.github/workflows/app-tests.yaml @@ -94,6 +94,7 @@ jobs: - name: Install dependencies run: | uv pip install -r requirements-dev.txt + uv pip install evals/requirements.txt - name: Install app as editable app run: | From e5e82771d7753a00078eb4bce5fabaaac38c7542 Mon Sep 17 00:00:00 2001 From: Pamela Fox Date: Mon, 2 Dec 2024 20:34:24 +0000 Subject: [PATCH 4/5] Fix install for app-test --- .github/workflows/app-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/app-tests.yaml b/.github/workflows/app-tests.yaml index 087ef8a..c5355f7 100644 --- a/.github/workflows/app-tests.yaml +++ b/.github/workflows/app-tests.yaml @@ -94,7 +94,7 @@ jobs: - name: Install dependencies run: | uv pip install -r requirements-dev.txt - uv pip install evals/requirements.txt + uv pip install -r evals/requirements.txt - name: Install app as editable app run: | From 5823bcf855fb1c0f7bd1304e70905c667461b3e2 Mon Sep 17 00:00:00 2001 From: Pamela Fox Date: Mon, 2 Dec 2024 20:47:41 +0000 Subject: [PATCH 5/5] Compile reqs for Python 3.9 --- src/backend/requirements.txt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/backend/requirements.txt b/src/backend/requirements.txt index cc0c666..efcedb8 100644 --- a/src/backend/requirements.txt +++ b/src/backend/requirements.txt @@ -1,5 +1,5 @@ # This file was autogenerated by uv via the following command: -# uv pip compile pyproject.toml -o requirements.txt +# uv pip compile pyproject.toml -o requirements.txt --python-version 3.9 aiohappyeyeballs==2.4.4 # via aiohttp aiohttp==3.11.9 @@ -15,6 +15,10 @@ anyio==4.6.2.post1 # starlette asgiref==3.8.1 # via opentelemetry-instrumentation-asgi +async-timeout==5.0.1 + # via + # aiohttp + # asyncpg asyncpg==0.30.0 # via fastapi-app (pyproject.toml) attrs==24.2.0 @@ -59,6 +63,8 @@ distro==1.9.0 # via openai environs==11.2.1 # via fastapi-app (pyproject.toml) +exceptiongroup==1.2.2 + # via anyio fastapi==0.115.5 # via fastapi-app (pyproject.toml) fixedint==0.1.6 @@ -105,7 +111,7 @@ multidict==6.1.0 # via # aiohttp # yarl -numpy==2.1.3 +numpy==2.0.2 # via pgvector oauthlib==3.2.2 # via requests-oauthlib @@ -276,14 +282,19 @@ tqdm==4.67.1 # via openai typing-extensions==4.12.2 # via + # anyio + # asgiref # azure-core # azure-identity # fastapi + # multidict # openai # opentelemetry-sdk # pydantic # pydantic-core # sqlalchemy + # starlette + # uvicorn urllib3==2.2.3 # via requests uvicorn==0.32.1