Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whisper API failing with TypeError #83

Closed
dhruvyad opened this issue May 24, 2024 · 2 comments
Closed

Whisper API failing with TypeError #83

dhruvyad opened this issue May 24, 2024 · 2 comments

Comments

@dhruvyad
Copy link

This line is throwing a TypeError:

...
  File "/Users/dhruvyad/miniconda3/envs/42/lib/python3.8/site-packages/groq/_models.py", line 374, in is_basemodel
    return is_basemodel_type(type_)
  File "/Users/dhruvyad/miniconda3/envs/42/lib/python3.8/site-packages/groq/_models.py", line 379, in is_basemodel_type
    return issubclass(origin, BaseModel) or issubclass(origin, GenericModel)
  File "/Users/dhruvyad/miniconda3/envs/42/lib/python3.8/abc.py", line 102, in __subclasscheck__
    return _abc_subclasscheck(cls, subclass)
TypeError: issubclass() arg 1 must be a class

when used for Whisper transcription. It can be fixed if you check that origin is a class:

def is_basemodel_type(type_: Type) -> TypeGuard[Type[BaseModel]]:
    origin = get_origin(type_) or type_
    if not isinstance(origin, type):
        return False
    return issubclass(origin, BaseModel) or issubclass(origin, GenericModel)
@gradenr
Copy link
Collaborator

gradenr commented May 24, 2024

Are you using response_format=text? I am looking into this, and I believe you can work around this issue by using json or verbose_json response format types instead of text.

@gradenr
Copy link
Collaborator

gradenr commented Jul 2, 2024

This was fixed in the latest release (v0.9.0).

@gradenr gradenr closed this as completed Jul 2, 2024
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

No branches or pull requests

2 participants