Skip to content

Knowledge base

The Documents API lets you give Avatars access to domain-specific knowledge. Upload content that your Avatar can reference during conversations to provide accurate, contextual responses.

A knowledge base helps your Avatar stay on topic and provide accurate information. Common use cases:

  • Customer support: FAQs, product information, company policies
  • Quizzes and games: Question banks, correct answers, scoring rules
  • Education: Course material, reference content, learning objectives
  • Brand experiences: Brand guidelines, messaging, product details
FormatDescription
Plain textUnformatted text content
MarkdownStructured content with headings and formatting

More formats are planned for future releases.

The flow is: create a Document, then link it to your Avatar.

import RunwayML from '@runwayml/sdk';
const client = new RunwayML();
const document = await client.documents.create({
name: 'Product FAQ',
content: '# Product FAQ\n\n## What is your return policy?\n\nWe offer a 30-day return policy...',
});
console.log('Document created:', document.id);

Update your Avatar to attach the Document. This replaces any existing Document attachments.

await client.avatars.update(avatarId, {
documentIds: [document.id],
});

The Avatar now has access to the knowledge during conversations. Start a Session as usual:

const session = await client.realtimeSessions.create({
model: 'gwm1_avatars',
avatar: {
type: 'custom',
avatarId: avatarId,
},
});

You can also manage Documents through the Developer Portal. See the API reference for all available endpoints.