litellm/openai-proxy/tests/test_openrouter.py
2023-10-21 15:59:35 -07:00

38 lines
No EOL
773 B
Python

import openai
openai.api_base = "http://0.0.0.0:8000"
openai.api_key = "this can be anything"
print("making request")
api_key = ""
response = openai.ChatCompletion.create(
model = "openrouter/google/palm-2-chat-bison",
messages = [
{
"role": "user",
"content": "this is a test message, what model / llm are you"
}
],
api_key=api_key,
max_tokens = 10,
)
print(response)
response = openai.ChatCompletion.create(
model = "openrouter/google/palm-2-chat-bison",
messages = [
{
"role": "user",
"content": "this is a test message, what model / llm are you"
}
],
api_key=api_key,
max_tokens = 10,
stream=True
)
for chunk in response:
print(chunk)