-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain-personality.py
40 lines (33 loc) · 1 KB
/
main-personality.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from openai import AzureOpenAI
import os
background = (
"You are an expert travel planner with 25+ years of experience. Leverage your expertise to provide recommendations,"
+ "while considering the user's personal interests and preferences."
)
def main():
azure_endpoint = os.environ["AZURE_OPENAI_ENDPOINT"]
azure_deployment = os.environ["AZURE_OPENAI_DEPLOYMENT"]
client = AzureOpenAI(
azure_endpoint=azure_endpoint,
api_version="2024-08-01-preview",
azure_deployment=azure_deployment,
)
user_request = input("How can I help you today? ")
messages = [
{
"role": "system",
"content": background,
},
{
"role": "user",
"content": user_request,
},
]
chat_completion = client.chat.completions.create(
messages=messages,
model="gpt-4o",
stop=["Observation"],
)
print(chat_completion.choices[0].message.content)
if __name__ == "__main__":
main()