@dakera-ai/dakera 0.7.3 → 0.8.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/dist/index.d.mts +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.js +19 -8
- package/dist/index.mjs +19 -8
- package/package.json +1 -2
package/dist/index.d.mts
CHANGED
|
@@ -1405,21 +1405,29 @@ declare class DakeraClient {
|
|
|
1405
1405
|
/**
|
|
1406
1406
|
* Perform hybrid search combining vector and full-text.
|
|
1407
1407
|
*
|
|
1408
|
+
* When `vector` is omitted the server falls back to BM25-only full-text
|
|
1409
|
+
* search. When provided, results are blended with vector similarity
|
|
1410
|
+
* according to `alpha`.
|
|
1411
|
+
*
|
|
1408
1412
|
* @param namespace - Target namespace
|
|
1409
|
-
* @param vector - Query vector
|
|
1410
1413
|
* @param query - Text query
|
|
1411
|
-
* @param options - Search options
|
|
1414
|
+
* @param options - Search options: vector (optional), topK, alpha, filter
|
|
1412
1415
|
* @returns Hybrid search results
|
|
1413
1416
|
*
|
|
1414
1417
|
* @example
|
|
1415
1418
|
* ```typescript
|
|
1416
|
-
*
|
|
1419
|
+
* // Hybrid (vector + text)
|
|
1420
|
+
* const results = await client.hybridSearch('my-namespace', 'machine learning', {
|
|
1421
|
+
* vector: [0.1, 0.2, 0.3],
|
|
1417
1422
|
* topK: 10,
|
|
1418
1423
|
* alpha: 0.7, // 70% text, 30% vector
|
|
1419
1424
|
* });
|
|
1425
|
+
* // BM25-only (no vector)
|
|
1426
|
+
* const results = await client.hybridSearch('my-namespace', 'machine learning');
|
|
1420
1427
|
* ```
|
|
1421
1428
|
*/
|
|
1422
|
-
hybridSearch(namespace: string,
|
|
1429
|
+
hybridSearch(namespace: string, query: string, options?: {
|
|
1430
|
+
vector?: number[];
|
|
1423
1431
|
topK?: number;
|
|
1424
1432
|
alpha?: number;
|
|
1425
1433
|
filter?: FilterExpression;
|
package/dist/index.d.ts
CHANGED
|
@@ -1405,21 +1405,29 @@ declare class DakeraClient {
|
|
|
1405
1405
|
/**
|
|
1406
1406
|
* Perform hybrid search combining vector and full-text.
|
|
1407
1407
|
*
|
|
1408
|
+
* When `vector` is omitted the server falls back to BM25-only full-text
|
|
1409
|
+
* search. When provided, results are blended with vector similarity
|
|
1410
|
+
* according to `alpha`.
|
|
1411
|
+
*
|
|
1408
1412
|
* @param namespace - Target namespace
|
|
1409
|
-
* @param vector - Query vector
|
|
1410
1413
|
* @param query - Text query
|
|
1411
|
-
* @param options - Search options
|
|
1414
|
+
* @param options - Search options: vector (optional), topK, alpha, filter
|
|
1412
1415
|
* @returns Hybrid search results
|
|
1413
1416
|
*
|
|
1414
1417
|
* @example
|
|
1415
1418
|
* ```typescript
|
|
1416
|
-
*
|
|
1419
|
+
* // Hybrid (vector + text)
|
|
1420
|
+
* const results = await client.hybridSearch('my-namespace', 'machine learning', {
|
|
1421
|
+
* vector: [0.1, 0.2, 0.3],
|
|
1417
1422
|
* topK: 10,
|
|
1418
1423
|
* alpha: 0.7, // 70% text, 30% vector
|
|
1419
1424
|
* });
|
|
1425
|
+
* // BM25-only (no vector)
|
|
1426
|
+
* const results = await client.hybridSearch('my-namespace', 'machine learning');
|
|
1420
1427
|
* ```
|
|
1421
1428
|
*/
|
|
1422
|
-
hybridSearch(namespace: string,
|
|
1429
|
+
hybridSearch(namespace: string, query: string, options?: {
|
|
1430
|
+
vector?: number[];
|
|
1423
1431
|
topK?: number;
|
|
1424
1432
|
alpha?: number;
|
|
1425
1433
|
filter?: FilterExpression;
|
package/dist/index.js
CHANGED
|
@@ -500,31 +500,42 @@ var DakeraClient = class {
|
|
|
500
500
|
/**
|
|
501
501
|
* Perform hybrid search combining vector and full-text.
|
|
502
502
|
*
|
|
503
|
+
* When `vector` is omitted the server falls back to BM25-only full-text
|
|
504
|
+
* search. When provided, results are blended with vector similarity
|
|
505
|
+
* according to `alpha`.
|
|
506
|
+
*
|
|
503
507
|
* @param namespace - Target namespace
|
|
504
|
-
* @param vector - Query vector
|
|
505
508
|
* @param query - Text query
|
|
506
|
-
* @param options - Search options
|
|
509
|
+
* @param options - Search options: vector (optional), topK, alpha, filter
|
|
507
510
|
* @returns Hybrid search results
|
|
508
511
|
*
|
|
509
512
|
* @example
|
|
510
513
|
* ```typescript
|
|
511
|
-
*
|
|
514
|
+
* // Hybrid (vector + text)
|
|
515
|
+
* const results = await client.hybridSearch('my-namespace', 'machine learning', {
|
|
516
|
+
* vector: [0.1, 0.2, 0.3],
|
|
512
517
|
* topK: 10,
|
|
513
518
|
* alpha: 0.7, // 70% text, 30% vector
|
|
514
519
|
* });
|
|
520
|
+
* // BM25-only (no vector)
|
|
521
|
+
* const results = await client.hybridSearch('my-namespace', 'machine learning');
|
|
515
522
|
* ```
|
|
516
523
|
*/
|
|
517
|
-
async hybridSearch(namespace,
|
|
524
|
+
async hybridSearch(namespace, query, options = {}) {
|
|
518
525
|
const body = {
|
|
519
|
-
vector,
|
|
520
526
|
query,
|
|
521
527
|
top_k: options.topK ?? 10,
|
|
522
|
-
alpha: options.alpha ?? 0.5
|
|
523
|
-
filter: options.filter
|
|
528
|
+
alpha: options.alpha ?? 0.5
|
|
524
529
|
};
|
|
530
|
+
if (options.vector != null) {
|
|
531
|
+
body["vector"] = options.vector;
|
|
532
|
+
}
|
|
533
|
+
if (options.filter !== void 0) {
|
|
534
|
+
body["filter"] = options.filter;
|
|
535
|
+
}
|
|
525
536
|
const response = await this.request(
|
|
526
537
|
"POST",
|
|
527
|
-
`/v1/namespaces/${namespace}/
|
|
538
|
+
`/v1/namespaces/${namespace}/hybrid`,
|
|
528
539
|
body
|
|
529
540
|
);
|
|
530
541
|
return response.results;
|
package/dist/index.mjs
CHANGED
|
@@ -460,31 +460,42 @@ var DakeraClient = class {
|
|
|
460
460
|
/**
|
|
461
461
|
* Perform hybrid search combining vector and full-text.
|
|
462
462
|
*
|
|
463
|
+
* When `vector` is omitted the server falls back to BM25-only full-text
|
|
464
|
+
* search. When provided, results are blended with vector similarity
|
|
465
|
+
* according to `alpha`.
|
|
466
|
+
*
|
|
463
467
|
* @param namespace - Target namespace
|
|
464
|
-
* @param vector - Query vector
|
|
465
468
|
* @param query - Text query
|
|
466
|
-
* @param options - Search options
|
|
469
|
+
* @param options - Search options: vector (optional), topK, alpha, filter
|
|
467
470
|
* @returns Hybrid search results
|
|
468
471
|
*
|
|
469
472
|
* @example
|
|
470
473
|
* ```typescript
|
|
471
|
-
*
|
|
474
|
+
* // Hybrid (vector + text)
|
|
475
|
+
* const results = await client.hybridSearch('my-namespace', 'machine learning', {
|
|
476
|
+
* vector: [0.1, 0.2, 0.3],
|
|
472
477
|
* topK: 10,
|
|
473
478
|
* alpha: 0.7, // 70% text, 30% vector
|
|
474
479
|
* });
|
|
480
|
+
* // BM25-only (no vector)
|
|
481
|
+
* const results = await client.hybridSearch('my-namespace', 'machine learning');
|
|
475
482
|
* ```
|
|
476
483
|
*/
|
|
477
|
-
async hybridSearch(namespace,
|
|
484
|
+
async hybridSearch(namespace, query, options = {}) {
|
|
478
485
|
const body = {
|
|
479
|
-
vector,
|
|
480
486
|
query,
|
|
481
487
|
top_k: options.topK ?? 10,
|
|
482
|
-
alpha: options.alpha ?? 0.5
|
|
483
|
-
filter: options.filter
|
|
488
|
+
alpha: options.alpha ?? 0.5
|
|
484
489
|
};
|
|
490
|
+
if (options.vector != null) {
|
|
491
|
+
body["vector"] = options.vector;
|
|
492
|
+
}
|
|
493
|
+
if (options.filter !== void 0) {
|
|
494
|
+
body["filter"] = options.filter;
|
|
495
|
+
}
|
|
485
496
|
const response = await this.request(
|
|
486
497
|
"POST",
|
|
487
|
-
`/v1/namespaces/${namespace}/
|
|
498
|
+
`/v1/namespaces/${namespace}/hybrid`,
|
|
488
499
|
body
|
|
489
500
|
);
|
|
490
501
|
return response.results;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dakera-ai/dakera",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "TypeScript/JavaScript SDK for Dakera AI memory platform",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -57,4 +57,3 @@
|
|
|
57
57
|
"vitest": "^4.1.0"
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
|