Skip to content

get_embedding openai python sdk call fails on the embedding_billsum.ipynb demo notebook #8

@azeltov

Description

@azeltov

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [x] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

when running this line of code in embedding_billsum.ipynb demo notebook:

df_bills['curie_search'] = df_bills["text"].apply(lambda x : get_embedding(x, engine = 'text-search-curie-doc-001'))

you get this error:

Output exceeds the [size limit](command:workbench.action.openSettings?[). Open the full output data [in a text editor](command:workbench.action.openLargeOutput?019d3119-f490-4b95-a671-e8d08d3d0e84)
---------------------------------------------------------------------------
InvalidRequestError                       Traceback (most recent call last)
File ~/miniconda3/envs/openai/lib/python3.8/site-packages/tenacity/__init__.py:409, in Retrying.__call__(self, fn, *args, **kwargs)
    408 try:
--> 409     result = fn(*args, **kwargs)
    410 except BaseException:  # noqa: B902

File ~/miniconda3/envs/openai/lib/python3.8/site-packages/openai/embeddings_utils.py:23, in get_embedding(text, engine)
     21 text = text.replace("\n", " ")
---> 23 return openai.Embedding.create(input=[text], engine=engine)["data"][0]["embedding"]

File ~/miniconda3/envs/openai/lib/python3.8/site-packages/openai/api_resources/embedding.py:33, in Embedding.create(cls, *args, **kwargs)
     32 try:
---> 33     response = super().create(*args, **kwargs)
     35     # If a user specifies base64, we'll just return the encoded string.
     36     # This is only for the default case.

File ~/miniconda3/envs/openai/lib/python3.8/site-packages/openai/api_resources/abstract/engine_api_resource.py:153, in EngineAPIResource.create(cls, api_key, api_base, api_type, request_id, api_version, organization, **params)
    138 (
    139     deployment_id,
    140     engine,
   (...)
    150     api_key, api_base, api_type, api_version, organization, **params
    151 )
--> 153 response, _, api_key = requestor.request(
...
--> 363     raise retry_exc from fut.exception()
    365 if self.wait:
    366     sleep = self.wait(retry_state=retry_state)

RetryError: RetryError[<Future at 0x7fb1e21f3f70 state=finished raised InvalidRequestError>]

image

Any log messages given by the failure

Expected/desired behavior

no errors

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)
macos

Versions

python 3.8

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Metadata

Metadata

Assignees

No one assigned

    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