Skip to content

AttributeError: 'ZeroShotGPTClassifier' object has no attribute 'key' #93

@AndreasKarasenko

Description

@AndreasKarasenko

I was trying to work on #55 a bit and ran into some other issues.
Calling any GPT classifier like below raises errors for key and org.

clf = ZeroShotGPTClassifier(model="gpt-3.5-turbo")
clf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'ZeroShotGPTClassifier' object has no attribute 'org'

Expected behavior:

clf
ZeroShotGPTClassifier()

The likely cause is how you handle the key and org. You define key and org attributes in the ZeroShotGPTClassifier innit but then set them using _set_keys from the GPTMixin. GPTMixin, however creates 2 new attributes called openai_key and openai_org, the original attributes are never set.
The same issue arrises with FewShot, Dynamic and GPTVectorizer.

The easiest fix would be to do some refactoring in the GPTMixin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions