Skip to content

Commit db957b1

Browse files
committed
Merge remote-tracking branch 'origin/main' into fern/update-api-specs
2 parents a877a76 + 5fbf064 commit db957b1

File tree

6 files changed

+215
-49
lines changed

6 files changed

+215
-49
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Update Trieve
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.head_ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
12+
jobs:
13+
run:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Install Trieve Fern Adapter
20+
run: npm install -g trieve-fern-adapter
21+
22+
- name: Update Trieve Chunks
23+
env:
24+
TRIEVE_API_HOST: ${{ secrets.TRIEVE_API_HOST }}
25+
TRIEVE_API_KEY: ${{ secrets.TRIEVE_API_KEY }}
26+
TRIEVE_ORGANIZATION_ID: ${{ secrets.TRIEVE_ORGANIZATION_ID }}
27+
TRIEVE_DATASET_TRACKING_ID: ${{ secrets.TRIEVE_DATASET_TRACKING_ID }}
28+
run: trieve-fern-adapter --file fern/docs.yml -s https://api.vapi.ai/api-json -r https://docs.vapi.ai -a api-reference

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
**/.definition
22
**/.preview/**
3+
.env

fern/assets/styles.css

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -155,20 +155,3 @@
155155
.fern-theme-default.fern-container .fern-sidebar-container {
156156
background-color: light-dark(#fffaea, #0e0e13);
157157
}
158-
159-
/* BUTTONS */
160-
.fern-button:not([disabled]).filled.primary {
161-
background-color: light-dark(#09090b, #fffaea);
162-
}
163-
164-
.fern-button.filled.primary .fern-button-text {
165-
color: light-dark(#ffffff, #09090b);
166-
}
167-
168-
.fern-button.filled.primary:not([disabled]) .fa-icon {
169-
background-color: light-dark(#ffffff, #09090b);
170-
}
171-
172-
.fern-button:not([disabled]).filled.primary:hover {
173-
background-color: light-dark(#09090b, #fffaea);
174-
}

fern/assets/trieve-user-script.js

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
// ==UserScript==
2+
// @name Vapi
3+
// @namespace http://tampermonkey.net/
4+
// @version 2025-01-16
5+
// @description try to take over the world!
6+
// @author You
7+
// @match https://docs.vapi.ai/*
8+
// @icon https://www.google.com/s2/favicons?sz=64&domain=vapi.ai
9+
// @grant none
10+
// ==/UserScript==
11+
12+
const removeAllClickListeners = (element) => {
13+
const newElement = element.cloneNode(true);
14+
element.parentNode.replaceChild(newElement, element);
15+
return newElement;
16+
};
17+
18+
const makeDefaultSearchTrieve = async () => {
19+
let defaultSearchBar = null;
20+
let retries = 0;
21+
while (!defaultSearchBar && retries < 10) {
22+
for (const el of document.querySelectorAll("*")) {
23+
if (el.querySelector('[aria-label="Search"]')) {
24+
defaultSearchBar = el.querySelector('[aria-label="Search"]');
25+
break;
26+
}
27+
}
28+
retries++;
29+
await new Promise((resolve) => setTimeout(resolve, 10));
30+
}
31+
defaultSearchBar = removeAllClickListeners(defaultSearchBar);
32+
33+
defaultSearchBar.onclick = () => {
34+
const event = new CustomEvent("trieve-open-with-text", {
35+
detail: { text: "" },
36+
});
37+
window.dispatchEvent(event);
38+
};
39+
};
40+
await makeDefaultSearchTrieve();
41+
setTimeout(makeDefaultSearchTrieve, 50);
42+
setTimeout(makeDefaultSearchTrieve, 100);
43+
setTimeout(makeDefaultSearchTrieve, 250);
44+
setTimeout(makeDefaultSearchTrieve, 500);
45+
setTimeout(makeDefaultSearchTrieve, 1000);
46+
setTimeout(makeDefaultSearchTrieve, 2000);
47+
setTimeout(makeDefaultSearchTrieve, 3000);
48+
49+
(async function () {
50+
"use strict";
51+
const link = document.createElement("link");
52+
link.rel = "stylesheet";
53+
link.href = "https://cdn.trieve.ai/beta/search-component/index.css";
54+
document.head.appendChild(link);
55+
56+
import("https://cdn.trieve.ai/beta/search-component/vanilla/index.js").then(
57+
async (module) => {
58+
const { renderToDiv } = module;
59+
const root = document.createElement("div");
60+
root.classList.add("trigger");
61+
document.body.appendChild(root);
62+
const colorScheme = document.documentElement?.style?.colorScheme;
63+
const brandColor = colorScheme === "dark" ? "#47ffb6d5" : "#00551dcd";
64+
65+
renderToDiv(root, {
66+
apiKey: "tr-hZMKSsTf3ML9hJbAAqPO8K91p9IVe9Oc",
67+
datasetId: "d3493dc0-2b5c-4c6e-a8ee-b18feeed5b06",
68+
baseUrl: "https://api.trieve.ai",
69+
type: "docs",
70+
analytics: true,
71+
theme: colorScheme === "dark" ? "dark" : null,
72+
brandLogoImgSrcUrl:
73+
"https://storage.googleapis.com/organization-image-assets/vapi-botAvatarDarkSrcUrl-1709929110474.png",
74+
brandName: "Vapi",
75+
brandColor: brandColor,
76+
placeholder: "How can I help?",
77+
defaultSearchQueries: ["quickstart", "assistant", "tools"],
78+
defaultAiQuestions: [
79+
"What voices are supported?",
80+
"What languages are supported?",
81+
"How do I connect a custom LLM?",
82+
"How do I fetch the prompt dynamically?",
83+
],
84+
defaultSearchMode: "search",
85+
showFloatingButton: "true",
86+
cssRelease: "none",
87+
hideOpenButton: true,
88+
});
89+
},
90+
(error) => {
91+
console.error("Failed to load module:", error);
92+
}
93+
);
94+
})();

fern/call-forwarding.mdx

Lines changed: 91 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ title: Call Forwarding
33
slug: call-forwarding
44
---
55

6-
76
Vapi's call forwarding functionality allows you to redirect calls to different phone numbers based on specific conditions using tools. This guide explains how to set up and use the `transferCall` function for call forwarding.
87

98
## Key Concepts
@@ -53,17 +52,11 @@ The `transferCall` tool includes a list of destinations and corresponding messag
5352
"properties": {
5453
"destination": {
5554
"type": "string",
56-
"enum": [
57-
"+1234567890",
58-
"+0987654321",
59-
"+1122334455"
60-
],
55+
"enum": ["+1234567890", "+0987654321", "+1122334455"],
6156
"description": "The destination to transfer the call to."
6257
}
6358
},
64-
"required": [
65-
"destination"
66-
]
59+
"required": ["destination"]
6760
}
6861
},
6962
"messages": [
@@ -106,6 +99,19 @@ The `transferCall` tool includes a list of destinations and corresponding messag
10699
}
107100
```
108101

102+
You can also specify the `extension` parameter to forward the call to an extension.
103+
104+
```json
105+
"destinations": [
106+
{
107+
"type": "number",
108+
"number": "+1234567890",
109+
"extension": "4603",
110+
"message": "I am forwarding your call to Department A. Please stay on the line."
111+
}
112+
]
113+
```
114+
109115
### 2. Using the `transferCall` Function
110116

111117
When the assistant needs to forward a call, it uses the `transferCall` function with the appropriate destination:
@@ -119,7 +125,6 @@ When the assistant needs to forward a call, it uses the `transferCall` function
119125
}
120126
}
121127
}
122-
123128
```
124129

125130
### 3. Customizing Messages
@@ -142,7 +147,6 @@ Customize the messages for each destination to provide clear information to the
142147
}
143148
]
144149
}
145-
146150
```
147151

148152
## Instructing the Assistant
@@ -176,12 +180,13 @@ To implement a warm transfer, add a `transferPlan` object to the `transferCall`
176180

177181
In this mode, Vapi provides a summary of the call to the recipient before transferring.
178182

179-
* **Configuration:**
180-
* Set the `mode` to `"warm-transfer-with-summary"`.
181-
* Define a `summaryPlan` specifying how the summary should be generated.
182-
* Use the `{{transcript}}` variable to include the call transcript.
183+
- **Configuration:**
184+
185+
- Set the `mode` to `"warm-transfer-with-summary"`.
186+
- Define a `summaryPlan` specifying how the summary should be generated.
187+
- Use the `{{transcript}}` variable to include the call transcript.
183188

184-
* **Example:**
189+
- **Example:**
185190

186191
```json
187192
"transferPlan": {
@@ -204,14 +209,15 @@ In this mode, Vapi provides a summary of the call to the recipient before transf
204209

205210
#### 2. Warm Transfer with Message
206211

207-
In this mode, Vapi delivers a custom static message to the recipient before transferring the call.
212+
In this mode, Vapi delivers a custom message to the recipient before transferring the call.
213+
214+
- **Configuration:**
208215

209-
* **Configuration:**
210-
* Set the `mode` to `"warm-transfer-with-message"`.
211-
* Provide the custom message in the `message` property.
212-
* Note that the `{{transcript}}` variable is not available in this mode.
216+
- Set the `mode` to `"warm-transfer-with-message"`.
217+
- Provide the custom message in the `message` property.
218+
- Note that the `{{transcript}}` variable is not available in this mode.
213219

214-
* **Example:**
220+
- **Example:**
215221

216222
```json
217223
"transferPlan": {
@@ -259,17 +265,69 @@ Here is a full example of a `transferCall` payload using the warm transfer with
259265
}
260266
```
261267

262-
#### 3. Warm Transfer with TwiML
268+
#### 3. Warm Transfer with Wait and Say Message
269+
270+
In this mode, Vapi waits for the recipient to speak first and then delivers a custom message to the recipient before transferring the call.
271+
272+
- **Configuration:**
273+
274+
- Set the `mode` to `"warm-transfer-wait-for-operator-to-speak-first-and-then-say-message"`.
275+
- Provide the custom message in the `message` property.
276+
- Note that the `{{transcript}}` variable is not available in this mode.
277+
278+
- **Example:**
279+
280+
```json
281+
"transferPlan": {
282+
"mode": "warm-transfer-wait-for-operator-to-speak-first-and-then-say-message",
283+
"message": "Hey, this call has been forwarded through Vapi."
284+
}
285+
```
286+
287+
#### 4. Warm Transfer with Wait and Say Summary
288+
289+
In this mode, Vapi waits for the recipient to speak first and then delivers a summary of the call to the recipient before transferring the call.
290+
291+
- **Configuration:**
292+
293+
- Set the `mode` to `"warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary"`.
294+
- Define a `summaryPlan` specifying how the summary should be generated.
295+
- Use the `{{transcript}}` variable to include the call transcript.
296+
297+
- **Example:**
298+
299+
```json
300+
"transferPlan": {
301+
"mode": "warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary",
302+
"summaryPlan": {
303+
"enabled": true,
304+
"messages": [
305+
{
306+
"role": "system",
307+
"content": "Please provide a summary of the call."
308+
},
309+
{
310+
"role": "user",
311+
"content": "Here is the transcript:\n\n{{transcript}}\n\n"
312+
}
313+
]
314+
}
315+
}
316+
```
317+
318+
#### 5. Warm Transfer with TwiML
263319

264320
In this mode, Vapi executes TwiML instructions on the destination call leg before connecting the destination number.
265321

266-
* **Configuration:**
267-
* Set the `mode` to `"warm-transfer-with-twiml"`.
268-
* Provide the TwiML instructions in the `twiml` property.
269-
* Supports only `Play`, `Say`, `Gather`, `Hangup`, and `Pause` verbs.
270-
* Maximum TwiML length is 4096 characters.
322+
- **Configuration:**
271323

272-
* **Example:**
324+
- Set the `mode` to `"warm-transfer-with-twiml"`.
325+
- Provide the TwiML instructions in the `twiml` property.
326+
- Supports only `Play`, `Say`, `Gather`, and `Pause` verbs.
327+
- Maximum TwiML length is 4096 characters.
328+
- TwiML must be provided as a single-line string without line breaks or tabs, and must be a valid XML string. For example: `<Say>Hello</Say>` is valid, but `<Say>Hello\n</Say>` is not.
329+
330+
- **Example:**
273331

274332
```json
275333
"transferPlan": {
@@ -278,7 +336,6 @@ In this mode, Vapi executes TwiML instructions on the destination call leg befor
278336
}
279337
```
280338

281-
282339
Here is a full example of a `transferCall` payload using the warm transfer with TwiML mode:
283340

284341
```json
@@ -305,4 +362,7 @@ Here is a full example of a `transferCall` payload using the warm transfer with
305362
}
306363
```
307364

308-
**Note:** In all warm transfer modes, the `{{transcript}}` variable contains the full transcript of the call and can be used within the `summaryPlan`.
365+
**Notes:**
366+
367+
- In all warm transfer modes, the `{{transcript}}` variable contains the full transcript of the call and can be used within the `summaryPlan`.
368+
- For more details about transfer plans and configuration options, please refer to the [transferCall API documentation](https://docs.vapi.ai/api-reference/tools/create#request.body.transferCall.destinations.number.transferPlan)

fern/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ instances:
1010
branch: main
1111

1212
announcement:
13-
message: "🚀 Vapi now provides server SDKs! Check out the [supported languages](/server-sdks)."
1413

1514
title: Vapi
1615
favicon: static/images/favicon.ico
@@ -38,6 +37,7 @@ landing-page:
3837
css: assets/styles.css
3938
js:
4039
- path: ./assets/close-playground.js
40+
- path: ./assets/trieve-user-script.js
4141
strategy: lazyOnload
4242
navbar-links:
4343
- type: minimal

0 commit comments

Comments
 (0)