MaartenGr / MaartenGr/BERTopic

OPENAIBackend has no attribute "encode"

Open
#1,748 1 comment 1 reaction 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

Hi,

I am trying to use 'text-embedding-ada-002' as my embedding model. But i keep getting the error below when i try to run pre-calculated embeddings (it seems like 'encode' does not work with the openai>1.0 library):

---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
[](https://localhost:8080/#) in ()
4 client = openai.OpenAI()
5 embedding_model = OpenAIBackend(client, "text-embedding-ada-002")
----> 6 embeddings = embedding_model.encode(reviews, show_progress_bar=True)

AttributeError: 'OpenAIBackend' object has no attribute 'encode'

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

Start by locating the OpenAIBackend implementation and inspect how its embedding model is expected to expose encode. Reproduce the supplied example with text-embedding-ada-002 and the openai greater-than-1.0 client. Done means pre-calculated embeddings run without the reported AttributeError, with coverage for the affected behavior if tests exist.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.