Arvind
04/21/2025, 9:33 PMraise Exception(f"Failed to start conversation: {response.text}")
And below is my current code:
import asyncio
import pyaudio
import wave
import os
from vapi_python.vapi_python import Vapi
def main():
# Initialize VAPI with your API key
vapi = Vapi(api_key='')
# Configure the pizza shop assistant
assistant = {
'firstMessage': 'Thank you for calling Vappys Pizza! How can I help you today?',
'context': '''You are an employee at a pizza shop.
Menu:
Pizzas:
- Margherita ($10)
- Pepperoni ($12)
- Veggie Supreme ($13)
Sides:
- Garlic Bread ($4)
- Chicken Wings ($8)
Drinks:
- Soda ($2)
- Water ($1)
Be friendly, confirm orders clearly, and ask for delivery address if needed.
Estimate 30-40 minutes for delivery, 15-20 for pickup.''',
'model': 'gpt-4',
'voice': 'jennifer-playht',
'recordingEnabled': True,
'interruptionsEnabled': True
}
print(":pizza: Starting Pizza Shop Assistant...")
print("Press Ctrl+C to end the conversation")
try:
# Start the conversation
vapi.start(assistant=assistant)
# This will keep the conversation going until manually stopped
input("Press Enter to end the conversation...")
except KeyboardInterrupt:
print("\n:wave: Ending conversation...")
finally:
vapi.stop()
if __name__ == "__main__":
main()