mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
fix OR test
This commit is contained in:
parent
4c2c35ff6a
commit
ab4fd34b01
2 changed files with 17 additions and 10 deletions
|
@ -277,13 +277,21 @@ def completion(
|
||||||
**optional_params
|
**optional_params
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
openrouter_site_url = get_secret("OR_SITE_URL")
|
||||||
|
openrouter_app_name = get_secret("OR_APP_NAME")
|
||||||
|
# if openrouter_site_url is None, set it to https://litellm.ai
|
||||||
|
if openrouter_site_url is None:
|
||||||
|
openrouter_site_url = "https://litellm.ai"
|
||||||
|
# if openrouter_app_name is None, set it to liteLLM
|
||||||
|
if openrouter_app_name is None:
|
||||||
|
openrouter_app_name = "liteLLM"
|
||||||
response = openai.ChatCompletion.create(
|
response = openai.ChatCompletion.create(
|
||||||
model=model,
|
model=model,
|
||||||
messages = messages,
|
messages = messages,
|
||||||
headers =
|
headers =
|
||||||
{
|
{
|
||||||
"HTTP-Referer": os.environ.get("OR_SITE_URL"), # To identify your app
|
"HTTP-Referer": openrouter_site_url, # To identify your site
|
||||||
"X-Title": os.environ.get("OR_APP_NAME")
|
"X-Title": openrouter_app_name # To identify your app
|
||||||
},
|
},
|
||||||
**optional_params
|
**optional_params
|
||||||
)
|
)
|
||||||
|
|
|
@ -87,14 +87,13 @@ def test_completion_openai_with_optional_params():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pytest.fail(f"Error occurred: {e}")
|
pytest.fail(f"Error occurred: {e}")
|
||||||
|
|
||||||
# TODO: Fix this test
|
def test_completion_openrouter():
|
||||||
# def test_completion_openrouter():
|
try:
|
||||||
# try:
|
response = completion(model="google/palm-2-chat-bison", messages=messages, temperature=0.5, top_p=0.1, user="ishaan_dev@berri.ai")
|
||||||
# response = completion(model="google/palm-2-chat-bison", messages=messages, temperature=0.5, top_p=0.1, user="ishaan_dev@berri.ai")
|
# Add any assertions here to check the response
|
||||||
# # Add any assertions here to check the response
|
print(response)
|
||||||
# print(response)
|
except Exception as e:
|
||||||
# except Exception as e:
|
pytest.fail(f"Error occurred: {e}")
|
||||||
# pytest.fail(f"Error occurred: {e}")
|
|
||||||
|
|
||||||
def test_completion_openai_with_more_optional_params():
|
def test_completion_openai_with_more_optional_params():
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue