mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
fix(bedrock.py): fix embeddings call
This commit is contained in:
parent
be15cf20b9
commit
f1c1ec8523
3 changed files with 6 additions and 5 deletions
|
|
@ -552,8 +552,8 @@ def _embedding_func_single(
|
|||
## FORMAT EMBEDDING INPUT ##
|
||||
provider = model.split(".")[0]
|
||||
inference_params = copy.deepcopy(optional_params)
|
||||
input = input.replace(os.linesep, " ")
|
||||
if provider == "amazon":
|
||||
input = input.replace(os.linesep, " ")
|
||||
data = {"inputText": input, **inference_params}
|
||||
# data = json.dumps(data)
|
||||
elif provider == "cohere":
|
||||
|
|
@ -577,7 +577,7 @@ def _embedding_func_single(
|
|||
try:
|
||||
response = client.invoke_model(
|
||||
body=body,
|
||||
modelId="cohere.embed-multilingual-v3",
|
||||
modelId=model,
|
||||
accept="*/*",
|
||||
contentType="application/json",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -153,6 +153,7 @@ def test_cohere_embedding3():
|
|||
|
||||
def test_bedrock_embedding_titan():
|
||||
try:
|
||||
litellm.set_verbose=True
|
||||
response = embedding(
|
||||
model="amazon.titan-embed-text-v1", input=["good morning from litellm, attempting to embed data",
|
||||
"lets test a second string for good measure"]
|
||||
|
|
@ -160,7 +161,7 @@ def test_bedrock_embedding_titan():
|
|||
print(f"response:", response)
|
||||
except Exception as e:
|
||||
pytest.fail(f"Error occurred: {e}")
|
||||
# test_bedrock_embedding()
|
||||
test_bedrock_embedding_titan()
|
||||
|
||||
def test_bedrock_embedding_cohere():
|
||||
try:
|
||||
|
|
@ -173,7 +174,7 @@ def test_bedrock_embedding_cohere():
|
|||
except Exception as e:
|
||||
pytest.fail(f"Error occurred: {e}")
|
||||
|
||||
test_bedrock_embedding_cohere()
|
||||
# test_bedrock_embedding_cohere()
|
||||
|
||||
# comment out hf tests - since hf endpoints are unstable
|
||||
def test_hf_embedding():
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# #### What this tests ####
|
||||
# # Allow the user to easily run the local proxy server with Gunicorn
|
||||
## LOCAL TESTING ONLY
|
||||
# # LOCAL TESTING ONLY
|
||||
# import sys, os, subprocess
|
||||
# import traceback
|
||||
# from dotenv import load_dotenv
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue