-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
40 lines (29 loc) · 1023 Bytes
/
main.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
import asyncio
from semantic_kernel import Kernel
from semantic_kernel.connectors.ai.open_ai import (
AzureChatCompletion,
AzureChatPromptExecutionSettings,
)
from semantic_kernel.contents.chat_history import ChatHistory
from settings import ApplicationSettings
app_settings = ApplicationSettings()
kernel = Kernel()
chat_completion = AzureChatCompletion(
api_key=app_settings.api_key,
deployment_name=app_settings.deployment_name,
endpoint=app_settings.endpoint,
)
kernel.add_service(chat_completion)
async def main():
history = ChatHistory(
system_message="You're a digital chef help me cook. Your name is Flora."
)
history.add_user_message("Hi, I'd like a nice recipe for a french style apple pie")
execution_settings = AzureChatPromptExecutionSettings(
max_token=2500, temperature=0.6, top_p=0.98
)
response = await chat_completion.get_chat_message_content(
history, execution_settings
)
print(response.content)
asyncio.run(main())