hot fix litellm import

This commit is contained in:
ishaan-jaff 2023-08-17 11:39:27 -07:00
parent 489a31adb7
commit 32a3b98c0a
2 changed files with 26 additions and 12 deletions

View file

@ -197,16 +197,18 @@ def test_completion_replicate_stability_stream():
except Exception as e: except Exception as e:
pytest.fail(f"Error occurred: {e}") pytest.fail(f"Error occurred: {e}")
def test_completion_replicate_stability(): # def test_completion_replicate_stability():
model_name = "stability-ai/stablelm-tuned-alpha-7b:c49dae362cbaecd2ceabb5bd34fdb68413c4ff775111fea065d259d577757beb" # model_name = "stability-ai/stablelm-tuned-alpha-7b:c49dae362cbaecd2ceabb5bd34fdb68413c4ff775111fea065d259d577757beb"
try: # try:
response = completion(model=model_name, messages=messages, custom_llm_provider="replicate") # response = completion(model=model_name, messages=messages, custom_llm_provider="replicate")
# Add any assertions here to check the response # # Add any assertions here to check the response
for result in response: # print(response)
print(result) # for result in response:
print(response) # print(result)
except Exception as e: # print(response)
pytest.fail(f"Error occurred: {e}") # except Exception as e:
# pytest.fail(f"Error occurred: {e}")
# test_completion_replicate_stability()
######## Test TogetherAI ######## ######## Test TogetherAI ########
def test_completion_together_ai(): def test_completion_together_ai():

View file

@ -73,6 +73,18 @@ class ModelResponse:
def __setitem__(self, key, value): def __setitem__(self, key, value):
setattr(self, key, value) setattr(self, key, value)
def __iter__(self):
return iter(vars(self))
def __str__(self):
result = f"""
{self.choices}\n
{self.created}\n
{self.model}\n
{self.usage}\n
"""
return result
def print_verbose(print_statement): def print_verbose(print_statement):
if litellm.set_verbose: if litellm.set_verbose: