Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_assistant(name: str, digits: str, first_msg: str, system_prompt: str, tool_server_url: str = "<tool server url placeholder>"):
- today = _get_time_for_gmt_offset(offset_hours=1)
- return {
- "assistant": {
- "name": "server-v0.2.22",
- "firstMessage": first_msg,
- "transcriber": {"provider": "deepgram", "model": "nova-2-general", "language": "en"},
- "model": {
- "provider": "openai",
- "temperature": 1.0,
- "maxTokens": 250,
- "emotionRecognitionEnabled": True,
- "model": "gpt-4o-2024-08-06",
- "messages": [{"role": "system", "content": system_prompt.format(name=name, digits=" ".join(str(digits)), date=today)}],
- "tools": [
- {
- "async": True,
- "messages": [],
- "type": "endCall",
- "function": {
- "name": "gracefulEndCall",
- # description taken from VAPI's own `endCall`
- "description": "Use this function to end the call. Only use it when following instructions that explicitly ask you to use the endCall function. DO NOT call this function unless you are instructed to do so.",
- },
- "server": {
- "timeoutSeconds": 20,
- "url": tool_server_url,
- }
- }
- ],
- },
- "voice": {
- "model": "eleven_turbo_v2",
- "style": 0.1,
- "voiceId": "S9EGwlCtMF7VXtENq79v",
- "provider": "11labs",
- "stability": 1.0,
- "similarityBoost": 0.75,
- "useSpeakerBoost": False,
- "fillerInjectionEnabled": False,
- "optimizeStreamingLatency": 3,
- },
- "recordingEnabled": True,
- "clientMessages": [
- "transcript",
- "hang",
- "function-call",
- "speech-update",
- "metadata",
- "conversation-update",
- ],
- "serverMessages": ["end-of-call-report", "status-update", "phone-call-control", "tool-calls"],
- "voicemailMessage": f"Hey, this is {name}. Could you please call me back when you're free?",
- "endCallPhrases": ["goodbye", "bye"],
- "maxDurationSeconds": 364,
- "silenceTimeoutSeconds": 20,
- "backgroundSound": "office",
- "backchannelingEnabled": False,
- "backgroundDenoisingEnabled": False,
- "modelOutputInMessagesEnabled": False,
- "analysisPlan": {
- "successEvaluationPrompt": "", # this disables the VAPI success evaluation
- },
- "messagePlan": {
- "idleMessages": ["Are you still there?"],
- "idleMessageMaxSpokenCount": 3,
- "idleTimeoutSeconds": 8,
- },
- "startSpeakingPlan": {
- "waitSeconds": 0.2,
- "smartEndpointingEnabled": False,
- "transcriptionEndpointingPlan": {
- "onPunctuationSeconds": 0.1,
- "onNoPunctuationSeconds": 1.5,
- "onNumberSeconds": 0.5
- }
- },
- "stopSpeakingPlan": {
- "numWords": 0,
- "voiceSeconds": 0.2,
- "backoffSeconds": 1
- },
- },
- }
Advertisement
Add Comment
Please, Sign In to add comment