@or-sdk/knowledge-models 0.12.0

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.
Files changed (40) hide show
  1. package/dist/cjs/KnowledgeModels.js +1244 -0
  2. package/dist/cjs/KnowledgeModels.js.map +1 -0
  3. package/dist/cjs/constants.js +5 -0
  4. package/dist/cjs/constants.js.map +1 -0
  5. package/dist/cjs/index.js +17 -0
  6. package/dist/cjs/index.js.map +1 -0
  7. package/dist/cjs/types.js +3 -0
  8. package/dist/cjs/types.js.map +1 -0
  9. package/dist/cjs/utils/getEntityBody.js +40 -0
  10. package/dist/cjs/utils/getEntityBody.js.map +1 -0
  11. package/dist/cjs/utils/index.js +9 -0
  12. package/dist/cjs/utils/index.js.map +1 -0
  13. package/dist/esm/KnowledgeModels.js +860 -0
  14. package/dist/esm/KnowledgeModels.js.map +1 -0
  15. package/dist/esm/constants.js +2 -0
  16. package/dist/esm/constants.js.map +1 -0
  17. package/dist/esm/index.js +3 -0
  18. package/dist/esm/index.js.map +1 -0
  19. package/dist/esm/types.js +2 -0
  20. package/dist/esm/types.js.map +1 -0
  21. package/dist/esm/utils/getEntityBody.js +27 -0
  22. package/dist/esm/utils/getEntityBody.js.map +1 -0
  23. package/dist/esm/utils/index.js +2 -0
  24. package/dist/esm/utils/index.js.map +1 -0
  25. package/dist/types/KnowledgeModels.d.ts +331 -0
  26. package/dist/types/constants.d.ts +1 -0
  27. package/dist/types/index.d.ts +2 -0
  28. package/dist/types/types.d.ts +306 -0
  29. package/dist/types/utils/getEntityBody.d.ts +6 -0
  30. package/dist/types/utils/index.d.ts +1 -0
  31. package/package.json +29 -0
  32. package/src/KnowledgeModels.ts +1302 -0
  33. package/src/constants.ts +1 -0
  34. package/src/index.ts +2 -0
  35. package/src/types.ts +347 -0
  36. package/src/utils/getEntityBody.ts +37 -0
  37. package/src/utils/index.ts +4 -0
  38. package/tsconfig.esm.json +9 -0
  39. package/tsconfig.json +7 -0
  40. package/tsconfig.types.json +9 -0
@@ -0,0 +1,306 @@
1
+ import { Token } from '@or-sdk/base';
2
+ export declare type KnowledgeModelsConfig = {
3
+ token: Token;
4
+ discoveryUrl: string;
5
+ };
6
+ export declare type Version = {
7
+ versionId: string;
8
+ trainStatus: {
9
+ status: string;
10
+ message: string;
11
+ modelId: string;
12
+ date: number;
13
+ };
14
+ prebuiltModelIds?: string[];
15
+ };
16
+ export declare type KnowledgeModel = {
17
+ extensions: string[];
18
+ name: string;
19
+ desc: string;
20
+ imageSrc: string;
21
+ createdBy: string;
22
+ createdDate: number;
23
+ modifiedBy: string;
24
+ modifiedDate: number;
25
+ config: {
26
+ [key: string]: unknown;
27
+ };
28
+ culture: string;
29
+ versions: Version[];
30
+ endpoints: {
31
+ PRODUCTION: {
32
+ publishedDateTime: number | null;
33
+ publishedAppId: string;
34
+ publishedVersionId: string | null;
35
+ currentVersionId: string;
36
+ modifiedDateTime: number | null;
37
+ trainStatus: {
38
+ status: string;
39
+ message: string;
40
+ modelId: string;
41
+ date: number | null;
42
+ };
43
+ status: string;
44
+ endpointUrl?: string;
45
+ isStaging?: boolean;
46
+ region?: string;
47
+ endpointRegion?: string;
48
+ };
49
+ };
50
+ id: string;
51
+ };
52
+ export declare type KnowledgeModelOptionalFields = {
53
+ id: string;
54
+ } & {
55
+ [K in keyof KnowledgeModel]?: KnowledgeModel[K];
56
+ };
57
+ export declare type PartialListResponse<T> = {
58
+ total: {
59
+ value: number;
60
+ relation: string;
61
+ };
62
+ items: T[];
63
+ last?: string;
64
+ };
65
+ export declare type KnowledgeModelCreateParams = {
66
+ name: string;
67
+ desc: string;
68
+ imageSrc: string;
69
+ config?: {
70
+ [key: string]: unknown;
71
+ };
72
+ culture: string;
73
+ extensions: string[];
74
+ };
75
+ export declare type LimitsResponse = string[];
76
+ export declare type PrebuiltEntity = {
77
+ name: string;
78
+ description?: string;
79
+ examples?: string;
80
+ };
81
+ declare type EntityFeature = {
82
+ featureName: string;
83
+ isRequired: boolean;
84
+ };
85
+ declare type EntityChild = {
86
+ name: string;
87
+ features?: EntityFeature[];
88
+ children?: EntityChild[];
89
+ id: string;
90
+ };
91
+ export declare type Entity = {
92
+ name: string;
93
+ roles?: string[];
94
+ children?: EntityChild[];
95
+ features?: EntityFeature[];
96
+ kbId?: string;
97
+ prebuiltModelId?: string;
98
+ versionId?: string | null;
99
+ id: string;
100
+ };
101
+ export declare type Feature = {
102
+ kbId: string;
103
+ name: string;
104
+ mode: boolean;
105
+ words: string;
106
+ activated: boolean;
107
+ enabledForAllModels: boolean;
108
+ versionId: string | null;
109
+ id: string;
110
+ };
111
+ declare type UtteranceEntityChild = {
112
+ entity: string;
113
+ children: UtteranceEntityChild[];
114
+ startPos: number;
115
+ endPos: number;
116
+ };
117
+ export declare type UtteranceEntity = {
118
+ entity: string;
119
+ value: string;
120
+ role: string | null;
121
+ startPos: number;
122
+ endPos: number;
123
+ children: UtteranceEntityChild[];
124
+ };
125
+ export declare type Utterance = {
126
+ text: string;
127
+ intent: string;
128
+ entities: UtteranceEntity[];
129
+ entityPredictions: unknown[];
130
+ prebuiltModelId?: string;
131
+ dateCreated: number;
132
+ autoGenerated: boolean;
133
+ unrecognized: boolean;
134
+ intentCreated: number;
135
+ appCreated: number;
136
+ id: string;
137
+ versionId?: string | null;
138
+ application?: string;
139
+ kbId?: string;
140
+ };
141
+ declare type IntentFeature = EntityFeature;
142
+ export declare type Intent = {
143
+ id: string;
144
+ name: string;
145
+ type: string;
146
+ kbId: string;
147
+ prebuiltModelId?: string;
148
+ application: string;
149
+ dateCreated: number;
150
+ postprocessFlows: string[];
151
+ customData?: {
152
+ [key: string]: unknown;
153
+ };
154
+ features: IntentFeature[];
155
+ versionId: string | null;
156
+ };
157
+ export declare type Application = {
158
+ luis_schema_version: string;
159
+ versionId: string | null;
160
+ luisId: string;
161
+ name: string;
162
+ desc: string;
163
+ culture: string;
164
+ endpoints: {
165
+ PRODUCTION: {
166
+ publishedDateTime: number | null;
167
+ publishedVersionId: number | null;
168
+ modifiedDateTime: number;
169
+ trainStatus: {
170
+ status: string;
171
+ message: string;
172
+ modelId: string;
173
+ date: number | null;
174
+ };
175
+ status: string;
176
+ };
177
+ };
178
+ composites: string[];
179
+ closedLists: string[];
180
+ patternAnyEntities: string[];
181
+ model_features: string[];
182
+ regex_features: string[];
183
+ patterns: string[];
184
+ settings: string[];
185
+ id: string;
186
+ dateCreated: number;
187
+ intents: Intent[];
188
+ utterances: Utterance[];
189
+ };
190
+ export declare type IntentLabelsResponse = {
191
+ [key: string]: {
192
+ utterances: number;
193
+ patterns: number;
194
+ };
195
+ };
196
+ export declare type PatternEntity = {
197
+ entity: string;
198
+ order: number;
199
+ };
200
+ export declare type Pattern = {
201
+ kbId: string;
202
+ appCreated: number;
203
+ pattern: string;
204
+ intent: string;
205
+ intentCreated: number;
206
+ entities: PatternEntity[];
207
+ application: string;
208
+ versionId: string | null;
209
+ dateCreated: number;
210
+ id: string;
211
+ };
212
+ declare type PrebuiltModelEntity = {
213
+ name: string;
214
+ children: PrebuiltModelEntity[];
215
+ type: string;
216
+ };
217
+ export declare type PrebuiltModel = {
218
+ id: string;
219
+ name: string;
220
+ description: string;
221
+ versionId: string;
222
+ dateCreated: number;
223
+ responses: string[];
224
+ entities: PrebuiltModelEntity[];
225
+ language: string;
226
+ };
227
+ declare type PrebuiltModelDetailsResponse = {
228
+ name: string;
229
+ id: string;
230
+ };
231
+ declare type PrebuiltModelDetailsEntity = {
232
+ name: string;
233
+ id: string;
234
+ };
235
+ export declare type PrebuiltModelDetails = {
236
+ responses: PrebuiltModelDetailsResponse[];
237
+ entities: PrebuiltModelDetailsEntity[];
238
+ application: string;
239
+ };
240
+ export declare type Pair = {
241
+ application: Application;
242
+ intent: Intent;
243
+ utterance?: Utterance;
244
+ pattern?: Pattern;
245
+ };
246
+ export declare type CreatePairsResponse = {
247
+ accepted: Utterance[];
248
+ failed: {
249
+ utterance: Utterance;
250
+ reason: string;
251
+ }[];
252
+ };
253
+ export declare type UpdatedPairsResponse = CreatePairsResponse;
254
+ export declare type TrainStatusResponse = {
255
+ status: string;
256
+ message: string;
257
+ details: string;
258
+ priority?: number;
259
+ date: number;
260
+ };
261
+ export declare type TrainResponse = {
262
+ status: string;
263
+ };
264
+ export declare type PublishResponse = {
265
+ status: string;
266
+ };
267
+ export declare type ImportResponse = {
268
+ createdKb: KnowledgeModel;
269
+ };
270
+ export declare type CloneResponse = ImportResponse;
271
+ declare type MeaningAnswer = {
272
+ answer: string;
273
+ answerId: string;
274
+ type: string;
275
+ score: number;
276
+ contextId: string;
277
+ context: string;
278
+ };
279
+ declare type MeaningPatternsMatch = {
280
+ answer: string;
281
+ answerId: string;
282
+ type: string;
283
+ score: number | null;
284
+ contextId: string;
285
+ context: string;
286
+ pattern: string;
287
+ };
288
+ declare type MeaningEntity = UtteranceEntity;
289
+ export declare type MeaningResponse = {
290
+ result: {
291
+ question: string;
292
+ answer: string;
293
+ answerId: string;
294
+ type: string;
295
+ contextId: string;
296
+ context: string;
297
+ luisId: string;
298
+ topAnswers: MeaningAnswer[];
299
+ entities: MeaningEntity[];
300
+ patternsMatches: MeaningPatternsMatch[];
301
+ };
302
+ targetQuestion: string;
303
+ confidence: number;
304
+ tokenizedText: string[];
305
+ };
306
+ export {};
@@ -0,0 +1,6 @@
1
+ declare function getEntityBody(type: string, data: {
2
+ [key: string]: unknown;
3
+ }): {
4
+ [key: string]: unknown;
5
+ };
6
+ export default getEntityBody;
@@ -0,0 +1 @@
1
+ export { default as getEntityBody } from './getEntityBody';
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "version": "0.12.0",
3
+ "name": "@or-sdk/knowledge-models",
4
+ "main": "dist/cjs/index.js",
5
+ "module": "dist/esm/index.js",
6
+ "types": "dist/types/index.d.ts",
7
+ "scripts": {
8
+ "build": "npm run clean && concurrently \"npm run build:cjs\" \"npm run build:esm\" \"npm run build:types\"",
9
+ "build:watch": "concurrently -r --hide 1,2 \"npm run build:watch:cjs\" \"npm run build:watch:esm\" \"npm run build:watch:types\"",
10
+ "build:cjs": "tsc --project tsconfig.json",
11
+ "build:watch:cjs": "tsc --project tsconfig.json -w",
12
+ "build:esm": "tsc --project tsconfig.esm.json",
13
+ "build:watch:esm": "tsc --project tsconfig.esm.json -w",
14
+ "build:types": "tsc --project tsconfig.types.json",
15
+ "build:watch:types": "tsc --project tsconfig.types.json -w",
16
+ "clean": "rm -rf ./dist"
17
+ },
18
+ "devDependencies": {
19
+ "concurrently": "^6.4.0",
20
+ "typescript": "^4.4.4"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "dependencies": {
26
+ "@or-sdk/base": "^0.12.0"
27
+ },
28
+ "gitHead": "c45d0715d7049529794b9fdc30e625c01238f508"
29
+ }