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.......
1条答案
按热度按时间xpszyzbs1#
你应该使用最新版本的BERTopic和OpenAI,因为OpenAI的包在一段时间前迁移到了1.0版本,而BERTopic的最新版本中已经实现了对此的修复。