adding anthropic llm class - handles sync + stream

This commit is contained in:
Krrish Dholakia 2023-08-12 16:34:32 -07:00
parent e6da2f8bf7
commit bc767cc42a
27 changed files with 219 additions and 693 deletions

View file

@ -28,31 +28,32 @@ except:
# test on non-openai completion call
try:
response = completion(model="claude-instant-1", messages=messages, logger_fn=logger_fn)
print(f"claude response: {response}")
score +=1
except:
print(f"error occurred: {traceback.format_exc()}")
pass
# test on openai embedding call
try:
response = embedding(model='text-embedding-ada-002', input=[user_message], logger_fn=logger_fn)
score +=1
except:
traceback.print_exc()
# # test on openai embedding call
# try:
# response = embedding(model='text-embedding-ada-002', input=[user_message], logger_fn=logger_fn)
# score +=1
# except:
# traceback.print_exc()
# test on bad azure openai embedding call -> missing azure flag and this isn't an embedding model
try:
response = embedding(model='chatgpt-test', input=[user_message], logger_fn=logger_fn)
except:
score +=1 # expect this to fail
traceback.print_exc()
# # test on bad azure openai embedding call -> missing azure flag and this isn't an embedding model
# try:
# response = embedding(model='chatgpt-test', input=[user_message], logger_fn=logger_fn)
# except:
# score +=1 # expect this to fail
# traceback.print_exc()
# test on good azure openai embedding call
try:
response = embedding(model='azure-embedding-model', input=[user_message], azure=True, logger_fn=logger_fn)
score +=1
except:
traceback.print_exc()
# # test on good azure openai embedding call
# try:
# response = embedding(model='azure-embedding-model', input=[user_message], azure=True, logger_fn=logger_fn)
# score +=1
# except:
# traceback.print_exc()
print(f"Score: {score}, Overall score: {score/5}")
# print(f"Score: {score}, Overall score: {score/5}")