langchain icon indicating copy to clipboard operation
langchain copied to clipboard

feat: interfaces for async embeddings, implement async openai

Open tyree731 opened this issue 2 years ago • 5 comments

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

tyree731 avatar Jun 13 '23 20:06 tyree731

CC @hwchase17 @dev2049 for review. the _aget_len_safe_embeddings bit is a bit rough, as I couldn't think of a great way to reuse the non-embedding work from _get_len_safe_embeddings, open to suggestions there.

tyree731 avatar Jun 13 '23 20:06 tyree731

Let me know if there is anything I can do to help push this along. I know you're all busy, but just want to make sure there isn't anything on my end holding this up. Also:

  • I wasn’t 100% on where I should be adding more documentation, so if I should be adding more documentation, kindly point me in the right direction there.
  • I added integration tests for openai async embeddings, but if I should be adding tests for fake embeddings async or some such, I can do so.

Thanks!

tyree731 avatar Jun 14 '23 20:06 tyree731

Hi @tyree731 , code looks good -- let's remove the abstractmethod to reduce scope and avoid breaking changes and then code is good to merge.

eyurtsev avatar Jun 15 '23 02:06 eyurtsev

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchain ❌ Failed (Inspect) Jun 16, 2023 1:26am

vercel[bot] avatar Jun 16 '23 01:06 vercel[bot]

Updated based on your comments. Let me know if there's anything I need to do for the vercel failure.

tyree731 avatar Jun 16 '23 01:06 tyree731

Sorry for the delay in responding @hwchase17 , currently on vacation in Germany for the next couple of weeks, so I'll get to your comments when I get back.

tyree731 avatar Jun 21 '23 19:06 tyree731