mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 19:54:13 +00:00
add palm stream testing
This commit is contained in:
parent
d1692e89dd
commit
804bfee1a2
1 changed files with 29 additions and 0 deletions
|
@ -398,6 +398,35 @@ def test_completion_claude_stream():
|
||||||
# test_completion_claude_stream()
|
# test_completion_claude_stream()
|
||||||
|
|
||||||
|
|
||||||
|
def test_completion_palm_stream():
|
||||||
|
try:
|
||||||
|
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):
|
||||||
|
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 Exception as e:
|
||||||
|
pytest.fail(f"Error occurred: {e}")
|
||||||
|
# test_completion_palm_stream()
|
||||||
|
|
||||||
|
|
||||||
def test_completion_claude_stream_bad_key():
|
def test_completion_claude_stream_bad_key():
|
||||||
try:
|
try:
|
||||||
api_key = "bad-key"
|
api_key = "bad-key"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue