Skip to content

fix: pin openai>=1.100.0 so poetry install works with camel-ai 0.2.90 - #234

Open
bean-1129 wants to merge 1 commit into
camel-ai:mainfrom
bean-1129:fix/openai-lock-pin
Open

bean-1129 wants to merge 1 commit into
camel-ai:mainfrom
bean-1129:fix/openai-lock-pin

Conversation

@bean-1129

Copy link
Copy Markdown

Problem

A fresh poetry install on a clean checkout of main produces an environment where import oasis fails:

ImportError: cannot import name 'ChatCompletionMessageFunctionToolCall' from 'openai.types.chat'

camel-ai==0.2.90 imports that symbol, which only exists in openai>=1.100.0, but camel-ai still declares openai>=1.86.0. Our poetry.lock therefore pinned openai==1.91.0, which satisfies camel-ai's constraint but breaks at import time.

CI doesn't catch this because the workflow uses pip install -e ., which ignores poetry.lock and resolves the latest openai. Only contributors following the documented Poetry setup in CONTRIBUTING.md hit it.

Reproduce (on main)

git clone https://github.com/camel-ai/oasis.git && cd oasis
poetry env use python3.11 && poetry install
poetry run python -c "import oasis"

Fix

  • Add an explicit openai = ">=1.100.0" constraint in pyproject.toml with a comment explaining why (camel-ai's declared minimum is too low).
  • Update poetry.lock to openai==3.16.2, the same version CI resolves and passes with today. Transitive changes are limited to what openai 3.x requires: anyio, jiter, idna bumps, and the new httpx2 / httpcore2 / truststore packages. distro is dropped as it is no longer a dependency of openai. Nothing else in the lock changed.

Verified

  • Clean poetry sync from the new lock installs and import oasis succeeds.
  • All 30 tests that do not require a model key pass. The four that fail locally are the ones that need OPENAI_API_KEY, which is the pre-existing situation.
  • pre-commit run --all-files passes.

Related: #220 (dependency bumps; this PR is intentionally narrow and only touches the openai constraint so it can land independently).

🤖 Generated with Claude Code

camel-ai 0.2.90 imports `ChatCompletionMessageFunctionToolCall` from
`openai.types.chat`, which only exists in openai>=1.100.0, but camel-ai
still declares `openai>=1.86.0`. Our poetry.lock pinned openai 1.91.0, so
a fresh `poetry install` on a clean checkout produced an environment
where `import oasis` fails:

    ImportError: cannot import name 'ChatCompletionMessageFunctionToolCall'
    from 'openai.types.chat'

CI did not catch this because it uses `pip install -e .`, which ignores
the lock file and resolves the latest openai.

Add an explicit `openai = ">=1.100.0"` constraint and update the lock to
openai 3.16.2, the same version CI currently resolves and passes with.
Transitive changes are limited to what openai 3.x requires (anyio, jiter,
idna, and the new httpx2/httpcore2/truststore packages).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

@echo-yiyiyi echo-yiyiyi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR @bean-1129. Could you please also add the test for this problem?

@echo-yiyiyi

Copy link
Copy Markdown
Member

In addition, I am planning to move poetry to uv for packages managing (see #229), feel free to test this version for this issue.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants