Skip to content

Commit 58f9589

Browse files
authored
New features (#81)
* f * Checking in * Checking in
1 parent 812062e commit 58f9589

File tree

3 files changed

+165
-0
lines changed

3 files changed

+165
-0
lines changed

assistants/call-analysis.mdx

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
---
2+
title: "Call Analysis"
3+
sidebarTitle: "Call Analysis"
4+
description: "At the end of the call, you can summarize and evaluate how it went."
5+
---
6+
7+
The Call Analysis feature allows you to summarize and evaluate calls, providing valuable insights into their effectiveness. This feature uses a combination of prompts and schemas to generate structured data and success evaluations based on the call's content.
8+
9+
You can customize the below in the assistant's `assistant.analysisPlan`.
10+
11+
## Summary Prompt
12+
13+
The summary prompt is used to create a concise summary of the call. This summary is stored in `call.analysis.summary`.
14+
15+
### Default Summary Prompt
16+
17+
The default summary prompt is:
18+
19+
```text
20+
You are an expert note-taker. You will be given a transcript of a call. Summarize the call in 2-3 sentences, if applicable.
21+
```
22+
23+
### Customizing the Summary Prompt
24+
25+
You can customize the summary prompt by setting the `summaryPrompt` property in the API or SDK:
26+
27+
```json
28+
{
29+
"summaryPrompt": "Custom summary prompt text"
30+
}
31+
```
32+
33+
To disable the summary prompt, set it to an empty string `""` or `"off"`:
34+
35+
```json
36+
{
37+
"summaryPrompt": ""
38+
}
39+
```
40+
41+
## Structured Data Prompt
42+
43+
The structured data prompt extracts specific pieces of data from the call. This data is stored in `call.analysis.structuredData`.
44+
45+
### Default Structured Data Prompt
46+
47+
The default structured data prompt is:
48+
49+
```text
50+
You are an expert data extractor. You will be given a transcript of a call. Extract structured data per the JSON Schema.
51+
```
52+
53+
### Customizing the Structured Data Prompt
54+
55+
You can set a custom structured data prompt using the `structuredDataPrompt` property:
56+
57+
```json
58+
{
59+
"structuredDataPrompt": "Custom structured data prompt text"
60+
}
61+
```
62+
63+
## Structured Data Schema
64+
65+
The structured data schema enforces the format of the extracted data. It is defined using JSON Schema standards.
66+
67+
### Customizing the Structured Data Schema
68+
69+
You can set a custom structured data schema using the `structuredDataSchema` property:
70+
71+
```json
72+
{
73+
"structuredDataSchema": {
74+
"type": "object",
75+
"properties": {
76+
"field1": { "type": "string" },
77+
"field2": { "type": "number" }
78+
},
79+
"required": ["field1", "field2"]
80+
}
81+
}
82+
```
83+
84+
## Success Evaluation Prompt
85+
86+
The success evaluation prompt is used to determine if the call was successful. This evaluation is stored in `call.analysis.successEvaluation`.
87+
88+
### Default Success Evaluation Prompt
89+
90+
The default success evaluation prompt is:
91+
92+
```text
93+
You are an expert call evaluator. You will be given a transcript of a call and the system prompt of the AI participant. Determine if the call was successful based on the objectives inferred from the system prompt.
94+
```
95+
96+
### Customizing the Success Evaluation Prompt
97+
98+
You can set a custom success evaluation prompt using the `successEvaluationPrompt` property:
99+
100+
```json
101+
{
102+
"successEvaluationPrompt": "Custom success evaluation prompt text"
103+
}
104+
```
105+
106+
To disable the success evaluation prompt, set it to an empty string `""` or `"off"`:
107+
108+
```json
109+
{
110+
"successEvaluationPrompt": ""
111+
}
112+
```
113+
114+
## Success Evaluation Rubric
115+
116+
The success evaluation rubric defines the criteria used to evaluate the call's success. The available rubrics are:
117+
118+
- `NumericScale`: A scale of 1 to 10.
119+
- `DescriptiveScale`: A scale of Excellent, Good, Fair, Poor.
120+
- `Checklist`: A checklist of criteria and their status.
121+
- `Matrix`: A grid that evaluates multiple criteria across different performance levels.
122+
- `PercentageScale`: A scale of 0% to 100%.
123+
- `LikertScale`: A scale of Strongly Agree, Agree, Neutral, Disagree, Strongly Disagree.
124+
- `AutomaticRubric`: Automatically break down evaluation into several criteria, each with its own score.
125+
- `PassFail`: A simple 'true' if the call passed, 'false' if not.
126+
127+
### Customizing the Success Evaluation Rubric
128+
129+
You can set a custom success evaluation rubric using the `successEvaluationRubric` property:
130+
131+
```json
132+
{
133+
"successEvaluationRubric": "NumericScale"
134+
}
135+
```
136+
137+
## Combining Prompts and Rubrics
138+
139+
You can use prompts and rubrics in combination to create detailed instructions for the call analysis:
140+
141+
```json
142+
{
143+
"successEvaluationPrompt": "Evaluate the call based on these criteria:...",
144+
"successEvaluationRubric": "Checklist"
145+
}
146+
```
147+
148+
By customizing these properties, you can tailor the call analysis to meet your specific needs and gain valuable insights from your calls.

mint.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@
156156
"assistants/custom-llm",
157157
"assistants/persistent-assistants",
158158
"assistants/dynamic-variables",
159+
"assistants/call-analysis",
159160
"assistants/background-messages"
160161
]
161162
},
@@ -345,6 +346,14 @@
345346
"source": "/dynamic-variables",
346347
"destination": "/assistants/dynamic-variables"
347348
},
349+
{
350+
"source": "/call_analysis",
351+
"destination": "/assistants/call-analysis"
352+
},
353+
{
354+
"source": "/call-analysis",
355+
"destination": "/assistants/call-analysis"
356+
},
348357
{
349358
"source": "/text_message",
350359
"destination": "/assistants/background-messages"

sdk/web.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ vapi.setMuted(true);
142142
vapi.isMuted(); // true
143143
```
144144

145+
### `say(message: string, endCallAfterSpoken?: boolean)`
146+
147+
The `say` method can be used to invoke speech and gracefully terminate the call if needed
148+
149+
```javascript
150+
vapi.say("Our time's up, goodbye!", true)
151+
```
152+
145153
## Events
146154

147155
You can listen on the `vapi` instance for events. These events allow you to react to changes in the state of the call or user speech.

0 commit comments

Comments
 (0)