MaartenGr / BERTopic

Leveraging BERT and c-TF-IDF to create easily interpretable topics.
https://maartengr.github.io/BERTopic/
MIT License
5.76k stars 716 forks source link

Mismatch between old OpenAI API in bertopic/backend/_openai and current OpenAI (v1.33.0) #2044

Open abeusher opened 3 weeks ago

abeusher commented 3 weeks ago

Trying a simple import (from bertopic import BERTopic) breaks due to a difference between the old openai API (when the bertopic/backend/_openai was originally written) and the current openai API (version 1.33.0).

I implemented a fix in my own branch of the code here:

https://github.com/abeusher/BERTopic/blob/bugfix/new_openai_api/bertopic/backend/_openai.py

I am happy to provide a pull request when you are ready.

MaartenGr commented 2 weeks ago

Ah yes, it seems that the backend is not yet updated whereas the representation model is.

A PR would be appreciated! Do note though that it needs to take the same structure as the representation model, so passing the entire client and not the API key.