Fix Model upload#606
Merged
luv-bansal merged 3 commits intomasterfrom May 28, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR addresses a bug related to model uploads by refactoring how the OpenAI model client and model are accessed.
- In clarifai/runners/models/openai_class.py, the class attributes have been renamed and adjusted for error handling.
- In clarifai/runners/models/model_class.py, additional checks have been introduced in the model method registration to skip mocked objects.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| clarifai/runners/models/openai_class.py | Renames attributes and updates error handling in the init method |
| clarifai/runners/models/model_class.py | Adds additional filtering for methods, skipping mocked objects |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR standardizes the naming of the OpenAI client and model attributes, ensures mock objects are skipped when registering model methods, and publishes a new patch version.
- Renamed
openai_client➔clientandmodel_name➔modelin both implementation and tests - Enhanced
_register_model_methodsto filter outMagicMockinstances - Bumped package version to 11.4.6 and updated the CHANGELOG
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| clarifai/runners/models/openai_class.py | Renamed class attributes and updated __init__ to handle fallback logic |
| clarifai/runners/models/model_class.py | Imported MagicMock and added filtering in _register_model_methods |
| clarifai/runners/models/dummy_openai_model.py | Updated subclass to use client/model attributes |
| tests/runners/test_openai_model.py | Updated tests to reference client instead of openai_client |
| tests/runners/test_model_classes.py | Updated tests to reference client instead of openai_client |
| tests/openai_model_test.py | Updated tests to reference client instead of openai_client |
| clarifai/init.py | Bumped version from 11.4.5 to 11.4.6 |
| CHANGELOG.md | Added release notes for version 11.4.6 |
Comments suppressed due to low confidence (3)
clarifai/runners/models/openai_class.py:30
- Add a test for the fallback branch where
client.models.list()raises an exception, ensuring aNotImplementedErroris raised with the correct message.
if self.model is None:
clarifai/runners/models/model_class.py:9
- [nitpick] Avoid importing
unittest.mockin production code; consider relocating mock filtering logic into test utilities or a test-only module.
from unittest.mock import MagicMock
clarifai/runners/models/model_class.py:351
- [nitpick] The check for
classmethod/staticmethoddescriptors may not behave as intended; consider usinginspect.isfunctionorinspect.ismethodto more accurately identify methods.
if not callable(method) or isinstance(method, (classmethod, staticmethod)):
Minimum allowed line rate is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixing the Model upload!!!
Before getting error
This PR standardizes the naming of the OpenAI client and model attributes, ensures mock objects are skipped when registering model methods, and publishes a new patch version.
Renamed openai_client ➔ client and model_name ➔ model in both implementation and tests
Enhanced _register_model_methods to filter out MagicMock instances
Bumped package version to 11.4.6 and updated the CHANGELOG