From 54215895e8329bbbac8bb5a51f7d225240079be8 Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Fri, 7 Jun 2024 19:44:21 +0200 Subject: [PATCH] Fix openai 1.32 breaking openai tests (#40110) The new openai release adds new required parameter `parallel_tool_calls` and our mock did not have it. Bumping version and adding the parameter should solve the problem. It turned out also that uv==0.2.6 introduced a bug for lowest-direct resolution, so we need to limit it to 0.2.5. Details in https://github.com/astral-sh/uv/issues/4136 GitOrigin-RevId: 65dbf86f72ed7be779e7dadd8e8e57c1216c7c07 --- Dockerfile | 3 ++- Dockerfile.ci | 6 ++++-- airflow/providers/google/provider.yaml | 5 ++--- airflow/providers/openai/provider.yaml | 2 +- contributing-docs/testing/unit_tests.rst | 2 +- generated/provider_dependencies.json | 6 +++--- tests/providers/openai/hooks/test_openai.py | 1 + 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index bb1b1750f9..dc529538be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,7 +50,8 @@ ARG AIRFLOW_VERSION="2.9.1" ARG PYTHON_BASE_IMAGE="python:3.8-slim-bookworm" ARG AIRFLOW_PIP_VERSION=24.0 -ARG AIRFLOW_UV_VERSION=0.2.9 +# until https://github.com/astral-sh/uv/issues/4136 is solved we limit UV to version 0.2.5 +ARG AIRFLOW_UV_VERSION=0.2.5 ARG AIRFLOW_USE_UV="false" ARG UV_HTTP_TIMEOUT="300" ARG AIRFLOW_IMAGE_REPOSITORY="https://github.com/apache/airflow" diff --git a/Dockerfile.ci b/Dockerfile.ci index 29851fd957..cad367c007 100644 --- a/Dockerfile.ci +++ b/Dockerfile.ci @@ -1268,7 +1268,8 @@ ARG DEFAULT_CONSTRAINTS_BRANCH="constraints-main" ARG AIRFLOW_CI_BUILD_EPOCH="10" ARG AIRFLOW_PRE_CACHED_PIP_PACKAGES="true" ARG AIRFLOW_PIP_VERSION=24.0 -ARG AIRFLOW_UV_VERSION=0.2.9 +# until https://github.com/astral-sh/uv/issues/4136 is solved we limit UV to version 0.2.5 +ARG AIRFLOW_UV_VERSION=0.2.5 ARG AIRFLOW_USE_UV="true" # Setup PIP # By default PIP install run without cache to make image smaller @@ -1292,7 +1293,8 @@ ARG AIRFLOW_VERSION="" ARG ADDITIONAL_PIP_INSTALL_FLAGS="" ARG AIRFLOW_PIP_VERSION=24.0 -ARG AIRFLOW_UV_VERSION=0.2.9 +# until https://github.com/astral-sh/uv/issues/4136 is solved we limit UV to version 0.2.5 +ARG AIRFLOW_UV_VERSION=0.2.5 ARG AIRFLOW_USE_UV="true" ENV AIRFLOW_REPO=${AIRFLOW_REPO}\ diff --git a/airflow/providers/google/provider.yaml b/airflow/providers/google/provider.yaml index 8cdf5967f1..2f3af45277 100644 --- a/airflow/providers/google/provider.yaml +++ b/airflow/providers/google/provider.yaml @@ -162,9 +162,8 @@ dependencies: # https://pandas.pydata.org/docs/whatsnew/v2.2.0.html#increased-minimum-versions-for-dependencies # However Airflow not fully supports it yet: https://github.com/apache/airflow/issues/28723 # In addition FAB also limit sqlalchemy to < 2.0 - - pandas>=1.5.3,<2.2;python_version<"3.12" - - pandas>=2.1.1,<2.2;python_version>="3.12" - + - pandas>=1.5.3,<2.2.0;python_version<"3.12" + - pandas>=2.1.1,<2.2.0;python_version>="3.12" # A transient dependency of google-cloud-bigquery-datatransfer, but we # further constrain it since older versions are buggy. - proto-plus>=1.19.6 diff --git a/airflow/providers/openai/provider.yaml b/airflow/providers/openai/provider.yaml index 607730d671..f1caa174bf 100644 --- a/airflow/providers/openai/provider.yaml +++ b/airflow/providers/openai/provider.yaml @@ -43,7 +43,7 @@ integrations: dependencies: - apache-airflow>=2.7.0 - - openai[datalib]>=1.23 + - openai[datalib]>=1.32.0 hooks: - integration-name: OpenAI diff --git a/contributing-docs/testing/unit_tests.rst b/contributing-docs/testing/unit_tests.rst index 3342585b8c..4136e3c5c8 100644 --- a/contributing-docs/testing/unit_tests.rst +++ b/contributing-docs/testing/unit_tests.rst @@ -1272,7 +1272,7 @@ running the tests from there: .. code-block::bash - breeze shell --force-lowest-dependencies + The way it works - when you run the breeze with ``--force-lowest-dependencies`` flag, breeze will use attempt (with the help of ``uv``) to downgrade the dependencies to the lowest version that is compatible diff --git a/generated/provider_dependencies.json b/generated/provider_dependencies.json index 4a2191f6a2..0f9b6d03c7 100644 --- a/generated/provider_dependencies.json +++ b/generated/provider_dependencies.json @@ -635,8 +635,8 @@ "json-merge-patch>=0.2", "looker-sdk>=22.4.0", "pandas-gbq>=0.7.0", - "pandas>=1.5.3,<2.2;python_version<\"3.12\"", - "pandas>=2.1.1,<2.2;python_version>=\"3.12\"", + "pandas>=1.5.3,<2.2.0;python_version<\"3.12\"", + "pandas>=2.1.1,<2.2.0;python_version>=\"3.12\"", "proto-plus>=1.19.6", "python-slugify>=7.0.0", "sqlalchemy-bigquery>=1.2.1", @@ -890,7 +890,7 @@ "openai": { "deps": [ "apache-airflow>=2.7.0", - "openai[datalib]>=1.23" + "openai[datalib]>=1.32.0" ], "devel-deps": [], "plugins": [], diff --git a/tests/providers/openai/hooks/test_openai.py b/tests/providers/openai/hooks/test_openai.py index 374e0f61c9..a4e4cdbbbf 100644 --- a/tests/providers/openai/hooks/test_openai.py +++ b/tests/providers/openai/hooks/test_openai.py @@ -159,6 +159,7 @@ def mock_run(): object="thread.run", created_at=1698107661, assistant_id=ASSISTANT_ID, + parallel_tool_calls=False, thread_id=THREAD_ID, status="completed", started_at=1699073476,