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

Async request support for Embeddings, with initial support for OpenAI #6109

Closed
tyree731 opened this issue Jun 13, 2023 · 1 comment
Closed

Comments

@tyree731
Copy link
Contributor

Feature request

The proposal here is pretty simple, we add two methods to the Embeddings base class, aembed_documents and aembed_query, allowing for async versions of the equivalent synchronous methods. The first implementation of this would be for OpenAI, since that's a popular embedding API.

Motivation

async is supported within other aspects of langchain, and embeddings are one location where support isn't presently there. For a specific example, in a service my company is currently working on converting to be async, this support would improve the throughput of that support noticeably.

Your contribution

I have a PR in the works that I'll be putting up shortly.

tyree731 added a commit to tyree731/langchain that referenced this issue Jun 13, 2023
This change adds support to the base `Embeddings` class for two
methods, `aembed_query` and `aembed_documents`, those two methods
supporting async equivalents of `embed_query` and
`embed_documents` respectively. This ever so slightly rounds out
async support within langchain, with an initial implementation
of this functionality being implemented for openai.

Implements langchain-ai#6109
hwchase17 pushed a commit that referenced this issue Jun 22, 2023
Since it seems like #6111 will be blocked for a bit, I've forked
@tyree731's fork and implemented the requested changes.

This change adds support to the base Embeddings class for two methods,
aembed_query and aembed_documents, those two methods supporting async
equivalents of embed_query and
embed_documents respectively. This ever so slightly rounds out async
support within langchain, with an initial implementation of this
functionality being implemented for openai.

Implements #6109

---------

Co-authored-by: Stephen Tyree <tyree731@gmail.com>
kacperlukawski pushed a commit to kacperlukawski/langchain that referenced this issue Jun 29, 2023
…ain-ai#6563)

Since it seems like langchain-ai#6111 will be blocked for a bit, I've forked
@tyree731's fork and implemented the requested changes.

This change adds support to the base Embeddings class for two methods,
aembed_query and aembed_documents, those two methods supporting async
equivalents of embed_query and
embed_documents respectively. This ever so slightly rounds out async
support within langchain, with an initial implementation of this
functionality being implemented for openai.

Implements langchain-ai#6109

---------

Co-authored-by: Stephen Tyree <tyree731@gmail.com>
@tyree731
Copy link
Contributor Author

tyree731 commented Jul 3, 2023

This was committed by @BrendanGraham14 and I in #6563, and released in v0.0.209. Closing. Thanks!

@tyree731 tyree731 closed this as completed Jul 3, 2023
aerrober pushed a commit to aerrober/langchain-fork that referenced this issue Jul 24, 2023
…ain-ai#6563)

Since it seems like langchain-ai#6111 will be blocked for a bit, I've forked
@tyree731's fork and implemented the requested changes.

This change adds support to the base Embeddings class for two methods,
aembed_query and aembed_documents, those two methods supporting async
equivalents of embed_query and
embed_documents respectively. This ever so slightly rounds out async
support within langchain, with an initial implementation of this
functionality being implemented for openai.

Implements langchain-ai#6109

---------

Co-authored-by: Stephen Tyree <tyree731@gmail.com>
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

1 participant