Bold VideoDocs

AI Methods

AI-powered chat, search, and recommendations in the Bold SDK

The ai namespace provides AI capabilities for conversational chat, semantic search, and video recommendations.

Methods

ai.chat(options)

Conversational AI that can be scoped to specific videos. Supports both streaming (default) and non-streaming responses.

// Streaming (default)
for await (const event of bold.ai.chat({ prompt: 'What topics are covered?' })) {
  if (event.type === 'text_delta') {
    process.stdout.write(event.text);
  }
}

// Non-streaming
const response = await bold.ai.chat({
  prompt: 'What topics are covered?',
  stream: false
});

console.log(response.text);

Scoped to a specific video:

for await (const event of bold.ai.chat({
  prompt: 'Explain the main concept',
  videoId: 'video-id',
  currentTime: 120 // Current playback position in seconds
})) {
  // Handle events
}

Continue a conversation:

for await (const event of bold.ai.chat({
  prompt: 'Tell me more about that',
  conversationId: 'conv-id'
})) {
  // Handle events
}

Parameters:

NameTypeRequiredDefaultDescription
promptstringYesYour question or message
streambooleanNotrueEnable streaming response
videoIdstringNoScope chat to a specific video
currentTimenumberNoPlayback position in seconds
conversationIdstringNoContinue an existing conversation
collectionIdstringNoFilter by collection
tagsstring[]NoFilter by tags

Returns: AsyncIterable<AIEvent> (streaming) or Promise<AIResponse> (non-streaming)


ai.search(options)

Semantic search across your video library with AI-synthesized results.

// Streaming
for await (const event of bold.ai.search({
  prompt: 'How to deploy to production?',
  limit: 5
})) {
  if (event.type === 'text_delta') {
    process.stdout.write(event.text);
  }
  if (event.type === 'sources') {
    console.log('Sources:', event.sources);
  }
}

// Non-streaming
const response = await bold.ai.search({
  prompt: 'How to deploy to production?',
  stream: false
});

Parameters:

NameTypeRequiredDefaultDescription
promptstringYesSearch query
streambooleanNotrueEnable streaming response
limitnumberNoMaximum number of results
collectionIdstringNoFilter by collection
videoIdstringNoScope search to a specific video
tagsstring[]NoFilter by tags
contextConversationMessage[]NoPrior conversation context

Returns: AsyncIterable<AIEvent> (streaming) or Promise<AIResponse> (non-streaming)


ai.recommendations(options)

Get topic-based video recommendations with optional AI guidance narratives.

for await (const event of bold.ai.recommendations({
  topics: ['machine learning', 'deployment'],
  limit: 5,
  includeGuidance: true
})) {
  if (event.type === 'text_delta') {
    // AI guidance narrative
    process.stdout.write(event.text);
  }
  if (event.type === 'recommendations') {
    for (const rec of event.recommendations) {
      console.log(`Topic: ${rec.topic}`);
      for (const video of rec.videos) {
        console.log(`  - ${video.title} (score: ${video.score})`);
      }
    }
  }
}

Parameters:

NameTypeRequiredDefaultDescription
topicsstring[]YesTopics to find videos for
streambooleanNotrueEnable streaming response
limitnumberNoMax videos per topic (max 20)
collectionIdstringNoFilter by collection
tagsstring[]NoFilter by tags
includeGuidancebooleanNoInclude AI guidance narrative
contextConversationMessage[]NoPrior conversation context

Returns: AsyncIterable<AIEvent> (streaming) or Promise<RecommendationsResponse> (non-streaming)


ai.getConversation(conversationId)

Retrieve a full conversation history.

const conversation = await bold.ai.getConversation('conv-id');

console.log('Status:', conversation.metadata.status);

for (const message of conversation.messages) {
  console.log(`${message.role}: ${message.content}`);
  if (message.sources) {
    console.log('Sources:', message.sources);
  }
}

Parameters:

NameTypeRequiredDescription
conversationIdstringYesThe conversation ID

Returns: Promise<Conversation>

Deprecated Methods

The following methods are deprecated and will be removed in a future version:

DeprecatedUse Instead
ai.ask()ai.chat()
ai.coach()ai.chat()
ai.recommend()ai.recommendations()
  • Streaming — Handle real-time SSE events
  • Types — Complete type reference

On this page