@digipair/skill-chatbot 0.29.6 → 0.30.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/index.cjs.js CHANGED
@@ -2,16 +2,33 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index.cjs2.js');
6
- require('@digipair/engine');
5
+ var engine = require('@digipair/engine');
7
6
 
7
+ let ChatbotService = class ChatbotService {
8
+ async answer(params, _pinsSettingsList, context) {
9
+ const { command = [], boosts = [], assistant, sources, logs } = params;
10
+ return {
11
+ assistant,
12
+ command: await Promise.all(command.map((settings)=>engine.preparePinsSettings(settings, context))),
13
+ boosts,
14
+ sources,
15
+ logs
16
+ };
17
+ }
18
+ // SCENES
19
+ async boost(params, _pinsSettingsList, context) {
20
+ if (context.request.method !== 'POST') {
21
+ return {
22
+ error: 'Method not allowed'
23
+ };
24
+ }
25
+ const { execute } = params;
26
+ const result = await engine.executePinsList(execute, context);
27
+ return result;
28
+ }
29
+ };
30
+ const boost = (params, pinsSettingsList, context)=>new ChatbotService().boost(params, pinsSettingsList, context);
31
+ const answer = (params, pinsSettingsList, context)=>new ChatbotService().answer(params, pinsSettingsList, context);
8
32
 
9
-
10
- exports.answer = index.answer;
11
- exports.boost = index.boost;
12
- exports.chatbot = index.chatbot;
13
- exports.find = index.find;
14
- exports.getRole = index.getRole;
15
- exports.history = index.history;
16
- exports.search = index.search;
17
- exports.setRole = index.setRole;
33
+ exports.answer = answer;
34
+ exports.boost = boost;
package/index.esm.js CHANGED
@@ -1,2 +1,29 @@
1
- export { i as answer, e as boost, b as chatbot, f as find, g as getRole, h as history, s as search, d as setRole } from './index.esm2.js';
2
- import '@digipair/engine';
1
+ import { preparePinsSettings, executePinsList } from '@digipair/engine';
2
+
3
+ let ChatbotService = class ChatbotService {
4
+ async answer(params, _pinsSettingsList, context) {
5
+ const { command = [], boosts = [], assistant, sources, logs } = params;
6
+ return {
7
+ assistant,
8
+ command: await Promise.all(command.map((settings)=>preparePinsSettings(settings, context))),
9
+ boosts,
10
+ sources,
11
+ logs
12
+ };
13
+ }
14
+ // SCENES
15
+ async boost(params, _pinsSettingsList, context) {
16
+ if (context.request.method !== 'POST') {
17
+ return {
18
+ error: 'Method not allowed'
19
+ };
20
+ }
21
+ const { execute } = params;
22
+ const result = await executePinsList(execute, context);
23
+ return result;
24
+ }
25
+ };
26
+ const boost = (params, pinsSettingsList, context)=>new ChatbotService().boost(params, pinsSettingsList, context);
27
+ const answer = (params, pinsSettingsList, context)=>new ChatbotService().answer(params, pinsSettingsList, context);
28
+
29
+ export { answer, boost };
@@ -1,16 +1,4 @@
1
1
  import { PinsSettings } from '@digipair/engine';
2
- export declare const history: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any[]>;
3
- export declare const find: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
4
- export declare const search: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
5
- export declare const chatbot: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<{
6
- assistant: any;
7
- command: any[];
8
- boosts: any[];
9
- sources: any;
10
- logs: any;
11
- }>;
12
- export declare const getRole: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
13
- export declare const setRole: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<void>;
14
2
  export declare const boost: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
15
3
  export declare const answer: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<{
16
4
  assistant: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-chatbot",
3
- "version": "0.29.6",
3
+ "version": "0.30.1",
4
4
  "dependencies": {},
5
5
  "typings": "./index.d.ts",
6
6
  "main": "./index.cjs.js",
package/schema.en.json CHANGED
@@ -8,321 +8,6 @@
8
8
  "x-icon": "🤖"
9
9
  },
10
10
  "paths": {
11
- "/chatbot": {
12
- "post": {
13
- "tags": ["boost"],
14
- "summary": "Return to the chatbot",
15
- "parameters": [
16
- {
17
- "name": "assistant",
18
- "required": true,
19
- "description": "Response from the assistant",
20
- "schema": {
21
- "type": "string"
22
- }
23
- },
24
- {
25
- "name": "command",
26
- "required": false,
27
- "description": "Command executed on the chatbot",
28
- "schema": {
29
- "type": "array",
30
- "items": {
31
- "$ref": "https://schemas.digipair.ai/pinsSettings"
32
- }
33
- }
34
- },
35
- {
36
- "name": "sources",
37
- "required": false,
38
- "description": "List of sources used to respond to the user",
39
- "schema": {
40
- "type": "array",
41
- "items": {
42
- "type": "object"
43
- }
44
- }
45
- },
46
- {
47
- "name": "logs",
48
- "required": false,
49
- "description": "Useful information for debugging reasoning",
50
- "schema": {
51
- "type": "object"
52
- }
53
- },
54
- {
55
- "name": "model",
56
- "summary": "LLM Model",
57
- "required": false,
58
- "description": "LLM model to load",
59
- "schema": {
60
- "type": "array",
61
- "items": {
62
- "$ref": "https://schemas.digipair.ai/pinsSettings"
63
- }
64
- }
65
- },
66
- {
67
- "name": "embeddings",
68
- "summary": "Embeddings Model",
69
- "required": false,
70
- "description": "Embeddings model to load",
71
- "schema": {
72
- "type": "array",
73
- "items": {
74
- "$ref": "https://schemas.digipair.ai/pinsSettings"
75
- }
76
- }
77
- },
78
- {
79
- "name": "baseUrlVespa",
80
- "required": false,
81
- "description": "URL of the Vespa server",
82
- "schema": {
83
- "type": "string"
84
- }
85
- },
86
- {
87
- "name": "promptSummary",
88
- "required": false,
89
- "description": "Prompt used for the system summary",
90
- "schema": {
91
- "type": "string"
92
- }
93
- }
94
- ],
95
- "x-events": []
96
- }
97
- },
98
- "/find": {
99
- "post": {
100
- "tags": ["service"],
101
- "summary": "Retrieve from the conversation",
102
- "description": "Retrieve data from the conversation history",
103
- "parameters": [
104
- {
105
- "name": "limit",
106
- "required": false,
107
- "description": "limit",
108
- "schema": {
109
- "type": "number"
110
- }
111
- },
112
- {
113
- "name": "orderby",
114
- "required": false,
115
- "description": "orderby",
116
- "schema": {
117
- "type": "string"
118
- }
119
- },
120
- {
121
- "name": "query",
122
- "required": true,
123
- "description": "query",
124
- "schema": {
125
- "type": "string"
126
- }
127
- },
128
- {
129
- "name": "baseUrl",
130
- "required": false,
131
- "description": "URL of the Vespa server",
132
- "schema": {
133
- "type": "string"
134
- }
135
- }
136
- ],
137
- "x-events": []
138
- }
139
- },
140
- "/search": {
141
- "post": {
142
- "tags": ["service"],
143
- "summary": "Search in the conversation",
144
- "description": "Search for data in the conversation history",
145
- "parameters": [
146
- {
147
- "name": "embeddings",
148
- "summary": "Embeddings Model",
149
- "required": false,
150
- "description": "Embeddings model to load",
151
- "schema": {
152
- "type": "array",
153
- "items": {
154
- "$ref": "https://schemas.digipair.ai/pinsSettings"
155
- }
156
- }
157
- },
158
- {
159
- "name": "limit",
160
- "required": false,
161
- "description": "limit",
162
- "schema": {
163
- "type": "number"
164
- }
165
- },
166
- {
167
- "name": "orderby",
168
- "required": false,
169
- "description": "orderby",
170
- "schema": {
171
- "type": "string"
172
- }
173
- },
174
- {
175
- "name": "targetHits",
176
- "required": false,
177
- "description": "targetHits",
178
- "schema": {
179
- "type": "number"
180
- }
181
- },
182
- {
183
- "name": "query",
184
- "required": true,
185
- "description": "query",
186
- "schema": {
187
- "type": "string"
188
- }
189
- },
190
- {
191
- "name": "baseUrl",
192
- "required": false,
193
- "description": "URL of the Vespa server",
194
- "schema": {
195
- "type": "string"
196
- }
197
- },
198
- {
199
- "name": "language",
200
- "required": false,
201
- "description": "Search language",
202
- "schema": {
203
- "type": "string"
204
- }
205
- },
206
- {
207
- "name": "filter",
208
- "required": false,
209
- "description": "Search filter",
210
- "schema": {
211
- "type": "string"
212
- }
213
- }
214
- ],
215
- "x-events": []
216
- }
217
- },
218
- "/history": {
219
- "post": {
220
- "tags": ["service"],
221
- "summary": "History",
222
- "parameters": [
223
- {
224
- "name": "baseUrl",
225
- "summary": "URL of the Vespa server",
226
- "required": false,
227
- "description": "URL of the Vespa server",
228
- "schema": {
229
- "type": "string"
230
- }
231
- },
232
- {
233
- "name": "maxHistory",
234
- "summary": "Maximum number of items",
235
- "required": false,
236
- "description": "orderby",
237
- "schema": {
238
- "type": "number"
239
- }
240
- },
241
- {
242
- "name": "system",
243
- "summary": "System",
244
- "required": false,
245
- "description": "targetHits",
246
- "schema": {
247
- "type": "string"
248
- }
249
- },
250
- {
251
- "name": "question",
252
- "summary": "Assistant's question",
253
- "required": false,
254
- "description": "Assistant's question",
255
- "schema": {
256
- "type": "string"
257
- }
258
- }
259
- ],
260
- "x-events": []
261
- }
262
- },
263
- "/getRole": {
264
- "post": {
265
- "tags": ["service"],
266
- "summary": "Role retrieval",
267
- "parameters": [
268
- {
269
- "name": "role",
270
- "summary": "Name",
271
- "required": true,
272
- "description": "Role name",
273
- "schema": {
274
- "type": "string"
275
- }
276
- },
277
- {
278
- "name": "baseUrl",
279
- "summary": "URL of the Vespa server",
280
- "required": false,
281
- "description": "URL of the Vespa server",
282
- "schema": {
283
- "type": "string"
284
- }
285
- }
286
- ],
287
- "x-events": []
288
- }
289
- },
290
- "/setRole": {
291
- "post": {
292
- "tags": ["service"],
293
- "summary": "Role update",
294
- "parameters": [
295
- {
296
- "name": "role",
297
- "summary": "Name",
298
- "required": true,
299
- "description": "Role name",
300
- "schema": {
301
- "type": "string"
302
- }
303
- },
304
- {
305
- "name": "value",
306
- "summary": "Value",
307
- "required": true,
308
- "description": "Role value",
309
- "schema": {
310
- "type": "string"
311
- }
312
- },
313
- {
314
- "name": "baseUrl",
315
- "summary": "URL of the Vespa server",
316
- "required": false,
317
- "description": "URL of the Vespa server",
318
- "schema": {
319
- "type": "string"
320
- }
321
- }
322
- ],
323
- "x-events": []
324
- }
325
- },
326
11
  "/answer": {
327
12
  "post": {
328
13
  "tags": ["boost"],