mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
(feat) add async embeddings
This commit is contained in:
parent
34c75b8c0c
commit
6373f6bddd
2 changed files with 31 additions and 0 deletions
|
@ -91,4 +91,20 @@ def test_cohere_embedding():
|
|||
# pytest.fail(f"Error occurred: {e}")
|
||||
# test_hf_embedding()
|
||||
|
||||
# test async embeddings
|
||||
def test_aembedding():
|
||||
import asyncio
|
||||
async def embedding_call():
|
||||
try:
|
||||
response = await litellm.aembedding(
|
||||
model="text-embedding-ada-002",
|
||||
input=["good morning from litellm", "this is another item"]
|
||||
)
|
||||
print(response)
|
||||
except:
|
||||
print(f"error occurred: {traceback.format_exc()}")
|
||||
pass
|
||||
asyncio.run(embedding_call())
|
||||
|
||||
# test_aembedding()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue