Skip to content

Conversation

@patricklundquist
Copy link
Contributor

Implements an automatic retry mechanism for OpenAI API calls to handle transient httpx.ConnectError exceptions.

  • Adds tenacity as a dependency.
  • Wraps all OpenAI API calls in OpenAIModelClass with a @retry decorator.
  • Configures the retry to happen up to 3 times with exponential backoff on httpx.ConnectError.

Implements an automatic retry mechanism for OpenAI API calls to handle transient `httpx.ConnectError` exceptions.

- Adds `tenacity` as a dependency.
- Wraps all OpenAI API calls in `OpenAIModelClass` with a `@retry` decorator.
- Configures the retry to happen up to 3 times with exponential backoff on `httpx.ConnectError`.
@patricklundquist
Copy link
Contributor Author

@copilot, fix tests

Copy link
Contributor

Copilot AI commented Dec 17, 2025

@patricklundquist I've opened a new pull request, #879, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits December 18, 2025 10:17
…879)

* Initial plan

* Fix tests: Add missing mock methods to MockOpenAIClient

Add models.list(), images.generate(), and embeddings.create() mock methods to MockOpenAIClient to support the retry logic that was added to OpenAIModelClass.

Co-authored-by: patricklundquist <1460278+patricklundquist@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: patricklundquist <1460278+patricklundquist@users.noreply.github.com>
@patricklundquist
Copy link
Contributor Author

@copilot fix per the build test failures

Copy link
Contributor

Copilot AI commented Jan 6, 2026

@patricklundquist I've opened a new pull request, #894, to work on those changes. Once the pull request is ready, I'll request review from you.

patricklundquist and others added 2 commits January 6, 2026 11:12
* Initial plan

* Add httpx dependency for retry logic

httpx is imported in openai_class.py for ConnectError exception but was missing from requirements.txt. This was causing import failures during tests.

Co-authored-by: patricklundquist <1460278+patricklundquist@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: patricklundquist <1460278+patricklundquist@users.noreply.github.com>
@github-actions
Copy link

github-actions bot commented Jan 6, 2026

Code Coverage

Package Line Rate Health
clarifai 45%
clarifai.cli 61%
clarifai.cli.templates 46%
clarifai.client 68%
clarifai.client.auth 67%
clarifai.constants 100%
clarifai.datasets 100%
clarifai.datasets.export 80%
clarifai.datasets.upload 75%
clarifai.datasets.upload.loaders 37%
clarifai.models 100%
clarifai.modules 0%
clarifai.rag 0%
clarifai.runners 53%
clarifai.runners.models 61%
clarifai.runners.pipeline_steps 41%
clarifai.runners.pipelines 77%
clarifai.runners.utils 62%
clarifai.runners.utils.data_types 72%
clarifai.schema 100%
clarifai.urls 60%
clarifai.utils 60%
clarifai.utils.evaluation 67%
clarifai.workflows 95%
Summary 63% (9232 / 14694)

Minimum allowed line rate is 50%

Copy link
Contributor

@ackizilkale ackizilkale left a comment

Choose a reason for hiding this comment

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

looks food

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants