Skip to content

Embedding api not working  #53

@whaowhao

Description

@whaowhao

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions