@boldvideo/bold-js 1.5.1 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +4 -1
- package/CHANGELOG.md +23 -0
- package/README.md +205 -43
- package/dist/index.cjs +27 -1
- package/dist/index.d.ts +75 -1
- package/dist/index.js +27 -1
- package/llms.txt +85 -6
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -96,7 +96,10 @@ bold.videos.search(query) // Search videos
|
|
|
96
96
|
bold.playlists.list() // List playlists
|
|
97
97
|
bold.playlists.get(id) // Get single playlist
|
|
98
98
|
bold.ai.coach(opts) // AI RAG assistant (streaming)
|
|
99
|
-
bold.ai.ask(
|
|
99
|
+
bold.ai.ask(opts) // AI RAG assistant (alias for coach)
|
|
100
|
+
bold.ai.search(opts) // Semantic search with synthesis
|
|
101
|
+
bold.ai.chat(videoId, opts) // Video-scoped Q&A
|
|
102
|
+
bold.ai.recommend(opts) // AI-powered recommendations
|
|
100
103
|
bold.trackEvent() // Track video events
|
|
101
104
|
bold.trackPageView() // Track page views
|
|
102
105
|
```
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @boldvideo/bold-js
|
|
2
2
|
|
|
3
|
+
## 1.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7aff057: Align SDK with API specification
|
|
8
|
+
|
|
9
|
+
- Renamed `synthesize` to `includeGuidance` in `RecommendOptions` to match API
|
|
10
|
+
- Renamed `why` to `reason` in `RecommendationVideo` type to match API response
|
|
11
|
+
- Added `tags` filter to `AskOptions` and `SearchOptions`
|
|
12
|
+
- Added `currentTime` to `ChatOptions` for playback context
|
|
13
|
+
|
|
14
|
+
## 1.6.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- 71b3437: Add `bold.ai.recommend()` for AI-powered video recommendations
|
|
19
|
+
|
|
20
|
+
- New method `bold.ai.recommend({ topics, ...options })` returns personalized video recommendations based on topics
|
|
21
|
+
- Supports both streaming (default) and non-streaming modes
|
|
22
|
+
- Includes AI-generated guidance for learning paths
|
|
23
|
+
- New types: `RecommendOptions`, `RecommendResponse`, `Recommendation`, `RecommendationVideo`, `TopicInput`
|
|
24
|
+
- New `recommendations` event type in `AIEvent` union for streaming responses
|
|
25
|
+
|
|
3
26
|
## 1.5.1
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -26,86 +26,248 @@
|
|
|
26
26
|
</a>
|
|
27
27
|
</p>
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
---
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
## Installation
|
|
32
32
|
|
|
33
|
-
```
|
|
33
|
+
```bash
|
|
34
34
|
npm install @boldvideo/bold-js
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
import { createClient } from "@boldvideo/bold-js";
|
|
37
|
+
## Quick Start
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
```typescript
|
|
40
|
+
import { createClient } from '@boldvideo/bold-js';
|
|
41
|
+
|
|
42
|
+
const bold = createClient('your-api-key');
|
|
43
|
+
|
|
44
|
+
// Fetch videos
|
|
45
|
+
const videos = await bold.videos.list();
|
|
46
|
+
|
|
47
|
+
// Get AI-powered recommendations
|
|
48
|
+
const recs = await bold.ai.recommend({
|
|
49
|
+
topics: ['sales', 'negotiation'],
|
|
50
|
+
stream: false
|
|
51
|
+
});
|
|
52
|
+
console.log(recs.guidance);
|
|
42
53
|
```
|
|
43
54
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## API Reference
|
|
58
|
+
|
|
59
|
+
### Videos
|
|
48
60
|
|
|
49
|
-
|
|
61
|
+
```typescript
|
|
62
|
+
// List latest videos
|
|
50
63
|
const videos = await bold.videos.list();
|
|
51
64
|
|
|
52
|
-
//
|
|
65
|
+
// Get a single video
|
|
66
|
+
const video = await bold.videos.get('video-id');
|
|
67
|
+
|
|
68
|
+
// Search videos
|
|
69
|
+
const results = await bold.videos.search('pricing strategies');
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Playlists
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
// List all playlists
|
|
53
76
|
const playlists = await bold.playlists.list();
|
|
54
77
|
|
|
78
|
+
// Get a single playlist with videos
|
|
79
|
+
const playlist = await bold.playlists.get('playlist-id');
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Settings
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
// Fetch channel settings, menus, and featured playlists
|
|
86
|
+
const settings = await bold.settings();
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## AI Methods
|
|
92
|
+
|
|
93
|
+
All AI methods support both streaming (default) and non-streaming modes.
|
|
94
|
+
|
|
95
|
+
### Recommend
|
|
96
|
+
|
|
97
|
+
Get AI-powered video recommendations based on topics — ideal for personalized learning paths, exam prep, and content discovery.
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
// Streaming (default)
|
|
101
|
+
const stream = await bold.ai.recommend({
|
|
102
|
+
topics: ['contract law', 'ethics', 'client management'],
|
|
103
|
+
context: 'I failed these topics on my certification exam'
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
for await (const event of stream) {
|
|
107
|
+
if (event.type === 'recommendations') {
|
|
108
|
+
event.recommendations.forEach(rec => {
|
|
109
|
+
console.log(`${rec.topic}:`);
|
|
110
|
+
rec.videos.forEach(v => console.log(` - ${v.title} (${v.relevance})`));
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
if (event.type === 'text_delta') {
|
|
114
|
+
process.stdout.write(event.delta); // AI guidance
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Non-streaming
|
|
119
|
+
const response = await bold.ai.recommend({
|
|
120
|
+
topics: ['sales', 'marketing'],
|
|
121
|
+
stream: false
|
|
122
|
+
});
|
|
123
|
+
console.log(response.guidance);
|
|
124
|
+
console.log(response.recommendations);
|
|
55
125
|
```
|
|
56
126
|
|
|
57
|
-
|
|
127
|
+
**Options:**
|
|
128
|
+
|
|
129
|
+
| Parameter | Type | Description |
|
|
130
|
+
|-----------|------|-------------|
|
|
131
|
+
| `topics` | `string[]` \| `string` | Topics to find content for (required) |
|
|
132
|
+
| `stream` | `boolean` | `true` (default) for SSE, `false` for JSON |
|
|
133
|
+
| `limit` | `number` | Max videos per topic (default: 5, max: 20) |
|
|
134
|
+
| `collectionId` | `string` | Filter to a specific collection |
|
|
135
|
+
| `tags` | `string[]` | Filter by tags |
|
|
136
|
+
| `includeGuidance` | `boolean` | Include AI learning path narrative (default: true) |
|
|
137
|
+
| `context` | `string` | User context for personalized guidance |
|
|
138
|
+
|
|
139
|
+
### Coach / Ask
|
|
140
|
+
|
|
141
|
+
Library-wide RAG assistant for answering questions across your entire video library.
|
|
58
142
|
|
|
59
|
-
|
|
143
|
+
```typescript
|
|
144
|
+
// Streaming
|
|
145
|
+
const stream = await bold.ai.coach({ prompt: 'How do I price my SaaS?' });
|
|
60
146
|
|
|
61
|
-
|
|
62
|
-
|
|
147
|
+
for await (const event of stream) {
|
|
148
|
+
if (event.type === 'text_delta') process.stdout.write(event.delta);
|
|
149
|
+
if (event.type === 'sources') console.log('Sources:', event.sources);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Non-streaming
|
|
153
|
+
const response = await bold.ai.ask({
|
|
154
|
+
prompt: 'What are the best closing techniques?',
|
|
155
|
+
stream: false
|
|
156
|
+
});
|
|
157
|
+
console.log(response.content);
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Search
|
|
161
|
+
|
|
162
|
+
Semantic search with light synthesis.
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
const stream = await bold.ai.search({
|
|
166
|
+
prompt: 'pricing strategies',
|
|
167
|
+
limit: 10
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
for await (const event of stream) {
|
|
171
|
+
if (event.type === 'sources') {
|
|
172
|
+
console.log(`Found ${event.sources.length} results`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Chat
|
|
178
|
+
|
|
179
|
+
Video-scoped conversation for Q&A about a specific video.
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
const stream = await bold.ai.chat('video-id', {
|
|
183
|
+
prompt: 'What is discussed at the 5 minute mark?'
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
for await (const event of stream) {
|
|
187
|
+
if (event.type === 'text_delta') process.stdout.write(event.delta);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// With playback context - helps AI understand what viewer just watched
|
|
191
|
+
const stream = await bold.ai.chat('video-id', {
|
|
192
|
+
prompt: 'What does she mean by that?',
|
|
193
|
+
currentTime: 847 // seconds
|
|
194
|
+
});
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Multi-turn Conversations
|
|
198
|
+
|
|
199
|
+
Use the `context` parameter for follow-up questions:
|
|
200
|
+
|
|
201
|
+
```typescript
|
|
63
202
|
const first = await bold.ai.search({
|
|
64
|
-
prompt:
|
|
203
|
+
prompt: 'How do indie designers find clients?',
|
|
65
204
|
stream: false
|
|
66
205
|
});
|
|
67
|
-
console.log(first.content);
|
|
68
206
|
|
|
69
|
-
// Follow-up with context from previous response
|
|
70
207
|
const followUp = await bold.ai.search({
|
|
71
|
-
prompt:
|
|
208
|
+
prompt: 'What about cold outreach specifically?',
|
|
72
209
|
context: first.context,
|
|
73
210
|
stream: false
|
|
74
211
|
});
|
|
75
|
-
console.log(followUp.content);
|
|
76
212
|
```
|
|
77
213
|
|
|
78
|
-
|
|
214
|
+
---
|
|
79
215
|
|
|
80
|
-
|
|
216
|
+
## Analytics
|
|
81
217
|
|
|
82
|
-
|
|
218
|
+
Track video events and page views for analytics.
|
|
83
219
|
|
|
84
|
-
|
|
220
|
+
```typescript
|
|
221
|
+
// Track video events (play, pause, complete, etc.)
|
|
222
|
+
bold.trackEvent({
|
|
223
|
+
type: 'play',
|
|
224
|
+
videoId: 'video-id',
|
|
225
|
+
timestamp: 0
|
|
226
|
+
});
|
|
85
227
|
|
|
86
|
-
|
|
228
|
+
// Track page views
|
|
229
|
+
bold.trackPageView({
|
|
230
|
+
path: '/videos/my-video',
|
|
231
|
+
referrer: document.referrer
|
|
232
|
+
});
|
|
233
|
+
```
|
|
87
234
|
|
|
88
|
-
|
|
235
|
+
---
|
|
89
236
|
|
|
90
|
-
|
|
91
|
-
- NPM_TOKEN is only accessible to workflows on the main branch
|
|
92
|
-
- External contributors' PRs cannot access secrets
|
|
93
|
-
- Only maintainers with write access can merge to main
|
|
94
|
-
- The changeset-release workflow only runs after merge to main
|
|
237
|
+
## TypeScript
|
|
95
238
|
|
|
96
|
-
|
|
239
|
+
All types are exported for full TypeScript support:
|
|
97
240
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
241
|
+
```typescript
|
|
242
|
+
import type {
|
|
243
|
+
Video,
|
|
244
|
+
Playlist,
|
|
245
|
+
Settings,
|
|
246
|
+
AIEvent,
|
|
247
|
+
AIResponse,
|
|
248
|
+
RecommendOptions,
|
|
249
|
+
RecommendResponse,
|
|
250
|
+
Recommendation,
|
|
251
|
+
Source
|
|
252
|
+
} from '@boldvideo/bold-js';
|
|
253
|
+
```
|
|
104
254
|
|
|
105
|
-
|
|
255
|
+
---
|
|
106
256
|
|
|
107
|
-
|
|
257
|
+
## Related Links
|
|
258
|
+
|
|
259
|
+
- **[Bold API Documentation](https://docs.boldvideo.io/docs/api)**
|
|
260
|
+
- **[GitHub Repository](https://github.com/boldvideo/bold-js)**
|
|
261
|
+
- **[npm Package](https://www.npmjs.com/package/@boldvideo/bold-js)**
|
|
262
|
+
|
|
263
|
+
## Contributing
|
|
264
|
+
|
|
265
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to this project.
|
|
266
|
+
|
|
267
|
+
## Security
|
|
108
268
|
|
|
109
|
-
|
|
269
|
+
See [SECURITY.md](SECURITY.md) for security policies and reporting vulnerabilities.
|
|
110
270
|
|
|
271
|
+
## License
|
|
111
272
|
|
|
273
|
+
MIT
|
package/dist/index.cjs
CHANGED
|
@@ -306,6 +306,8 @@ function createAI(config) {
|
|
|
306
306
|
const body = { prompt: options.prompt };
|
|
307
307
|
if (options.collectionId)
|
|
308
308
|
body.collection_id = options.collectionId;
|
|
309
|
+
if (options.tags)
|
|
310
|
+
body.tags = options.tags;
|
|
309
311
|
if (options.stream === false) {
|
|
310
312
|
body.stream = false;
|
|
311
313
|
return jsonRequest(path, body, config);
|
|
@@ -324,6 +326,8 @@ function createAI(config) {
|
|
|
324
326
|
body.collection_id = options.collectionId;
|
|
325
327
|
if (options.videoId)
|
|
326
328
|
body.video_id = options.videoId;
|
|
329
|
+
if (options.tags)
|
|
330
|
+
body.tags = options.tags;
|
|
327
331
|
if (options.context)
|
|
328
332
|
body.context = options.context;
|
|
329
333
|
if (options.stream === false) {
|
|
@@ -335,6 +339,27 @@ function createAI(config) {
|
|
|
335
339
|
async function chat(videoId, options) {
|
|
336
340
|
const path = options.conversationId ? `ai/videos/${videoId}/chat/${options.conversationId}` : `ai/videos/${videoId}/chat`;
|
|
337
341
|
const body = { prompt: options.prompt };
|
|
342
|
+
if (options.currentTime !== void 0)
|
|
343
|
+
body.current_time = options.currentTime;
|
|
344
|
+
if (options.stream === false) {
|
|
345
|
+
body.stream = false;
|
|
346
|
+
return jsonRequest(path, body, config);
|
|
347
|
+
}
|
|
348
|
+
return streamRequest(path, body, config);
|
|
349
|
+
}
|
|
350
|
+
async function recommend(options) {
|
|
351
|
+
const path = "ai/recommend";
|
|
352
|
+
const body = { topics: options.topics };
|
|
353
|
+
if (options.limit)
|
|
354
|
+
body.limit = options.limit;
|
|
355
|
+
if (options.collectionId)
|
|
356
|
+
body.collection_id = options.collectionId;
|
|
357
|
+
if (options.tags)
|
|
358
|
+
body.tags = options.tags;
|
|
359
|
+
if (options.includeGuidance !== void 0)
|
|
360
|
+
body.include_guidance = options.includeGuidance;
|
|
361
|
+
if (options.context)
|
|
362
|
+
body.context = options.context;
|
|
338
363
|
if (options.stream === false) {
|
|
339
364
|
body.stream = false;
|
|
340
365
|
return jsonRequest(path, body, config);
|
|
@@ -345,7 +370,8 @@ function createAI(config) {
|
|
|
345
370
|
ask,
|
|
346
371
|
coach,
|
|
347
372
|
search,
|
|
348
|
-
chat
|
|
373
|
+
chat,
|
|
374
|
+
recommend
|
|
349
375
|
};
|
|
350
376
|
}
|
|
351
377
|
|
package/dist/index.d.ts
CHANGED
|
@@ -223,6 +223,9 @@ type AIEvent = {
|
|
|
223
223
|
} | {
|
|
224
224
|
type: "clarification";
|
|
225
225
|
questions: string[];
|
|
226
|
+
} | {
|
|
227
|
+
type: "recommendations";
|
|
228
|
+
recommendations: Recommendation[];
|
|
226
229
|
} | {
|
|
227
230
|
type: "message_complete";
|
|
228
231
|
content: string;
|
|
@@ -257,6 +260,7 @@ interface AskOptions {
|
|
|
257
260
|
stream?: boolean;
|
|
258
261
|
conversationId?: string;
|
|
259
262
|
collectionId?: string;
|
|
263
|
+
tags?: string[];
|
|
260
264
|
}
|
|
261
265
|
/**
|
|
262
266
|
* Conversation message for AI context
|
|
@@ -274,6 +278,7 @@ interface SearchOptions {
|
|
|
274
278
|
limit?: number;
|
|
275
279
|
collectionId?: string;
|
|
276
280
|
videoId?: string;
|
|
281
|
+
tags?: string[];
|
|
277
282
|
context?: AIContextMessage[];
|
|
278
283
|
}
|
|
279
284
|
/**
|
|
@@ -287,6 +292,53 @@ interface ChatOptions {
|
|
|
287
292
|
prompt: string;
|
|
288
293
|
stream?: boolean;
|
|
289
294
|
conversationId?: string;
|
|
295
|
+
currentTime?: number;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* A recommended video with relevance score
|
|
299
|
+
*/
|
|
300
|
+
interface RecommendationVideo {
|
|
301
|
+
video_id: string;
|
|
302
|
+
title: string;
|
|
303
|
+
playback_id: string;
|
|
304
|
+
relevance: number;
|
|
305
|
+
reason: string;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* A topic recommendation with its videos
|
|
309
|
+
*/
|
|
310
|
+
interface Recommendation {
|
|
311
|
+
topic: string;
|
|
312
|
+
position: number;
|
|
313
|
+
videos: RecommendationVideo[];
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Topic input format for recommendations
|
|
317
|
+
*/
|
|
318
|
+
type TopicInput = string | {
|
|
319
|
+
q: string;
|
|
320
|
+
priority?: number;
|
|
321
|
+
};
|
|
322
|
+
/**
|
|
323
|
+
* Options for bold.ai.recommend()
|
|
324
|
+
*/
|
|
325
|
+
interface RecommendOptions {
|
|
326
|
+
topics: TopicInput[] | string;
|
|
327
|
+
stream?: boolean;
|
|
328
|
+
limit?: number;
|
|
329
|
+
collectionId?: string;
|
|
330
|
+
tags?: string[];
|
|
331
|
+
includeGuidance?: boolean;
|
|
332
|
+
context?: string;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Non-streaming response for recommend endpoint
|
|
336
|
+
*/
|
|
337
|
+
interface RecommendResponse {
|
|
338
|
+
id: string;
|
|
339
|
+
recommendations: Recommendation[];
|
|
340
|
+
guidance: string;
|
|
341
|
+
sources: Source[];
|
|
290
342
|
}
|
|
291
343
|
|
|
292
344
|
/**
|
|
@@ -357,6 +409,28 @@ interface AIClient {
|
|
|
357
409
|
stream?: true;
|
|
358
410
|
}): Promise<AsyncIterable<AIEvent>>;
|
|
359
411
|
chat(videoId: string, options: ChatOptions): Promise<AsyncIterable<AIEvent> | AIResponse>;
|
|
412
|
+
/**
|
|
413
|
+
* Recommend - AI-powered video recommendations
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* // Streaming (default)
|
|
417
|
+
* const stream = await bold.ai.recommend({ topics: ["sales", "negotiation"] });
|
|
418
|
+
* for await (const event of stream) {
|
|
419
|
+
* if (event.type === "recommendations") console.log(event.recommendations);
|
|
420
|
+
* }
|
|
421
|
+
*
|
|
422
|
+
* @example
|
|
423
|
+
* // Non-streaming
|
|
424
|
+
* const response = await bold.ai.recommend({ topics: ["sales"], stream: false });
|
|
425
|
+
* console.log(response.guidance);
|
|
426
|
+
*/
|
|
427
|
+
recommend(options: RecommendOptions & {
|
|
428
|
+
stream: false;
|
|
429
|
+
}): Promise<RecommendResponse>;
|
|
430
|
+
recommend(options: RecommendOptions & {
|
|
431
|
+
stream?: true;
|
|
432
|
+
}): Promise<AsyncIterable<AIEvent>>;
|
|
433
|
+
recommend(options: RecommendOptions): Promise<AsyncIterable<AIEvent> | RecommendResponse>;
|
|
360
434
|
}
|
|
361
435
|
|
|
362
436
|
type ClientOptions = {
|
|
@@ -401,4 +475,4 @@ declare const DEFAULT_API_BASE_URL = "https://app.boldvideo.io/api/v1/";
|
|
|
401
475
|
*/
|
|
402
476
|
declare const DEFAULT_INTERNAL_API_BASE_URL = "https://app.boldvideo.io/i/v1/";
|
|
403
477
|
|
|
404
|
-
export { AIContextMessage, AIEvent, AIResponse, AIUsage, Account, AccountAI, AskOptions, AssistantConfig, ChatOptions, ClientOptions, DEFAULT_API_BASE_URL, DEFAULT_INTERNAL_API_BASE_URL, MenuItem, Playlist, Portal, PortalDisplay, PortalLayout, PortalNavigation, PortalTheme, SearchOptions, Settings, Source, ThemeColors, ThemeConfig, Video, VideoAttachment, VideoDownloadUrls, VideoMetadata, VideoSubtitles, VideoTranscript, createClient };
|
|
478
|
+
export { AIContextMessage, AIEvent, AIResponse, AIUsage, Account, AccountAI, AskOptions, AssistantConfig, ChatOptions, ClientOptions, DEFAULT_API_BASE_URL, DEFAULT_INTERNAL_API_BASE_URL, MenuItem, Playlist, Portal, PortalDisplay, PortalLayout, PortalNavigation, PortalTheme, RecommendOptions, RecommendResponse, Recommendation, RecommendationVideo, SearchOptions, Settings, Source, ThemeColors, ThemeConfig, TopicInput, Video, VideoAttachment, VideoDownloadUrls, VideoMetadata, VideoSubtitles, VideoTranscript, createClient };
|
package/dist/index.js
CHANGED
|
@@ -268,6 +268,8 @@ function createAI(config) {
|
|
|
268
268
|
const body = { prompt: options.prompt };
|
|
269
269
|
if (options.collectionId)
|
|
270
270
|
body.collection_id = options.collectionId;
|
|
271
|
+
if (options.tags)
|
|
272
|
+
body.tags = options.tags;
|
|
271
273
|
if (options.stream === false) {
|
|
272
274
|
body.stream = false;
|
|
273
275
|
return jsonRequest(path, body, config);
|
|
@@ -286,6 +288,8 @@ function createAI(config) {
|
|
|
286
288
|
body.collection_id = options.collectionId;
|
|
287
289
|
if (options.videoId)
|
|
288
290
|
body.video_id = options.videoId;
|
|
291
|
+
if (options.tags)
|
|
292
|
+
body.tags = options.tags;
|
|
289
293
|
if (options.context)
|
|
290
294
|
body.context = options.context;
|
|
291
295
|
if (options.stream === false) {
|
|
@@ -297,6 +301,27 @@ function createAI(config) {
|
|
|
297
301
|
async function chat(videoId, options) {
|
|
298
302
|
const path = options.conversationId ? `ai/videos/${videoId}/chat/${options.conversationId}` : `ai/videos/${videoId}/chat`;
|
|
299
303
|
const body = { prompt: options.prompt };
|
|
304
|
+
if (options.currentTime !== void 0)
|
|
305
|
+
body.current_time = options.currentTime;
|
|
306
|
+
if (options.stream === false) {
|
|
307
|
+
body.stream = false;
|
|
308
|
+
return jsonRequest(path, body, config);
|
|
309
|
+
}
|
|
310
|
+
return streamRequest(path, body, config);
|
|
311
|
+
}
|
|
312
|
+
async function recommend(options) {
|
|
313
|
+
const path = "ai/recommend";
|
|
314
|
+
const body = { topics: options.topics };
|
|
315
|
+
if (options.limit)
|
|
316
|
+
body.limit = options.limit;
|
|
317
|
+
if (options.collectionId)
|
|
318
|
+
body.collection_id = options.collectionId;
|
|
319
|
+
if (options.tags)
|
|
320
|
+
body.tags = options.tags;
|
|
321
|
+
if (options.includeGuidance !== void 0)
|
|
322
|
+
body.include_guidance = options.includeGuidance;
|
|
323
|
+
if (options.context)
|
|
324
|
+
body.context = options.context;
|
|
300
325
|
if (options.stream === false) {
|
|
301
326
|
body.stream = false;
|
|
302
327
|
return jsonRequest(path, body, config);
|
|
@@ -307,7 +332,8 @@ function createAI(config) {
|
|
|
307
332
|
ask,
|
|
308
333
|
coach,
|
|
309
334
|
search,
|
|
310
|
-
chat
|
|
335
|
+
chat,
|
|
336
|
+
recommend
|
|
311
337
|
};
|
|
312
338
|
}
|
|
313
339
|
|
package/llms.txt
CHANGED
|
@@ -13,33 +13,112 @@ const bold = createClient('your-api-key');
|
|
|
13
13
|
const videos = await bold.videos.list();
|
|
14
14
|
const video = await bold.videos.get('video-id');
|
|
15
15
|
|
|
16
|
+
// AI-powered recommendations
|
|
17
|
+
const recs = await bold.ai.recommend({ topics: ['sales', 'negotiation'], stream: false });
|
|
18
|
+
console.log(recs.guidance);
|
|
19
|
+
|
|
16
20
|
// AI streaming
|
|
17
|
-
const stream = await bold.ai.coach({
|
|
21
|
+
const stream = await bold.ai.coach({ prompt: 'How do I price my SaaS?' });
|
|
18
22
|
for await (const event of stream) {
|
|
19
|
-
if (event.type === '
|
|
23
|
+
if (event.type === 'text_delta') process.stdout.write(event.delta);
|
|
20
24
|
}
|
|
21
25
|
```
|
|
22
26
|
|
|
23
27
|
## API Reference
|
|
24
28
|
|
|
29
|
+
### Client
|
|
30
|
+
|
|
25
31
|
- `createClient(apiKey, options?)` - Create SDK instance
|
|
32
|
+
|
|
33
|
+
### Content
|
|
34
|
+
|
|
26
35
|
- `bold.settings()` - Channel settings, menus, featured playlists
|
|
27
36
|
- `bold.videos.list()` - List videos
|
|
28
37
|
- `bold.videos.get(id)` - Get video by ID
|
|
29
38
|
- `bold.videos.search(query)` - Search videos
|
|
30
39
|
- `bold.playlists.list()` - List playlists
|
|
31
40
|
- `bold.playlists.get(id)` - Get playlist by ID
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
|
|
42
|
+
### AI Methods
|
|
43
|
+
|
|
44
|
+
All AI methods return `AsyncIterable<AIEvent>` (streaming) or `Promise<AIResponse>` (non-streaming).
|
|
45
|
+
|
|
46
|
+
- `bold.ai.recommend(options)` - AI-powered video recommendations based on topics
|
|
47
|
+
- `bold.ai.coach(options)` - Library-wide RAG assistant (alias: `ask`)
|
|
48
|
+
- `bold.ai.ask(options)` - Library-wide RAG assistant
|
|
49
|
+
- `bold.ai.search(options)` - Semantic search with synthesis
|
|
50
|
+
- `bold.ai.chat(videoId, options)` - Video-scoped Q&A conversation
|
|
51
|
+
|
|
52
|
+
### Analytics
|
|
53
|
+
|
|
54
|
+
- `bold.trackEvent(event)` - Track video events (play, pause, complete)
|
|
35
55
|
- `bold.trackPageView(data)` - Track page views
|
|
36
56
|
|
|
57
|
+
## AI Options
|
|
58
|
+
|
|
59
|
+
### RecommendOptions
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
{
|
|
63
|
+
topics: string[] | string; // Topics to find content for (required)
|
|
64
|
+
stream?: boolean; // Default: true
|
|
65
|
+
limit?: number; // Max videos per topic (default: 5, max: 20)
|
|
66
|
+
collectionId?: string; // Filter to collection
|
|
67
|
+
tags?: string[]; // Filter by tags
|
|
68
|
+
includeGuidance?: boolean; // Include AI learning path narrative (default: true)
|
|
69
|
+
context?: string; // User context for personalization
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### AskOptions / CoachOptions
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
{
|
|
77
|
+
prompt: string; // Question to ask (required)
|
|
78
|
+
stream?: boolean; // Default: true
|
|
79
|
+
conversationId?: string; // Continue existing conversation
|
|
80
|
+
collectionId?: string; // Filter to collection
|
|
81
|
+
tags?: string[]; // Filter by tags
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### SearchOptions
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
{
|
|
89
|
+
prompt: string; // Search query (required)
|
|
90
|
+
stream?: boolean; // Default: true
|
|
91
|
+
limit?: number; // Max results
|
|
92
|
+
collectionId?: string; // Filter to collection
|
|
93
|
+
videoId?: string; // Search within specific video
|
|
94
|
+
tags?: string[]; // Filter by tags
|
|
95
|
+
context?: AIContextMessage[]; // Conversation context
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### ChatOptions
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
{
|
|
103
|
+
prompt: string; // Question about the video (required)
|
|
104
|
+
stream?: boolean; // Default: true
|
|
105
|
+
conversationId?: string; // Continue existing conversation
|
|
106
|
+
currentTime?: number; // Current playback position in seconds
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
37
110
|
## Types
|
|
38
111
|
|
|
39
|
-
Key types exported:
|
|
112
|
+
Key types exported:
|
|
113
|
+
|
|
114
|
+
- `Video`, `Playlist`, `Settings`, `Portal`
|
|
115
|
+
- `AIEvent`, `AIResponse`, `Source`, `AIUsage`
|
|
116
|
+
- `AskOptions`, `SearchOptions`, `ChatOptions`
|
|
117
|
+
- `RecommendOptions`, `RecommendResponse`, `Recommendation`, `RecommendationVideo`, `TopicInput`
|
|
40
118
|
|
|
41
119
|
## Links
|
|
42
120
|
|
|
43
121
|
- [GitHub](https://github.com/boldvideo/bold-js)
|
|
44
122
|
- [npm](https://www.npmjs.com/package/@boldvideo/bold-js)
|
|
123
|
+
- [API Docs](https://docs.boldvideo.io/docs/api)
|
|
45
124
|
- [Types Source](https://github.com/boldvideo/bold-js/blob/main/src/lib/types.ts)
|