Summary prompt with dynamic variables
# support
s
Hey, could you help me out? I'm trying to refine my analysis prompt. I want something like this: Parse the following survey transcript and generate four tables in markdown format. Extract only the relevant answers, ignoring any introductory conversation. Also, include today's date without the time. Transcript: [Call Summary or Transcript Here] Date: {{now}} Campaign: {{assistantName}} Phone number: {{caller.phoneNumber}} Output: - Date: (date) - Campaign: (campaign name) - Phone number: (customer number) - Zip Code: (zip code) - Drive from plant: (time in minutes) Is there a way to dynamically insert the assistant’s name and caller’s phone number like this?
v
Hi there! 👋 Yes, I can help you with dynamically inserting variables into your analysis prompt! Based on the information I found, you can definitely use dynamic variables like {{now}} in your prompt. For the assistant's name, you can use {{assistantName}}, but for the caller's phone number, you should use {{customer.number}} instead of {{caller.phoneNumber}}. Here's how you can refine your analysis prompt:
Copy code
**Parse the following survey transcript and generate four tables in markdown format. Extract only the relevant answers, ignoring any introductory conversation. Also, include today's date without the time.**  

**Transcript:**  
[Call Summary or Transcript Here]  
**Date:** {{now | date: "MMMM D, YYYY"}}  
**Campaign:** {{assistantName}}  
**Phone number:** {{customer.number}}  

**Output:**  
- **Date:** (date)  
- **Campaign:** (campaign name)  
- **Phone number:** (customer number)  
- **Zip Code:** (zip code)  
- **Drive from plant:** (time in minutes)
According to the [Vapi documentation on dynamic variables](https://docs.vapi.ai/assistants/dynamic-variables), you can use double curly braces
{{variableName}}
to insert dynamic variables into your prompts. For the date formatting, I've included a more specific format using LiquidJS syntax:
{{now | date: "MMMM D, YYYY"}}
which will display just the date without the time, as you requested. This is based on the [recommended simplified syntax for date formatting](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1336772166330351646). For the assistant's name, {{assistantName}} can be defined with a type and name, for example:
"type": "assistant", "assistantName": "DUI - Outbound"
as mentioned in the [Vapi documentation](https://docs.vapi.ai/knowledgebase).
For the phone number, Vapi uses {{customer.number}} as the default variable that represents the customer's phone number according to the [dynamic variables documentation](https://docs.vapi.ai/assistants/dynamic-variables). Is there anything else you'd like to know about using dynamic variables in your analysis prompt? Sources: - [Vapi documentation on dynamic variables](https://docs.vapi.ai/assistants/dynamic-variables) - [Recommended simplified syntax for date formatting](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1336772166330351646) - [Vapi documentation](https://docs.vapi.ai/knowledgebase)
v
Message marked as helpful by @Michael Lasso! 🎉
s
@Shubham Bajaj is that correct?
p
VAPI supports variable insertion using curly braces with the appropriate variable names: For your specific use case: \-
{{now}}
would insert the current date and time \-
{{assistant.name}}
would insert the assistant's name (note the correct syntax) \-
{{caller.phoneNumber}}
would insert the caller's phone number as you have it Here's how your refined prompt could look: \`\`\` Parse the following survey transcript and generate four tables in markdown format. Extract only the relevant answers, ignoring any introductory conversation. Also, include today's date without the time. Transcript: \[Call Summary or Transcript Here\] Date: {{now}} Campaign: {{[assistant.name](http://assistant.name)}} Phone number: {{caller.phoneNumber}} Output: Date: {{now format="YYYY-MM-DD"}} Campaign: {{[assistant.name](http://assistant.name)}} Phone number: {{caller.phoneNumber}} Zip Code: \[Extracted from transcript\] Drive from plant: \[Extracted from transcript\] \`\`\` The key changes I made: 1\. Changed
{{assistantName}}
to
{{assistant.name}}
which is the correct variable syntax for accessing the assistant's name 2\. Added a format specifier to the date variable
{{now format="YYYY-MM-DD"}}
to show only the date without time 3\. Left placeholders for information that would be extracted from the transcript
s
tks
p
Checking if this is resolved for you, so I can mark this ticket to be solved.
s
Hey Yeah It's resolved Tks
3 Views