Skip to content

Commit

Permalink
Fix openai 1.32 breaking openai tests (apache#40110)
Browse files Browse the repository at this point in the history
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 astral-sh/uv#4136
  • Loading branch information
potiuk authored and romsharon98 committed Jul 26, 2024
1 parent 8c020e1 commit 40d6873
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 4 additions & 2 deletions Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}\
Expand Down
5 changes: 2 additions & 3 deletions airflow/providers/google/provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion airflow/providers/openai/provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ integrations:

dependencies:
- apache-airflow>=2.7.0
- openai[datalib]>=1.23
- openai[datalib]>=1.32.0

hooks:
- integration-name: OpenAI
Expand Down
2 changes: 1 addition & 1 deletion contributing-docs/testing/unit_tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions generated/provider_dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -890,7 +890,7 @@
"openai": {
"deps": [
"apache-airflow>=2.7.0",
"openai[datalib]>=1.23"
"openai[datalib]>=1.32.0"
],
"devel-deps": [],
"plugins": [],
Expand Down
1 change: 1 addition & 0 deletions tests/providers/openai/hooks/test_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 40d6873

Please sign in to comment.