-
Notifications
You must be signed in to change notification settings - Fork 358
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 error: AttributeError: 'str' object has no attribute 'completions' #223
Comments
There might be a fix for this in the main branch. Could you install keybert using the latest commit? It might resolve your issue. Also, make sure to install the latest version of |
Hi, Would you please share the latest commit of keybert? I am trying pip install -U keybert command . Thanks |
You can find more information about how to install it here: https://stackoverflow.com/questions/13685920/install-specific-git-commit-with-pip |
Still getting the error: AttributeError: 'str' object has no attribute 'completions'. I tried with !pip install git+https://github.com/MaartenGr/KeyBERT.git |
Which version of |
Hi, I have used the latest version of OpenAI but I am getting same error. I have a query regarding Efficient LLM in https://maartengr.github.io/KeyBERT/guides/keyllm.html#3-fine-tune-candidate-keywords. You mentioned, if two texts appear together in a cluster, then two texts will have the same keywords. It implies the keywords of text1 can be used as the keywords for the text2? Is it feasible for all cases? |
@anonimoustt After installing the latest version of
It depends on your definition of "all cases". Having said that, in my experience this works as long as you define properly (through clustering thresholds) when you consider two texts to be similar enough. |
Hi, here is link of google colab code: https://colab.research.google.com/drive/16LbHeLs93Re-sA9kgMHqAPsa3A79KQvB?usp=sharing AttributeError: 'str' object has no attribute 'completions' |
Ah, it seems that the documentation should be updated. You should pass a import openai
from keybert.llm import OpenAI
from keybert import KeyLLM
# Create your LLM
client = openai.OpenAI(api_key=MY_API_KEY)
llm = OpenAI(client)
# Load it in KeyLLM
kw_model = KeyLLM(llm) |
I was trying to run the following code from your GitHub but got the following error:
import openai
from keybert.llm import OpenAI
from keybert import KeyLLM
from sentence_transformers import SentenceTransformer
Extract embeddings
model = SentenceTransformer('all-MiniLM-L6-v2')
embeddings = model.encode(documents, convert_to_tensor=True)
Create your LLM
openai.api_key = "sk..."#
llm = OpenAI(openai.api_key)
Load it in KeyLLM
kw_model = KeyLLM(llm)
Extract keywords
keywords = kw_model.extract_keywords(documents, embeddings=embeddings, threshold=.75)
AttributeError: 'str' object has no attribute 'completions'
The text was updated successfully, but these errors were encountered: