mbd-studio-sdk 4.1.1 → 4.1.2

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/V1/Studio.js CHANGED
@@ -158,6 +158,26 @@ export class Studio {
158
158
  }
159
159
  this._candidates.sort((a, b) => (b._ranking_score ?? -Infinity) - (a._ranking_score ?? -Infinity));
160
160
  }
161
+ getFeed() {
162
+ return this._candidates;
163
+ }
164
+ dropFeatures() {
165
+ for (const c of this._candidates) {
166
+ delete c._features;
167
+ }
168
+ }
169
+ dropVectors() {
170
+ const keys = ['text_vector', 'item_sem_embed', 'item_sem_embed2'];
171
+ for (const c of this._candidates) {
172
+ const src = c._source;
173
+ if (src && typeof src === 'object') {
174
+ for (const k of keys) delete src[k];
175
+ }
176
+ }
177
+ }
178
+ transform(fn) {
179
+ this._candidates = this._candidates.map(fn);
180
+ }
161
181
  log(string) {
162
182
  this._log(string);
163
183
  }
@@ -165,7 +185,4 @@ export class Studio {
165
185
  if (results === undefined) results = this._candidates;
166
186
  this._show(results);
167
187
  }
168
- getFeed() {
169
- return this._candidates;
170
- }
171
188
  }
package/index.d.ts CHANGED
@@ -52,10 +52,13 @@ export interface SearchResult {
52
52
  max_score?: number;
53
53
  }
54
54
 
55
- export interface FrequentValuesResult {
56
- [key: string]: unknown;
55
+ export interface FrequentValueItem {
56
+ id: string | number;
57
+ count: number;
57
58
  }
58
59
 
60
+ export type FrequentValuesResult = FrequentValueItem[];
61
+
59
62
  export class Search {
60
63
  lastCall: { endpoint: string; payload: unknown } | null;
61
64
  lastResult: unknown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mbd-studio-sdk",
3
- "version": "4.1.1",
3
+ "version": "4.1.2",
4
4
  "description": "SDK for Embed Recommendation Engine APIs",
5
5
  "keywords": [
6
6
  "web3",