fix(utils.py): support sagemaker llama2 custom endpoints

This commit is contained in:
Krrish Dholakia 2023-12-05 16:04:43 -08:00
parent 09c2c1610d
commit b4c78c7b9e
4 changed files with 53 additions and 45 deletions

View file

@ -1048,20 +1048,24 @@ def test_completion_sagemaker():
def test_completion_chat_sagemaker():
try:
messages = [{"role": "user", "content": "Hey, how's it going?"}]
print("testing sagemaker")
litellm.set_verbose=True
response = completion(
model="sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b-f",
messages=messages,
max_tokens=100,
stream=True,
)
# Add any assertions here to check the response
print(response)
complete_response = ""
for chunk in response:
print(chunk)
complete_response += chunk.choices[0].delta.content or ""
print(f"complete_response: {complete_response}")
assert len(complete_response) > 0
except Exception as e:
pytest.fail(f"Error occurred: {e}")
# test_completion_chat_sagemaker()
test_completion_chat_sagemaker()
def test_completion_bedrock_titan():
try: