From 3a0bcb374ef2832484d13b448829c4445da31749 Mon Sep 17 00:00:00 2001 From: Lalit Gupta Date: Thu, 26 Mar 2026 00:51:09 +0530 Subject: [PATCH] feat: add sortDocsOn, modelConfig for scene.describe, video.update, capture v0.3.0 - Add sortDocsOn param to search for sorting docs by "score" or "start" - Add modelConfig param to Scene.describe() for custom model config - Add Video.update() to update video metadata (name) - Update capture binary to v0.3.0 with new checksums - Bump version to 0.2.4 --- CHANGELOG.md | 16 ++++++++++++++++ package.json | 10 +++++----- src/capture/installer.ts | 8 ++++---- src/core/collection.ts | 3 +++ src/core/scene.ts | 3 ++- src/core/search/index.ts | 3 +++ src/core/video.ts | 22 ++++++++++++++++++++-- src/types/search.ts | 1 + 8 files changed, 54 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59e3f9d..ce5fd42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## [0.2.4] (2026-03-26) + +### Added + +- `sortDocsOn` parameter in `Collection.search()` and `Video.search()` to sort docs by "score" or "start" +- `modelConfig` parameter in `Scene.describe()` for custom model configuration +- `Video.update()` method to update video metadata (currently supports `name`) + +### Changed + +- `Video.name` is no longer readonly (required for `update()`) +- Updated capture binary to v0.3.0 +- Bumped version to 0.2.4 + +--- + ## [0.2.3] (2026-03-18) ### Changed diff --git a/package.json b/package.json index de29d26..02eaf35 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "videodb", - "version": "0.2.3", + "version": "0.2.4", "description": "A NodeJS wrapper for VideoDB's API written in TypeScript", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -40,11 +40,11 @@ }, "binaryConfig": { "baseUrl": "https://artifacts.videodb.io/capture", - "version": "0.2.10", + "version": "0.3.0", "checksums": { - "darwin-arm64": "fc4be7de94153aa9f492b014db7b4f7378e45c3c6f1b5f3f838c2c007bde832f", - "darwin-x64": "bdfc3aa33a961ff532a99639ea95c181d51baee74a1eda555598ce45c30908ac", - "win32-x64": "3f9b9a355edc54dd06cef051b0ec7ed55df6beef6eb9e299fa6ba5f02ba3a50a" + "darwin-arm64": "4cf3ffadab2e3951819547086ddbad6f6fe2976a35590882a5967fa4ee30a4b7", + "darwin-x64": "8e9d2b44bb70bea48f172ca0edb34a5f699b226ff7a795aaf8e5011499596150", + "win32-x64": "2f47eac709c5852661ec6d073fb3691800e208a348c9d6cad61841d26eea89f4" } }, "repository": { diff --git a/src/capture/installer.ts b/src/capture/installer.ts index 367d406..84872b8 100644 --- a/src/capture/installer.ts +++ b/src/capture/installer.ts @@ -37,11 +37,11 @@ export class RecorderInstaller { // Default binary config - can be overridden or loaded from package.json this.binaryConfig = binaryConfig || { baseUrl: 'https://artifacts.videodb.io/capture', - version: '0.2.10', + version: '0.3.0', checksums: { - 'darwin-x64': 'bdfc3aa33a961ff532a99639ea95c181d51baee74a1eda555598ce45c30908ac', - 'darwin-arm64': 'fc4be7de94153aa9f492b014db7b4f7378e45c3c6f1b5f3f838c2c007bde832f', - 'win32-x64': '3f9b9a355edc54dd06cef051b0ec7ed55df6beef6eb9e299fa6ba5f02ba3a50a', + 'darwin-x64': '8e9d2b44bb70bea48f172ca0edb34a5f699b226ff7a795aaf8e5011499596150', + 'darwin-arm64': '4cf3ffadab2e3951819547086ddbad6f6fe2976a35590882a5967fa4ee30a4b7', + 'win32-x64': '2f47eac709c5852661ec6d073fb3691800e208a348c9d6cad61841d26eea89f4', }, }; diff --git a/src/core/collection.ts b/src/core/collection.ts index 0e9df00..dfc958b 100644 --- a/src/core/collection.ts +++ b/src/core/collection.ts @@ -238,6 +238,7 @@ export class Collection implements ICollection { * @param scoreThreshold - [optional] Score Threshold * @param dynamicScorePercentage - [optional] Percentage of dynamic score to consider * @param filter - [optional] Additional metadata filters + * @param sortDocsOn - [optional] Sort docs within each video by "score" or "start" * @param namespace - [optional] Search namespace ("rtstream" to search RTStreams) * @param sceneIndexId - [optional] Filter by specific scene index * @returns SearchResult or RTStreamSearchResult object @@ -250,6 +251,7 @@ export class Collection implements ICollection { scoreThreshold?: number, dynamicScorePercentage?: number, filter?: Array>, + sortDocsOn?: string, namespace?: string, sceneIndexId?: string ): Promise => { @@ -302,6 +304,7 @@ export class Collection implements ICollection { scoreThreshold: scoreThreshold, dynamicScorePercentage: dynamicScorePercentage, filter: filter, + sortDocsOn: sortDocsOn, }); return results; }; diff --git a/src/core/scene.ts b/src/core/scene.ts index 5bc851a..04d8479 100644 --- a/src/core/scene.ts +++ b/src/core/scene.ts @@ -40,12 +40,13 @@ export class Scene { this.#vhttp = http; } - public async describe(prompt?: string, modelName?: string): Promise { + public async describe(prompt?: string, modelName?: string, modelConfig?: Record): Promise { const response = await this.#vhttp.post<{ description: string }, object>( [ApiPath.video, this.videoId, ApiPath.scene, this.id, ApiPath.describe], { prompt, model_name: modelName, + model_config: modelConfig, } ); this.description = response.data.description; diff --git a/src/core/search/index.ts b/src/core/search/index.ts index c4a624e..6e51250 100644 --- a/src/core/search/index.ts +++ b/src/core/search/index.ts @@ -90,6 +90,9 @@ class SemanticSearch if (data.filter !== undefined) { reqData.filter = data.filter; } + if (data.sortDocsOn !== undefined) { + reqData.sort_docs_on = data.sortDocsOn; + } return reqData; }; diff --git a/src/core/video.ts b/src/core/video.ts index 5dd87ee..038970d 100644 --- a/src/core/video.ts +++ b/src/core/video.ts @@ -74,7 +74,7 @@ export class Video implements IVideo { public readonly id: string; public readonly collectionId: string; public readonly length: string; - public readonly name: string; + public name: string; public readonly description?: string; public readonly size: string; public readonly streamUrl: string; @@ -112,6 +112,7 @@ export class Video implements IVideo { * @param scoreThreshold - [optional] Score Threshold * @param dynamicScorePercentage - [optional] Percentage of dynamic score to consider * @param filter - [optional] Additional metadata filters + * @param sortDocsOn - [optional] Sort docs within each video by "score" or "start" */ public search = async ( query: string, @@ -120,7 +121,8 @@ export class Video implements IVideo { resultThreshold?: number, scoreThreshold?: number, dynamicScorePercentage?: number, - filter?: Array> + filter?: Array>, + sortDocsOn?: string ) => { const s = new SearchFactory(this.#vhttp); const searchFunc = s.getSearch(searchType ?? DefaultSearchType); @@ -133,10 +135,26 @@ export class Video implements IVideo { scoreThreshold: scoreThreshold, dynamicScorePercentage: dynamicScorePercentage, filter: filter, + sortDocsOn: sortDocsOn, }); return results; }; + /** + * Update the video's metadata + * @param options - Fields to update + * @param options.name - New name for the video + */ + public update = async (options: { name?: string }) => { + const data: Record = {}; + if (options.name !== undefined) data.name = options.name; + const res = await this.#vhttp.patch<{ id: string; name: string }, typeof data>( + [video, this.id], + data + ); + if (options.name !== undefined) this.name = res.data.name ?? options.name; + }; + /** * Returns an empty promise that resolves when the video is deleted * @returns A promise that resolves when delete is successful diff --git a/src/types/search.ts b/src/types/search.ts index cb42e68..196ecfd 100644 --- a/src/types/search.ts +++ b/src/types/search.ts @@ -11,6 +11,7 @@ export type SearchBase = { scoreThreshold?: number; dynamicScorePercentage?: number; filter?: Array>; + sortDocsOn?: string; }; export type SemanticSearchBase = SearchBase;