MaartenGr / MaartenGr/BERTopic

Can't update model name when use notebook

Open
#2,030 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.8k
Forks
920
Avg merge
22h 24m
Merged PRs (30d)
5

Description

I have a quick question: I use openai embedding to generate the text-embedding. I found I couldn't update the model name unless I restart the jupyter kernal. But it's ok when I switch to python (not jupyter). Here is an example code

```
import openai
from bertopic.backend import OpenAIBackend
client = openai.OpenAI(api_key="sk-xxxxx")
embedding_model = OpenAIBackend(client, 'text-embedding-3-large')
print(embedding_model.embedding_model)
```

Here is screenshot from notebook and python:

notebook:
image

python script:
image
image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The reported entry point is bertopic.backend.OpenAIBackend, demonstrated in the notebook snippet; compare its behavior in Jupyter with the Python script case. Reproduce changing the model name without restarting the kernel, then verify that embedding_model reflects the selected name.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.