File size: 481 Bytes
e7c3249 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import os
from openai import OpenAI
client = OpenAI(
base_url=os.getenv("OPENAI_API_BASE"), api_key=os.getenv("OPENAI_API_KEY")
)
response = client.chat.completions.create(
model=os.getenv("MODEL_NAME"),
messages=[
{
"role": "user",
"content": "Provide me with only the code for a simple python function that sums two numbers.",
},
],
temperature=0.7,
max_tokens=200,
)
print(response.choices[0].message.content)
|