Spaces:
Sleeping
Sleeping
File size: 713 Bytes
7b3952c e21a5f5 7b3952c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
from openai import OpenAI
# If runnning this service with proxy, you might need to unset `http(s)_proxy`.
base_url = "https://maas.hikvision.com.cn/v1"
api_key = "sk-20f1cbcdae0e4b789ee06923c201d6a8"
client = OpenAI(base_url=base_url, api_key=api_key)
response = client.chat.completions.create(
model="gpt-oss-120b",
messages=[
{
"role": "user",
"content": "what is your model",
}
],
stream=True,
)
for chunk in response:
if chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="", flush=True)
elif chunk.choices[0].finish_reason == "stop":
print()
else:
pass |