You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
firstMessage: 'Hi there, this is Alex from TechSolutions customer support. How can I help you today?'
102
110
});
103
111
104
-
// Define the system prompt for customer support
105
-
const systemPrompt =`You are Alex, a customer service voice assistant for TechSolutions. Your primary purpose is to help customers resolve issues with their products, answer questions about services, and ensure a satisfying support experience.
106
-
- Sound friendly, patient, and knowledgeable without being condescending
107
-
- Use a conversational tone with natural speech patterns
108
-
- Speak with confidence but remain humble when you don'\''t know something
109
-
- Demonstrate genuine concern for customer issues`;
110
-
111
-
asyncfunction createSupportAssistant() {
112
-
try {
113
-
const assistant =awaitvapi.assistants.create({
114
-
name: 'Customer Support Assistant',
115
-
// Configure the AI model
116
-
model: {
117
-
provider: 'openai',
118
-
model: 'gpt-4o',
119
-
messages: [
120
-
{
121
-
role: 'system',
122
-
content: systemPrompt,
123
-
},
124
-
],
125
-
},
126
-
// Configure the voice
127
-
voice: {
128
-
provider: '11labs',
129
-
voice_id: 'cgSgspJ2msm6clMCkdW9',
130
-
},
131
-
// Set the first message
132
-
firstMessage: 'Hi there, this is Alex from TechSolutions customer support. How can I help you today?',
client = Vapi(token="your-api-key") # Replace with your actual API key
131
+
client = Vapi(token=os.getenv("VAPI_API_KEY"))
164
132
165
-
# Define the system prompt for customer support
166
-
system_prompt ="""You are Alex, a customer service voice assistant for TechSolutions. Your primary purpose is to help customers resolve issues with their products, answer questions about services, and ensure a satisfying support experience.
167
-
- Sound friendly, patient, and knowledgeable without being condescending
168
-
- Use a conversational tone with natural speech patterns
169
-
- Speak with confidence but remain humble when you don't know something
170
-
- Demonstrate genuine concern for customer issues"""
171
-
172
-
defcreate_support_assistant():
173
-
try:
174
-
assistant = client.assistants.create(
175
-
name="Customer Support Assistant",
176
-
# Configure the AI model
177
-
model={
178
-
"provider": "openai",
179
-
"model": "gpt-4o",
180
-
"messages": [
181
-
{
182
-
"role": "system",
183
-
"content": system_prompt,
184
-
}
185
-
],
186
-
},
187
-
# Configure the voice
188
-
voice={
189
-
"provider": "11labs",
190
-
"voice_id": "cgSgspJ2msm6clMCkdW9",
191
-
},
192
-
# Set the first message
193
-
first_message="Hi there, this is Alex from TechSolutions customer support. How can I help you today?",
194
-
)
195
-
196
-
print(f"Assistant created: {assistant.id}")
197
-
return assistant
198
-
exceptExceptionas error:
199
-
print(f"Error creating assistant: {error}")
200
-
raise error
201
-
202
-
# Create the assistant
203
-
create_support_assistant()
133
+
assistant = client.assistants.create(
134
+
name="Customer Support Assistant",
135
+
model={
136
+
"provider": "openai",
137
+
"model": "gpt-4o",
138
+
"messages": [{"role": "system", "content": "You are Alex, a customer service voice assistant for TechSolutions."}],
first_message="Hi there, this is Alex from TechSolutions customer support. How can I help you today?",
142
+
)
143
+
144
+
print(assistant.id)
204
145
```
205
146
</Step>
206
147
</Steps>
@@ -211,24 +152,16 @@ vapi assistant create
211
152
<Steptitle="Create the assistant">
212
153
```bash
213
154
curl -X POST "https://api.vapi.ai/assistant" \
214
-
-H "Authorization: Bearer your-api-key" \
155
+
-H "Authorization: Bearer $VAPI_API_KEY" \
215
156
-H "Content-Type: application/json" \
216
157
-d '{
217
158
"name": "Customer Support Assistant",
218
159
"model": {
219
160
"provider": "openai",
220
161
"model": "gpt-4o",
221
-
"messages": [
222
-
{
223
-
"role": "system",
224
-
"content": "You are Alex, a customer service voice assistant for TechSolutions. Your primary purpose is to help customers resolve issues with their products, answer questions about services, and ensure a satisfying support experience.\n- Sound friendly, patient, and knowledgeable without being condescending\n- Use a conversational tone with natural speech patterns\n- Speak with confidence but remain humble when you don'\''t know something\n- Demonstrate genuine concern for customer issues"
225
-
}
226
-
]
227
-
},
228
-
"voice": {
229
-
"provider": "11labs",
230
-
"voice_id": "cgSgspJ2msm6clMCkdW9"
162
+
"messages": [{ "role": "system", "content": "You are Alex, a customer service voice assistant for TechSolutions." }]
0 commit comments