Skip to content

Idea: Use array type for embedding speed-up #2059

Closed
@pamelafox

Description

@pamelafox

Confirm this is a feature request for the Python library and not the underlying OpenAI API.

  • This is a feature request for the Python library

Describe the feature or improvement you're requesting

The SDK currently uses numpy to speed up embedding:

            embedding.embedding = np.frombuffer(  # type: ignore[no-untyped-call]
                base64.b64decode(data), dtype="float32"
            ).tolist()

It does seem to improve performance, based on our tests, but we were wondering if similar gains could be made without numpy, using the built-in array type? Have you tried that already?

https://docs.python.org/3/library/array.html

We're having some pains with the numpy dependency for our Azure samples and are looking for ways to move off it without affecting performance.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions