Skip to content
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

Add OpenAI Embeddings Primitive #251

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Add OpenAI Embeddings Primitive #251

wants to merge 5 commits into from

Conversation

jlouns
Copy link

@jlouns jlouns commented Mar 7, 2023

Adds a primitive for natural language logical types that uses the OpenAI Embeddings API to calculate embeddings features.

The model to use is configurable, but text-embedding-ada-002 is used by default.

Adds a primitive for natural language logical types that uses the OpenAI Embeddings API to calculate embeddings features.

The model to use is configurable, but text-embedding-ada-002 is used by default.
@CLAassistant
Copy link

CLAassistant commented Mar 7, 2023

CLA assistant check
All committers have signed the CLA.


def can_fit_in_batch(tokens) -> bool:
return (
len(elements_in_batch) < 2048
Copy link
Contributor

@sbadithe sbadithe Mar 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is 2048 the maximum number of elements per batch?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


# can this element fit in the batch?
if can_fit_in_batch(next_tokens):
# can't fit -- construct a request with existing elements
Copy link
Contributor

@sbadithe sbadithe Mar 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I am misunderstanding this, but does this block cover the case where it can fit?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. Fixed. I need to add tests for all of this to catch stuff like this 😅

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

Successfully merging this pull request may close these issues.

Add OpenAI Embeddings Primitive
4 participants