Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Embedding api not working #53

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

Closed
whaowhao opened this issue Dec 11, 2021 · 3 comments
Closed

Embedding api not working #53

whaowhao opened this issue Dec 11, 2021 · 3 comments
Assignees

Comments

@whaowhao
Copy link

https://beta.openai.com/docs/guides/embeddings/what-are-embeddings documented the newly available embedding api, but the examples are not working:

response = openai.Engine(id="babbage-similarity").embeddings(
    input="Sample document text goes here"
)
embeddings = response['data'][0]['embedding']

This is the error message:


Traceback (most recent call last):
  File "/home/whao/.virtualenv/openai/lib/python3.6/site-packages/openai/openai_object.py", line 96, in __getattr__
    return self[k]
  File "/home/whao/.virtualenv/openai/lib/python3.6/site-packages/openai/openai_object.py", line 136, in __getitem__
    raise err
  File "/home/whao/.virtualenv/openai/lib/python3.6/site-packages/openai/openai_object.py", line 124, in __getitem__
    return super(OpenAIObject, self).__getitem__(k)
KeyError: 'embeddings'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/whao/.virtualenv/openai/lib/python3.6/site-packages/openai/openai_object.py", line 98, in __getattr__
    raise AttributeError(*err.args)
AttributeError: embeddings

@Vagif12
Copy link

Vagif12 commented Dec 15, 2021

I'm facing the same error as @whaowhao, I'm resulted with AttributeError: embeddings when I try to obtain embeddings

@hallacy
Copy link
Collaborator

hallacy commented Dec 15, 2021

Hey @whaowhao,

Thank you for the issue. I can't seem to replicate this problem here. What version of openai are you running?

@hallacy hallacy self-assigned this Dec 15, 2021
@hallacy
Copy link
Collaborator

hallacy commented Dec 23, 2021

I'm going to close this issue for now. Feel free to reopen if you continue to have issues.

@hallacy hallacy closed this as completed Dec 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants