Skip to content

Commit ba31428

Browse files
committed
added docs for customization section.
Signed-off-by: Sahil Suman <sahilsuman933@gmail.com>
1 parent 9d176a1 commit ba31428

File tree

11 files changed

+219
-21
lines changed

11 files changed

+219
-21
lines changed

customization/custom-keywords.mdx

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
title: "Custom Keywords"
3+
sidebarTitle: "Custom Keywords"
4+
description: "Enhanced transcription accuracy guide"
5+
---
6+
7+
VAPI allows you to improve the accuracy of your transcriptions by leveraging Deepgram's keyword boosting feature. This is particularly useful when dealing with specialized terminology or uncommon proper nouns. By providing specific keywords to the Deepgram model, you can enhance transcription quality directly through VAPI.
8+
9+
### Why Use Keyword Boosting?
10+
11+
Keyword boosting is beneficial for:
12+
13+
- Enhancing the recognition of specialized terms and proper nouns.
14+
- Improving transcription accuracy without the need for a custom-trained model.
15+
- Quickly updating the model's vocabulary with new or uncommon words.
16+
17+
### Important Notes
18+
19+
- Keywords should be uncommon words or proper nouns not frequently recognized by the model.
20+
- Custom model training is the most effective way to ensure accurate keyword recognition.
21+
- For more than 50 keywords, consider custom model training by contacting Deepgram.
22+
23+
## Enabling Keyword Boosting in VAPI
24+
25+
### API Call Integration
26+
27+
To enable keyword boosting, you need to add a `keywords` parameter to your VAPI assistant's transcriber section. This parameter should include the keywords and their respective intensifiers.
28+
29+
### Example of POST Request
30+
31+
To create an assistant with keyword boosting enabled, you can make the following POST request to VAPI:
32+
33+
```bash
34+
bashCopy code
35+
curl \
36+
--request POST \
37+
--header 'Authorization: Bearer <token>' \
38+
--header 'Content-Type: application/json' \
39+
--data '{
40+
"name": "Emma",
41+
"model": {
42+
"model": "gpt-4o",
43+
"provider": "openai"
44+
},
45+
"voice": {
46+
"voiceId": "emma",
47+
"provider": "azure"
48+
},
49+
"transcriber": {
50+
"provider": "deepgram",
51+
"model": "nova-2",
52+
"language": "bg",
53+
"smartFormat": true,
54+
"keywords": [
55+
"snuffleupagus:1"
56+
]
57+
},
58+
"firstMessage": "Hi, I am Emma, what is your name?",
59+
"firstMessageMode": "assistant-speaks-first"
60+
}' \
61+
https://api.vapi.ai/assistant
62+
63+
```
64+
65+
In this configuration:
66+
67+
- **name**: The name of the assistant.
68+
- **model**: Specifies the model and provider for the assistant's conversational capabilities.
69+
- **voice**: Specifies the voice and provider for the assistant's speech.
70+
- **transcriber**: Specifies Deepgram as the transcription provider, along with the model, language, smart formatting, and keywords for boosting.
71+
- **firstMessage**: The initial message the assistant will speak.
72+
- **firstMessageMode**: Specifies that the assistant speaks first.
73+
74+
### Intensifiers
75+
76+
Intensifiers are exponential factors that boost or suppress the likelihood of the specified keyword being recognized. The default intensifier is `1`. Higher values increase the likelihood, while `0` is equivalent to not specifying a keyword.
77+
78+
- **Boosting Example:** `keywords=snuffleupagus:5`
79+
- **Suppressing Example:** `keywords=kansas:-10`
80+
81+
### Best Practices for Keyword Boosting
82+
83+
1. **Send Uncommon Keywords:** Focus on keywords not successfully transcribed by the model.
84+
2. **Send Keywords Once:** Avoid repeating keywords.
85+
3. **Use Individual Keywords:** Prefer individual terms over phrases.
86+
4. **Use Proper Spelling:** Spell proper nouns as you want them to appear in transcripts.
87+
5. **Moderate Intensifiers:** Start with small increments to avoid false positives.
88+
6. **Custom Model Training:** For extensive vocabulary needs, consider custom model training.
89+
90+
### Additional Resources
91+
92+
For more detailed information on Deepgram's keyword boosting feature, refer to the Deepgram Keyword Boosting Documentation.
93+
94+
By following these guidelines, you can effectively utilize Deepgram's keyword boosting feature within your VAPI assistant, ensuring enhanced transcription accuracy for specialized terminology and uncommon proper nouns.

assistants/custom-llm.mdx renamed to customization/custom-llm/fine-tuned-openai-models.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: "Custom LLM"
3-
sidebarTitle: "Custom LLM"
2+
title: "Fine-tuned OpenAI models"
3+
sidebarTitle: "Fine-tuned OpenAI models"
44
description: "Use Another LLM or Your Own Server"
55
---
66

File renamed without changes.

assistants/custom-voice.mdx renamed to customization/custom-voices/custom-voice.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: "Custom Voice"
3-
sidebarTitle: "Custom Voice"
2+
title: "Introduction"
3+
sidebarTitle: "Introduction"
44
description: "Use Custom Voice with your favourite provider instead of the preset ones."
55
---
66

File renamed without changes.

customization/jwt-authentication.mdx

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
title: "JWT Authentication"
3+
sidebarTitle: "JWT Authentication"
4+
description: "Secure API authentication guide"
5+
---
6+
This documentation provides an overview of JWT (JSON Web Token) Authentication and demonstrates how to generate a JWT token and use it to authenticate API requests securely.
7+
8+
## Prerequisites
9+
10+
Before you proceed, ensure you have the following:
11+
12+
- An environment that supports JWT generation and API calls (e.g., a programming language or framework)
13+
- An account with a service that requires JWT authentication
14+
- Environment variables set up for the necessary credentials (e.g., organization ID and private key)
15+
16+
## Generating a JWT Token
17+
18+
The following steps outline how to generate a JWT token:
19+
20+
1. **Define the Payload**: The payload contains the data you want to include in the token. In this case, it includes an `orgId`.
21+
2. **Get the Private Key**: The private key is used to sign the token. Ensure it is securely stored, often in environment variables.
22+
3. **Set Token Options**: Define options for the token, such as the expiration time (`expiresIn`).
23+
4. **Generate the Token**: Use a JWT library or built-in functionality to generate the token with the payload, key, and options.
24+
25+
### Example
26+
27+
```js
28+
// Define the payload
29+
const payload = {
30+
orgId: process.env.ORG_ID,
31+
};
32+
33+
// Get the private key from environment variables
34+
const key = process.env.PRIVATE_KEY;
35+
36+
// Define token options
37+
const options = {
38+
expiresIn: '1h',
39+
};
40+
41+
// Generate the token using a JWT library or built-in functionality
42+
const token = generateJWT(payload, key, options);
43+
```
44+
45+
### Explanation
46+
47+
- **Payload**: The payload includes the `orgId`, representing the organization ID.
48+
- **Key**: The private key is used to sign the token, ensuring its authenticity.
49+
- **Options**: The `expiresIn` option specifies that the token will expire in 1 hour.
50+
- **Token Generation**: The `generateJWT` function (a placeholder for the actual JWT generation method) creates the token using the provided payload, key, and options.
51+
52+
## Making an Authenticated API Request
53+
54+
Once the token is generated, you can use it to make authenticated API requests. The following steps outline how to make an authenticated request:
55+
56+
1. **Define the API Endpoint**: Specify the URL of the API you want to call.
57+
2. **Set the Headers**: Include the `Content-Type` and `Authorization` headers in your request. The `Authorization` header should include the generated JWT token prefixed with `Bearer`.
58+
3. **Make the API Call**: Use an appropriate method to send the request and handle the response.
59+
60+
### Example
61+
62+
```js
63+
async function getAssistants() {
64+
const response = await fetch('https://api.vapi.ai/assistant', {
65+
method: 'GET',
66+
headers: {
67+
'Content-Type': 'application/json',
68+
Authorization: `Bearer ${token}`,
69+
},
70+
});
71+
72+
const data = await response.json();
73+
console.log(data);
74+
}
75+
76+
fetchData().catch(console.error);
77+
78+
```
79+
80+
### Explanation
81+
82+
- **API Endpoint**: The URL of the API you want to call.
83+
- **Headers**: The `Content-Type` is set to `application/json`, and the `Authorization` header includes the generated JWT token.
84+
- **API Call**: The `fetchData` function makes an asynchronous GET request to the specified API endpoint and logs the response.
85+
86+
### Usage
87+
88+
With the generated token, you can authenticate API requests to any endpoint requiring authentication. The token will be valid for the duration specified in the options (1 hour in this case).
89+
90+
## Conclusion
91+
92+
This documentation covered the basics of generating a JWT token and demonstrated how to use the token to make authenticated API requests. Ensure that your environment variables (e.g., `ORG_ID` and `PRIVATE_KEY`) are correctly set up before running the code.

knowledgebase.mdx renamed to customization/knowledgebase.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ description: "Learn how to create and integrate custom knowledge bases into your
66

77
import AssistantSetupInboundAccordionGroup from "/snippets/quickstart/dashboard/assistant-setup-inbound.mdx";
88
import GetAPhoneNumberSnippet from "/snippets/quickstart/phone/get-a-phone-number.mdx";
9-
import { Image } from "/snippets/images/images.mdx";
109

1110
<iframe
1211
width="560"

multilingual.mdx renamed to customization/multilingual.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: "Introduction"
3-
sidebarTitle: "Introduction"
2+
title: "Multilingual"
3+
sidebarTitle: "Multilingual"
44
description: "Learn how to set up and test multilingual support in Vapi."
55
---
66

File renamed without changes.

0 commit comments

Comments
 (0)