fix palm api is deactivated by google

This commit is contained in:
Ishaan Jaff 2024-08-27 21:08:29 -07:00
parent f4fbe75af3
commit 1b04380540
4 changed files with 0 additions and 135 deletions

View file

@ -4170,45 +4170,6 @@ def test_completion_deepseek():
pytest.fail(f"Error occurred: {e}")
# Palm tests
def test_completion_palm():
litellm.set_verbose = True
model_name = "palm/chat-bison"
messages = [{"role": "user", "content": "Hey, how's it going?"}]
try:
response = completion(model=model_name, messages=messages)
# Add any assertions here to check the response
print(response)
except litellm.APIError as e:
pass
except Exception as e:
pytest.fail(f"Error occurred: {e}")
# test_completion_palm()
# test palm with streaming
def test_completion_palm_stream():
# litellm.set_verbose = True
model_name = "palm/chat-bison"
try:
response = completion(
model=model_name,
messages=messages,
stop=["stop"],
stream=True,
max_tokens=20,
)
# Add any assertions here to check the response
for chunk in response:
print(chunk)
except litellm.APIError as e:
pass
except Exception as e:
pytest.fail(f"Error occurred: {e}")
@pytest.mark.skip(reason="Account deleted by IBM.")
def test_completion_watsonx():
litellm.set_verbose = True

View file

@ -55,22 +55,6 @@
# # test_claude()
# def test_palm():
# try:
# chat = ChatLiteLLM(model="palm/chat-bison", max_tokens=10)
# messages = [
# HumanMessage(
# content="what model are you"
# )
# ]
# resp = chat(messages)
# print(resp)
# except Exception as e:
# pytest.fail(f"Error occurred: {e}")
# # test_palm()
# # def test_openai_with_params():
# # try:

View file

@ -269,49 +269,6 @@ def togetherai_test_completion():
# Palm
def palm_test_completion():
litellm.PalmConfig(max_output_tokens=10, temperature=0.9)
# litellm.set_verbose=True
try:
# OVERRIDE WITH DYNAMIC MAX TOKENS
response_1 = litellm.completion(
model="palm/chat-bison",
messages=[
{
"content": "Hello, how are you? Be as verbose as possible",
"role": "user",
}
],
max_tokens=100,
)
response_1_text = response_1.choices[0].message.content
print(f"response_1_text: {response_1_text}")
# USE CONFIG TOKENS
response_2 = litellm.completion(
model="palm/chat-bison",
messages=[
{
"content": "Hello, how are you? Be as verbose as possible",
"role": "user",
}
],
)
response_2_text = response_2.choices[0].message.content
print(f"response_2_text: {response_2_text}")
assert len(response_2_text) < len(response_1_text)
response_3 = litellm.completion(
model="palm/chat-bison",
messages=[{"content": "Hello, how are you?", "role": "user"}],
n=2,
)
assert len(response_3.choices) > 1
except Exception as e:
pytest.fail(f"Error occurred: {e}")
# palm_test_completion()
# NLP Cloud

View file

@ -709,43 +709,6 @@ async def test_acompletion_claude_2_stream():
pytest.fail(f"Error occurred: {e}")
def test_completion_palm_stream():
try:
litellm.set_verbose = False
print("Streaming palm response")
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{
"role": "user",
"content": "how does a court case get to the Supreme Court?",
},
]
print("testing palm streaming")
response = completion(model="palm/chat-bison", messages=messages, stream=True)
complete_response = ""
# Add any assertions here to check the response
for idx, chunk in enumerate(response):
print(chunk)
# print(chunk.choices[0].delta)
chunk, finished = streaming_format_tests(idx, chunk)
if finished:
break
complete_response += chunk
if complete_response.strip() == "":
raise Exception("Empty response received")
print(f"completion_response: {complete_response}")
except litellm.Timeout as e:
pass
except litellm.APIError as e:
pass
except Exception as e:
pytest.fail(f"Error occurred: {e}")
# test_completion_palm_stream()
@pytest.mark.parametrize(
"sync_mode",
[True, False],