-
Notifications
You must be signed in to change notification settings - Fork 338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyLLM seems to use OpenAI parameters that are deprecated #187
Comments
Ah, that is correct! It seems that openai has updated their package with some breaking changes. Perhaps if you set openai to 0.28, it might just work. I'll make sure to update the backend so that it works with their newest release. That likely will introduce a breaking change since I want to only support openai>1. |
@lfoppiano I just pushed a fix to #189, if you have the time. Could you check whether it works for you? |
Hi, I cant seem to get it to work. I've installed keybert and openai as follows:
The versions are:
I've subsequently run the following:
However, I end up with the following error:
Reading the help documentation for OpenAI with
This would suggest that the error received is correct as I thought the fix applied works for openai >1.0 ? On the other hand, if I try the following:
I end up with the following error instead
What am I doing wrong? |
@adegboyegaFAU You are not using the fix. To install the fix, you should run the following instead: pip install -U git+https://github.com/MaartenGr/KeyBERT@openai_fix |
Works now! Thanks @MaartenGr. I'd actually previously tried that from @lfoppiano's post on fix #189 and it didn't work. Turns out that what I didn't do after uninstalling keybert then was to restart anaconda. I really do love the tool by the way. Great work |
@MaartenGr any estimate on when this fix will be released? |
@lfoppiano I just pushed the fix to the main branch, an official release will follow either this or next week. |
Great, thanks! |
@MaartenGr the fix is not yet released, right? |
@lfoppiano Can you provide a minimal working example? I am running into problems when using openai LLM for keyword generation. openai.api_key = os.getenv('OPENAI_API_KEY')
llm = OpenAI(
client = openai,
model = "gpt-3.5-turbo-instruct",
prompt = "Summarize the following text of keywords with a maximum of 5 keywords: \n\n-",
chat = False,
verbose = False,
)
kw_model_2 = KeyLLM(llm)
year = 2010
texts_to_process = unique_keywords_2[year]
topics = kw_model_2.extract_keywords(texts_to_process)
|
@fabmeyer I use the I assembled an example from the code I've used (disclaimer: I did not test it): client = openai.OpenAI()
chatgpt = OpenAI(client, model="gpt-3.5-turbo", chat=True)
kw_model = KeyLLM(llm=chatgpt)
model = SentenceTransformer('all-MiniLM-L6-v2')
abstracts = [work['abstract'] if 'abstract' in work and work['abstract'] is not None else "" for work in
works]
embeddings_abstracts = model.encode(abstracts, convert_to_tensor=True)
keywords_abstracts = kw_model.extract_keywords(abstracts, embeddings=embeddings_abstracts, threshold=0.5) |
Ah right, I should definitely release an official version. Let me work on it for a bit and I'll let you know when I release 0.8.4. |
Apologies for the late delay (and thanks for the ping)! I just pushed 0.8.4 to PyPI, so all changes to the main branch should now be in the official release. |
First of all, this tool is amazing :-)
I'm trying to use keyLLM using OpenAI API, but when I import the OpenAI module from keybert, I cannot not noticed that the default parameters look having quite old defaults, something like "gpt-3.5-instruct".
The code is something like this:
When trying following your instructions I get a deprecation error:
here the libraries versions:
Thank you in advance
The text was updated successfully, but these errors were encountered: