neha_09141
02/24/2025, 5:58 PMAI Evy
02/24/2025, 5:58 PMAI Evy
02/24/2025, 5:58 PMjavascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
});
async function main() {
const knowledgeBaseResponse = await client.knowledgeBase.create({
knowledge_base_name: "Sample KB",
knowledge_base_texts: [
{
text: "Hello, how are you?",
title: "Sample Question",
},
],
knowledge_base_urls: [
"https://www.retellai.com",
"https://docs.retellai.com",
],
knowledge_base_files: [
fs.createReadStream("../sample.txt"),
],
});
console.log(knowledgeBaseResponse.knowledge_base_id);
}
main();
[(2)]()
If you're still experiencing issues, make sure you're:
1. Using the correct content type (multipart form) [(1)]()
2. Properly formatting the knowledge_base_urls as a JSON serialized string
The Knowledge Base feature was introduced in October 2024 and includes functionality for scraping webpages, uploading files, and manually adding text [(3)]() .AI Evy
02/24/2025, 5:58 PM