This API allows you to create and manage knowledge bases that can be integrated with Streaming Avatar sessions to provide more accurate and contextually relevant AI responses.
Overview
The Knowledge Base API is specifically designed to enhance Streaming Avatar interactions by providing contextual information. You can create and manage knowledge bases containing documents and URLs that give your Streaming Avatar the context needed to provide more accurate, relevant, and intelligent responses during real-time conversations.Data Model
Knowledge Base Object:_id: Knowledge base unique identifier (string)team_id: Team identifier (string, required)uid: User identifier (number)user_type: User type (number, 1=internal user, 2=external user)from: Source type (number, 1=system, 2=user)name: Knowledge base name (string, optional, max 100 characters)prologue: Opening message/greeting text (string, optional, max 2000 characters) - can be used with TTS repeat mode for personalized AI assistant introductions. Set to empty string to clear the prologueprompt: AI prompt instructions (string, optional, max 10,000 characters)docs: Array of document objects (array, optional)urls: Array of URL strings (array, optional)create_time: Creation timestamp (number)update_time: Last update timestamp (number)
File Constraints
Document Limitations:- Single file size limit: 100MB (104,857,600 bytes)
- Total files size limit: 500MB (524,288,000 bytes)
- Supported formats: PDF, DOC, DOCX, TXT, MD, JSON, XML, CSV
- name: Maximum 100 characters
- prologue: Maximum 2000 characters (recommended for TTS voice synthesis)
- prompt: Maximum 10,000 characters
API Endpoints
List Knowledge Bases
Retrieve a paginated list of knowledge bases.
Query Parameters
Response Attributes
Example
Request
Create Knowledge Base
Create a new knowledge base with optional documents and URLs.
Body Attributes
Response Attributes
Example
Body
Get Knowledge Base Details
Retrieve detailed information about a specific knowledge base.
Query Parameters
Response Attributes
Example
Request
Update Knowledge Base
Update an existing knowledge base by ID.
Body Attributes
Response Attributes
Example
Body
Delete Knowledge Base
Delete a knowledge base by ID.
Body Attributes
Response Attributes
Example
Body
Integration with Streaming Avatar
Using Knowledge Base in Streaming Avatar Sessions
To enhance your Streaming Avatar with contextual knowledge, simply provide theknowledge_id parameter when creating a Streaming Avatar session. This enables the AI to access documents and URLs from your knowledge base, resulting in more informed and accurate responses during real-time interactions.
Reference: Create Streaming Avatar Session
Example Integration:
knowledge_id is provided, the system automatically:
- Incorporates the knowledge base’s prompt into the AI’s context
- Processes documents and URLs to enhance AI understanding
- Uses the prologue for personalized AI assistant introductions (if TTS repeat mode is enabled)
The prologue field is particularly useful for TTS (Text-to-Speech) models in repeat mode, providing personalized AI assistant introductions at the beginning of LiveAvatar sessions.