BERTopic 你可以选择将你的安装固定在旧版本上,例如:`pip install openai==0.28`

flvlnr44  于 2个月前  发布在  其他
关注(0)|答案(1)|浏览(28)

when I run this code:
client = openai.OpenAI(api_key="sk-**")
representation_model = OpenAI(client)
umap_model = UMAP(n_neighbors=15,
n_components=5,
min_dist=0.0,
metric='cosine',
random_state=100)
topic_model = BERTopic(umap_model=umap_model, calculate_probabilities=True,
language="multilingual", nr_topics="auto",representation_model=representation_model)
topics, probabilities = topic_model.fit_transform(wordList)
here is a error:
Alternatively, you can pin your installation to the old version, e.g. pip install openai==0.28
but I tried the openai==0.28 Then I found a new error:
AttributeError: module 'openai' has no attribute 'OpenAI'
I want to know what should I do, please.......

xpszyzbs

xpszyzbs1#

你应该使用最新版本的BERTopic和OpenAI,因为OpenAI的包在一段时间前迁移到了1.0版本,而BERTopic的最新版本中已经实现了对此的修复。

相关问题