mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
updates
This commit is contained in:
parent
a156fa1e1f
commit
b9ee1b38f6
8 changed files with 45 additions and 19 deletions
|
@ -22,6 +22,32 @@ def logger_fn(model_call_object: dict):
|
|||
user_message = "Hello, how are you?"
|
||||
messages = [{"content": user_message, "role": "user"}]
|
||||
|
||||
# test on openai completion call
|
||||
try:
|
||||
response = completion(
|
||||
model="gpt-3.5-turbo", messages=messages, stream=True, logger_fn=logger_fn
|
||||
)
|
||||
for chunk in response:
|
||||
print(chunk["choices"][0]["delta"])
|
||||
score += 1
|
||||
except:
|
||||
print(f"error occurred: {traceback.format_exc()}")
|
||||
pass
|
||||
|
||||
|
||||
# test on azure completion call
|
||||
try:
|
||||
response = completion(
|
||||
model="azure/chatgpt-test", messages=messages, stream=True, logger_fn=logger_fn
|
||||
)
|
||||
for chunk in response:
|
||||
print(chunk["choices"][0]["delta"])
|
||||
score += 1
|
||||
except:
|
||||
print(f"error occurred: {traceback.format_exc()}")
|
||||
pass
|
||||
|
||||
|
||||
# test on anthropic completion call
|
||||
try:
|
||||
response = completion(
|
||||
|
@ -35,19 +61,19 @@ except:
|
|||
pass
|
||||
|
||||
|
||||
# test on anthropic completion call
|
||||
try:
|
||||
response = completion(
|
||||
model="meta-llama/Llama-2-7b-chat-hf",
|
||||
messages=messages,
|
||||
custom_llm_provider="huggingface",
|
||||
custom_api_base="https://s7c7gytn18vnu4tw.us-east-1.aws.endpoints.huggingface.cloud",
|
||||
stream=True,
|
||||
logger_fn=logger_fn,
|
||||
)
|
||||
for chunk in response:
|
||||
print(chunk["choices"][0]["delta"])
|
||||
score += 1
|
||||
except:
|
||||
print(f"error occurred: {traceback.format_exc()}")
|
||||
pass
|
||||
# # test on huggingface completion call
|
||||
# try:
|
||||
# response = completion(
|
||||
# model="meta-llama/Llama-2-7b-chat-hf",
|
||||
# messages=messages,
|
||||
# custom_llm_provider="huggingface",
|
||||
# custom_api_base="https://s7c7gytn18vnu4tw.us-east-1.aws.endpoints.huggingface.cloud",
|
||||
# stream=True,
|
||||
# logger_fn=logger_fn,
|
||||
# )
|
||||
# for chunk in response:
|
||||
# print(chunk["choices"][0]["delta"])
|
||||
# score += 1
|
||||
# except:
|
||||
# print(f"error occurred: {traceback.format_exc()}")
|
||||
# pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue