mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
support for later embeddings
This commit is contained in:
parent
342b83544f
commit
0cb4816ab2
3 changed files with 61 additions and 22 deletions
|
@ -6,7 +6,7 @@ import os
|
|||
|
||||
sys.path.insert(0, os.path.abspath('../..'))
|
||||
|
||||
from litellm import completion
|
||||
from litellm import completion, embedding
|
||||
import litellm
|
||||
|
||||
litellm.success_callback = ["llmonitor"]
|
||||
|
@ -15,10 +15,23 @@ litellm.failure_callback = ["llmonitor"]
|
|||
litellm.set_verbose = True
|
||||
|
||||
# openai call
|
||||
first_success_test = completion(model="gpt-3.5-turbo",
|
||||
messages=[{
|
||||
"role": "user",
|
||||
"content": "Hi 👋 - i'm openai"
|
||||
}])
|
||||
# first_success_test = completion(model="gpt-3.5-turbo",
|
||||
# messages=[{
|
||||
# "role": "user",
|
||||
# "content": "Hi 👋 - i'm openai"
|
||||
# }])
|
||||
|
||||
print(first_success_test)
|
||||
# print(first_success_test)
|
||||
|
||||
|
||||
def test_embedding_openai():
|
||||
try:
|
||||
response = embedding(model="text-embedding-ada-002", input=['test'])
|
||||
# Add any assertions here to check the response
|
||||
print(f"response: {str(response)[:50]}")
|
||||
except Exception as e:
|
||||
print(e)
|
||||
# pytest.fail(f"Error occurred: {e}")
|
||||
|
||||
|
||||
test_embedding_openai()
|
Loading…
Add table
Add a link
Reference in a new issue