@dotcms/types 1.2.0-next.2 → 1.2.0-next.4
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/README.md +58 -2
- package/index.cjs.js +77 -0
- package/index.esm.js +76 -1
- package/package.json +1 -1
- package/src/index.d.ts +1 -0
- package/src/lib/ai/public.d.ts +197 -0
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ The `@dotcms/types` package contains TypeScript type definitions for the dotCMS
|
|
|
11
11
|
- [Installation](#installation)
|
|
12
12
|
- [Commonly Used Types](#commonly-used-types)
|
|
13
13
|
- [Type Hierarchy (Jump to Definitions)](#type-hierarchy-jump-to-definitions)
|
|
14
|
+
- [AI Search](#ai-search)
|
|
14
15
|
- [dotCMS Content & Pages](#dotcms-content--pages)
|
|
15
16
|
- [Universal Visual Editor (UVE)](#universal-visual-editor-uve)
|
|
16
17
|
- [Block Editor](#block-editor)
|
|
@@ -57,12 +58,42 @@ import {
|
|
|
57
58
|
DotHttpError,
|
|
58
59
|
DotErrorPage,
|
|
59
60
|
DotErrorContent,
|
|
60
|
-
DotErrorNavigation
|
|
61
|
+
DotErrorNavigation,
|
|
62
|
+
DotErrorAISearch,
|
|
63
|
+
DotCMSAISearchParams,
|
|
64
|
+
DISTANCE_FUNCTIONS
|
|
61
65
|
} from '@dotcms/types';
|
|
62
66
|
```
|
|
63
67
|
|
|
64
68
|
## Type Hierarchy (Jump to Definitions)
|
|
65
69
|
|
|
70
|
+
### AI Search
|
|
71
|
+
|
|
72
|
+
> **⚠️ Experimental:** The AI Search types are experimental and may undergo breaking changes in future releases.
|
|
73
|
+
|
|
74
|
+
**AI Search Parameters:**
|
|
75
|
+
|
|
76
|
+
| Type | Description |
|
|
77
|
+
|------|-------------|
|
|
78
|
+
| [DotCMSAISearchParams](https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/types/src/lib/ai/public.ts#L85) | Complete AI search parameters including query and AI config |
|
|
79
|
+
| [DotCMSAISearchQuery](https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/types/src/lib/ai/public.ts#L9) | Query parameters (limit, offset, contentType, etc.) |
|
|
80
|
+
| [DotCMSAIConfig](https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/types/src/lib/ai/public.ts#L50) | AI configuration (threshold, distanceFunction, responseLength) |
|
|
81
|
+
| [DISTANCE_FUNCTIONS](https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/types/src/lib/ai/public.ts#L103) | Available distance functions for vector similarity |
|
|
82
|
+
|
|
83
|
+
**AI Search Response:**
|
|
84
|
+
|
|
85
|
+
| Type | Description |
|
|
86
|
+
|------|-------------|
|
|
87
|
+
| [DotCMSAISearchResponse](https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/types/src/lib/ai/public.ts#L182) | AI search API response structure |
|
|
88
|
+
| [DotCMSAISearchContentletData](https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/types/src/lib/ai/public.ts#L213) | Contentlet with AI match information |
|
|
89
|
+
| [DotCMSAISearchMatch](https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/types/src/lib/ai/public.ts#L195) | Individual match with distance score and extracted text |
|
|
90
|
+
|
|
91
|
+
**AI Search Errors:**
|
|
92
|
+
|
|
93
|
+
| Type | Description |
|
|
94
|
+
|------|-------------|
|
|
95
|
+
| [DotErrorAISearch](https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/types/src/lib/ai/public.ts#L136) | AI Search API specific error with prompt, indexName and params context |
|
|
96
|
+
|
|
66
97
|
### dotCMS Content & Pages
|
|
67
98
|
|
|
68
99
|
**Page:**
|
|
@@ -166,6 +197,7 @@ import {
|
|
|
166
197
|
| [DotErrorPage](https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/types/src/lib/page/public.ts#L1253) | Page API errors with GraphQL context |
|
|
167
198
|
| [DotErrorContent](https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/types/src/lib/content/public.ts#L7) | Content API specific error handling |
|
|
168
199
|
| [DotErrorNavigation](https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/types/src/lib/nav/public.ts#L7) | Navigation API error handling |
|
|
200
|
+
| [DotErrorAISearch](https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/types/src/lib/ai/public.ts#L136) | AI Search API error handling with prompt and params |
|
|
169
201
|
|
|
170
202
|
## Usage Examples
|
|
171
203
|
|
|
@@ -176,7 +208,8 @@ import {
|
|
|
176
208
|
DotHttpError,
|
|
177
209
|
DotErrorPage,
|
|
178
210
|
DotErrorContent,
|
|
179
|
-
DotErrorNavigation
|
|
211
|
+
DotErrorNavigation,
|
|
212
|
+
DotErrorAISearch
|
|
180
213
|
} from '@dotcms/types';
|
|
181
214
|
|
|
182
215
|
// Type-safe error handling
|
|
@@ -195,6 +228,13 @@ if (error instanceof DotErrorContent) {
|
|
|
195
228
|
// Content-specific error context
|
|
196
229
|
console.error(`${error.operation} failed for ${error.contentType}`);
|
|
197
230
|
}
|
|
231
|
+
|
|
232
|
+
if (error instanceof DotErrorAISearch) {
|
|
233
|
+
// AI Search-specific error context
|
|
234
|
+
console.error('AI Search failed for prompt:', error.prompt);
|
|
235
|
+
console.error('Index name:', error.indexName);
|
|
236
|
+
console.error('Search params:', error.params);
|
|
237
|
+
}
|
|
198
238
|
```
|
|
199
239
|
|
|
200
240
|
> **Note**: For complete implementation examples and usage patterns, see the [@dotcms/client](../client/README.md) package documentation.
|
|
@@ -229,6 +269,22 @@ Please ensure your code follows the existing style and includes appropriate test
|
|
|
229
269
|
|
|
230
270
|
## Changelog
|
|
231
271
|
|
|
272
|
+
### [1.3.0]
|
|
273
|
+
|
|
274
|
+
#### ✨ Added - AI Search Types (Experimental)
|
|
275
|
+
|
|
276
|
+
> **⚠️ Experimental:** AI Search types are experimental and may undergo breaking changes in future releases.
|
|
277
|
+
|
|
278
|
+
**New AI Search Types:**
|
|
279
|
+
- `DotCMSAISearchParams` - Complete AI search parameters including query and AI config
|
|
280
|
+
- `DotCMSAISearchQuery` - Query parameters (limit, offset, contentType, etc.)
|
|
281
|
+
- `DotCMSAIConfig` - AI configuration (threshold, distanceFunction, responseLength)
|
|
282
|
+
- `DotCMSAISearchResponse<T>` - AI search API response structure
|
|
283
|
+
- `DotCMSAISearchContentletData<T>` - Contentlet with AI match information
|
|
284
|
+
- `DotCMSAISearchMatch` - Individual match with distance score and extracted text
|
|
285
|
+
- `DotErrorAISearch` - AI Search API specific error with prompt, indexName, and params context
|
|
286
|
+
- `DISTANCE_FUNCTIONS` - Available distance functions for vector similarity (cosine, L2, inner product, etc.)
|
|
287
|
+
|
|
232
288
|
### [1.1.1]
|
|
233
289
|
|
|
234
290
|
#### Added
|
package/index.cjs.js
CHANGED
|
@@ -248,6 +248,11 @@ class DotHttpError extends Error {
|
|
|
248
248
|
* ```
|
|
249
249
|
*/
|
|
250
250
|
class BaseHttpClient {
|
|
251
|
+
// This is my proposal to add this method to the class. We will need to stream data on AI Gen/Chat
|
|
252
|
+
// abstract requestStream(
|
|
253
|
+
// url: string,
|
|
254
|
+
// options?: DotRequestOptions
|
|
255
|
+
// ): Promise<{ body: ReadableStream<BufferSource>; contentLength: number }>;
|
|
251
256
|
/**
|
|
252
257
|
* Creates a standardized HttpError from HTTP response details.
|
|
253
258
|
* Handles parsing of error response body automatically.
|
|
@@ -356,8 +361,80 @@ class DotErrorNavigation extends Error {
|
|
|
356
361
|
}
|
|
357
362
|
}
|
|
358
363
|
|
|
364
|
+
/**
|
|
365
|
+
* The distance functions for the search results.
|
|
366
|
+
* @public
|
|
367
|
+
* @constant DISTANCE_FUNCTIONS
|
|
368
|
+
*/
|
|
369
|
+
const DISTANCE_FUNCTIONS = {
|
|
370
|
+
/**
|
|
371
|
+
* The L2 distance function.
|
|
372
|
+
* @constant L2 - The L2 distance function.
|
|
373
|
+
*/
|
|
374
|
+
L2: '<->',
|
|
375
|
+
/**
|
|
376
|
+
* The inner product distance function.
|
|
377
|
+
* @constant innerProduct - The inner product distance function.
|
|
378
|
+
*/
|
|
379
|
+
innerProduct: '<#>',
|
|
380
|
+
cosine: '<=>',
|
|
381
|
+
/**
|
|
382
|
+
* The L1 distance function.
|
|
383
|
+
* @constant L1 - The L1 distance function.
|
|
384
|
+
*/
|
|
385
|
+
L1: '<+>',
|
|
386
|
+
/**
|
|
387
|
+
* The hamming distance function.
|
|
388
|
+
* @constant hamming - The hamming distance function.
|
|
389
|
+
*/
|
|
390
|
+
hamming: '<~>',
|
|
391
|
+
/**
|
|
392
|
+
* The jaccard distance function.
|
|
393
|
+
* @constant jaccard - The jaccard distance function.
|
|
394
|
+
*/
|
|
395
|
+
jaccard: '<%>'
|
|
396
|
+
};
|
|
397
|
+
/**
|
|
398
|
+
* AI Search API specific error class
|
|
399
|
+
* Wraps HTTP errors and adds AI search-specific context including query information
|
|
400
|
+
*/
|
|
401
|
+
class DotErrorAISearch extends Error {
|
|
402
|
+
constructor({
|
|
403
|
+
message,
|
|
404
|
+
httpError,
|
|
405
|
+
prompt,
|
|
406
|
+
params,
|
|
407
|
+
indexName
|
|
408
|
+
}) {
|
|
409
|
+
super(message);
|
|
410
|
+
this.name = 'DotCMAISearchError';
|
|
411
|
+
this.httpError = httpError;
|
|
412
|
+
this.prompt = prompt;
|
|
413
|
+
this.params = params;
|
|
414
|
+
this.indexName = indexName;
|
|
415
|
+
// Ensure proper prototype chain for instanceof checks
|
|
416
|
+
Object.setPrototypeOf(this, DotErrorAISearch.prototype);
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Serializes the error to a plain object for logging or transmission
|
|
420
|
+
*/
|
|
421
|
+
toJSON() {
|
|
422
|
+
return {
|
|
423
|
+
name: this.name,
|
|
424
|
+
message: this.message,
|
|
425
|
+
httpError: this.httpError?.toJSON(),
|
|
426
|
+
prompt: this.prompt,
|
|
427
|
+
params: this.params,
|
|
428
|
+
indexName: this.indexName,
|
|
429
|
+
stack: this.stack
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
359
434
|
exports.BaseHttpClient = BaseHttpClient;
|
|
360
435
|
exports.DEVELOPMENT_MODE = DEVELOPMENT_MODE;
|
|
436
|
+
exports.DISTANCE_FUNCTIONS = DISTANCE_FUNCTIONS;
|
|
437
|
+
exports.DotErrorAISearch = DotErrorAISearch;
|
|
361
438
|
exports.DotErrorContent = DotErrorContent;
|
|
362
439
|
exports.DotErrorNavigation = DotErrorNavigation;
|
|
363
440
|
exports.DotErrorPage = DotErrorPage;
|
package/index.esm.js
CHANGED
|
@@ -246,6 +246,11 @@ class DotHttpError extends Error {
|
|
|
246
246
|
* ```
|
|
247
247
|
*/
|
|
248
248
|
class BaseHttpClient {
|
|
249
|
+
// This is my proposal to add this method to the class. We will need to stream data on AI Gen/Chat
|
|
250
|
+
// abstract requestStream(
|
|
251
|
+
// url: string,
|
|
252
|
+
// options?: DotRequestOptions
|
|
253
|
+
// ): Promise<{ body: ReadableStream<BufferSource>; contentLength: number }>;
|
|
249
254
|
/**
|
|
250
255
|
* Creates a standardized HttpError from HTTP response details.
|
|
251
256
|
* Handles parsing of error response body automatically.
|
|
@@ -354,4 +359,74 @@ class DotErrorNavigation extends Error {
|
|
|
354
359
|
}
|
|
355
360
|
}
|
|
356
361
|
|
|
357
|
-
|
|
362
|
+
/**
|
|
363
|
+
* The distance functions for the search results.
|
|
364
|
+
* @public
|
|
365
|
+
* @constant DISTANCE_FUNCTIONS
|
|
366
|
+
*/
|
|
367
|
+
const DISTANCE_FUNCTIONS = {
|
|
368
|
+
/**
|
|
369
|
+
* The L2 distance function.
|
|
370
|
+
* @constant L2 - The L2 distance function.
|
|
371
|
+
*/
|
|
372
|
+
L2: '<->',
|
|
373
|
+
/**
|
|
374
|
+
* The inner product distance function.
|
|
375
|
+
* @constant innerProduct - The inner product distance function.
|
|
376
|
+
*/
|
|
377
|
+
innerProduct: '<#>',
|
|
378
|
+
cosine: '<=>',
|
|
379
|
+
/**
|
|
380
|
+
* The L1 distance function.
|
|
381
|
+
* @constant L1 - The L1 distance function.
|
|
382
|
+
*/
|
|
383
|
+
L1: '<+>',
|
|
384
|
+
/**
|
|
385
|
+
* The hamming distance function.
|
|
386
|
+
* @constant hamming - The hamming distance function.
|
|
387
|
+
*/
|
|
388
|
+
hamming: '<~>',
|
|
389
|
+
/**
|
|
390
|
+
* The jaccard distance function.
|
|
391
|
+
* @constant jaccard - The jaccard distance function.
|
|
392
|
+
*/
|
|
393
|
+
jaccard: '<%>'
|
|
394
|
+
};
|
|
395
|
+
/**
|
|
396
|
+
* AI Search API specific error class
|
|
397
|
+
* Wraps HTTP errors and adds AI search-specific context including query information
|
|
398
|
+
*/
|
|
399
|
+
class DotErrorAISearch extends Error {
|
|
400
|
+
constructor({
|
|
401
|
+
message,
|
|
402
|
+
httpError,
|
|
403
|
+
prompt,
|
|
404
|
+
params,
|
|
405
|
+
indexName
|
|
406
|
+
}) {
|
|
407
|
+
super(message);
|
|
408
|
+
this.name = 'DotCMAISearchError';
|
|
409
|
+
this.httpError = httpError;
|
|
410
|
+
this.prompt = prompt;
|
|
411
|
+
this.params = params;
|
|
412
|
+
this.indexName = indexName;
|
|
413
|
+
// Ensure proper prototype chain for instanceof checks
|
|
414
|
+
Object.setPrototypeOf(this, DotErrorAISearch.prototype);
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Serializes the error to a plain object for logging or transmission
|
|
418
|
+
*/
|
|
419
|
+
toJSON() {
|
|
420
|
+
return {
|
|
421
|
+
name: this.name,
|
|
422
|
+
message: this.message,
|
|
423
|
+
httpError: this.httpError?.toJSON(),
|
|
424
|
+
prompt: this.prompt,
|
|
425
|
+
params: this.params,
|
|
426
|
+
indexName: this.indexName,
|
|
427
|
+
stack: this.stack
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
export { BaseHttpClient, DEVELOPMENT_MODE, DISTANCE_FUNCTIONS, DotCMSUVEAction, DotErrorAISearch, DotErrorContent, DotErrorNavigation, DotErrorPage, DotHttpError, PRODUCTION_MODE, UVEEventType, UVE_MODE };
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { DotHttpError } from '../client/public';
|
|
2
|
+
import { DotCMSBasicContentlet } from '../page/public';
|
|
3
|
+
/**
|
|
4
|
+
* Query parameters for AI search - defines what and where to search
|
|
5
|
+
* @public
|
|
6
|
+
* @interface DotCMSAISearchQuery
|
|
7
|
+
*/
|
|
8
|
+
export interface DotCMSAISearchQuery {
|
|
9
|
+
/**
|
|
10
|
+
* The limit of the search results.
|
|
11
|
+
* @property {number} limit - The limit of the search results.
|
|
12
|
+
* @default 1000
|
|
13
|
+
*/
|
|
14
|
+
limit?: number;
|
|
15
|
+
/**
|
|
16
|
+
* The offset of the search results.
|
|
17
|
+
* @property {number} offset - The offset of the search results.
|
|
18
|
+
* @default 0
|
|
19
|
+
*/
|
|
20
|
+
offset?: number;
|
|
21
|
+
/**
|
|
22
|
+
* The site identifier.
|
|
23
|
+
* @property {string} siteId - The site identifier.
|
|
24
|
+
*/
|
|
25
|
+
siteId?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The content type you want to search for.
|
|
28
|
+
* @property {string} contentType - The content type you want to search for.
|
|
29
|
+
*/
|
|
30
|
+
contentType?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The language id to search in.
|
|
33
|
+
* @property {number | string} languageId - The language id to search in.
|
|
34
|
+
*/
|
|
35
|
+
languageId?: number | string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* AI configuration parameters - controls how AI processes the results
|
|
39
|
+
* @public
|
|
40
|
+
* @interface DotCMSAIConfig
|
|
41
|
+
*/
|
|
42
|
+
export interface DotCMSAIConfig {
|
|
43
|
+
/**
|
|
44
|
+
* The threshold for the search results.
|
|
45
|
+
* @property {number} threshold - The threshold for the search results.
|
|
46
|
+
* @default 0.5
|
|
47
|
+
*/
|
|
48
|
+
threshold?: number;
|
|
49
|
+
/**
|
|
50
|
+
* The distance function for the search results.
|
|
51
|
+
* Possible values:
|
|
52
|
+
*
|
|
53
|
+
* - <-> - L2 distance
|
|
54
|
+
* - <#> - (negative) inner product
|
|
55
|
+
* - <=> - cosine distance
|
|
56
|
+
* - <+> - L1 distance
|
|
57
|
+
* - <~> - Hamming distance (binary vectors)
|
|
58
|
+
* - <%> - Jaccard distance (binary vectors)
|
|
59
|
+
* @default DISTANCE_FUNCTIONS.cosine
|
|
60
|
+
* @see {@link https://platform.openai.com/docs/guides/embeddings/which-distance-function-should-i-use#which-distance-function-should-i-use} - OpenAI documentation for the distance functions
|
|
61
|
+
* @property {string} distanceFunction - The distance function for the search results.
|
|
62
|
+
*/
|
|
63
|
+
distanceFunction?: (typeof DISTANCE_FUNCTIONS)[keyof typeof DISTANCE_FUNCTIONS];
|
|
64
|
+
/**
|
|
65
|
+
* The length of the response.
|
|
66
|
+
* @property {number} responseLength - The length of the response.
|
|
67
|
+
* @default 1024
|
|
68
|
+
*/
|
|
69
|
+
responseLength?: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Parameters for making an AI search request to DotCMS.
|
|
73
|
+
* @public
|
|
74
|
+
* @interface DotCMSAISearchParams
|
|
75
|
+
*/
|
|
76
|
+
export interface DotCMSAISearchParams {
|
|
77
|
+
/**
|
|
78
|
+
* Query parameters defining what and where to search.
|
|
79
|
+
* @property {DotCMSAISearchQuery} query - The search query parameters.
|
|
80
|
+
*/
|
|
81
|
+
query?: DotCMSAISearchQuery;
|
|
82
|
+
/**
|
|
83
|
+
* AI configuration parameters controlling how results are processed.
|
|
84
|
+
* @property {DotCMSAIConfig} config - The AI configuration parameters.
|
|
85
|
+
*/
|
|
86
|
+
config?: DotCMSAIConfig;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The distance functions for the search results.
|
|
90
|
+
* @public
|
|
91
|
+
* @constant DISTANCE_FUNCTIONS
|
|
92
|
+
*/
|
|
93
|
+
export declare const DISTANCE_FUNCTIONS: {
|
|
94
|
+
/**
|
|
95
|
+
* The L2 distance function.
|
|
96
|
+
* @constant L2 - The L2 distance function.
|
|
97
|
+
*/
|
|
98
|
+
readonly L2: "<->";
|
|
99
|
+
/**
|
|
100
|
+
* The inner product distance function.
|
|
101
|
+
* @constant innerProduct - The inner product distance function.
|
|
102
|
+
*/
|
|
103
|
+
readonly innerProduct: "<#>";
|
|
104
|
+
readonly cosine: "<=>";
|
|
105
|
+
/**
|
|
106
|
+
* The L1 distance function.
|
|
107
|
+
* @constant L1 - The L1 distance function.
|
|
108
|
+
*/
|
|
109
|
+
readonly L1: "<+>";
|
|
110
|
+
/**
|
|
111
|
+
* The hamming distance function.
|
|
112
|
+
* @constant hamming - The hamming distance function.
|
|
113
|
+
*/
|
|
114
|
+
readonly hamming: "<~>";
|
|
115
|
+
/**
|
|
116
|
+
* The jaccard distance function.
|
|
117
|
+
* @constant jaccard - The jaccard distance function.
|
|
118
|
+
*/
|
|
119
|
+
readonly jaccard: "<%>";
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* AI Search API specific error class
|
|
123
|
+
* Wraps HTTP errors and adds AI search-specific context including query information
|
|
124
|
+
*/
|
|
125
|
+
export declare class DotErrorAISearch extends Error {
|
|
126
|
+
readonly httpError?: DotHttpError;
|
|
127
|
+
readonly prompt?: string;
|
|
128
|
+
readonly params?: DotCMSAISearchParams;
|
|
129
|
+
readonly indexName?: string;
|
|
130
|
+
constructor({ message, httpError, prompt, params, indexName }: {
|
|
131
|
+
message: string;
|
|
132
|
+
httpError?: DotHttpError;
|
|
133
|
+
prompt?: string;
|
|
134
|
+
params?: DotCMSAISearchParams;
|
|
135
|
+
indexName?: string;
|
|
136
|
+
});
|
|
137
|
+
/**
|
|
138
|
+
* Serializes the error to a plain object for logging or transmission
|
|
139
|
+
*/
|
|
140
|
+
toJSON(): {
|
|
141
|
+
name: string;
|
|
142
|
+
message: string;
|
|
143
|
+
httpError: {
|
|
144
|
+
name: string;
|
|
145
|
+
message: string;
|
|
146
|
+
status: number;
|
|
147
|
+
statusText: string;
|
|
148
|
+
data: unknown;
|
|
149
|
+
stack: string | undefined;
|
|
150
|
+
} | undefined;
|
|
151
|
+
prompt: string | undefined;
|
|
152
|
+
params: DotCMSAISearchParams | undefined;
|
|
153
|
+
indexName: string | undefined;
|
|
154
|
+
stack: string | undefined;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* The response from the AI search.
|
|
159
|
+
* @public
|
|
160
|
+
* @interface DotCMSAISearchResponse
|
|
161
|
+
*/
|
|
162
|
+
export interface DotCMSAISearchResponse<T extends DotCMSBasicContentlet> {
|
|
163
|
+
/**
|
|
164
|
+
* The results from the AI search.
|
|
165
|
+
* @property {DotCMSAISearchContentletData<T>[]} dotCMSResults - The results from the AI search.
|
|
166
|
+
*/
|
|
167
|
+
dotCMSResults: DotCMSAISearchContentletData<T>[];
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* The match from the AI search.
|
|
171
|
+
* @public
|
|
172
|
+
* @interface DotCMSAISearchMatch
|
|
173
|
+
*/
|
|
174
|
+
export interface DotCMSAISearchMatch {
|
|
175
|
+
/**
|
|
176
|
+
* The distance from the AI search.
|
|
177
|
+
* @property {number} distance - The distance from the AI search.
|
|
178
|
+
*/
|
|
179
|
+
distance: number;
|
|
180
|
+
/**
|
|
181
|
+
* The extracted text from the AI search.
|
|
182
|
+
* @property {string} extractedText - The extracted text from the AI search.
|
|
183
|
+
*/
|
|
184
|
+
extractedText: string;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* The contentlet data from the AI search.
|
|
188
|
+
* @public
|
|
189
|
+
* @interface DotCMSAISearchContentletData
|
|
190
|
+
*/
|
|
191
|
+
export type DotCMSAISearchContentletData<T extends DotCMSBasicContentlet> = T & {
|
|
192
|
+
/**
|
|
193
|
+
* The matches from the AI search.
|
|
194
|
+
* @property {DotCMSAISearchMatch[]} matches - The matches from the AI search.
|
|
195
|
+
*/
|
|
196
|
+
matches?: DotCMSAISearchMatch[];
|
|
197
|
+
};
|