-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenai-integration.py
35 lines (26 loc) · 1.11 KB
/
openai-integration.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
from promptix import Promptix
import openai
def main():
client = openai.OpenAI()
# New prepare_model_config example that returns model config
print("Using prepare_model_config:")
memory = [
{"role": "user", "content": "I'm having trouble resetting my password"},
{"role": "assistant", "content": "I understand you're having password reset issues. Could you tell me what happens when you try?"}
]
model_config = Promptix.prepare_model_config(
prompt_template="CustomerSupport",
user_name="John Doe",
issue_type="password reset",
technical_level="intermediate",
interaction_history="2 previous tickets about 2FA setup",
product_version="2.1.0",
issue_description="User is unable to reset their password after multiple attempts",
custom_data={"product_version": "2.1.0", "subscription_tier": "standard"},
memory=memory,
)
response = client.chat.completions.create(**model_config)
print("Model Config:", model_config)
print("\nResponse:", response)
if __name__ == "__main__":
main()