@digipair/skill-chatbot 0.0.2 → 0.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/few_shot.esm.js CHANGED
@@ -1,4 +1,276 @@
1
- import { c as checkValidTemplate, B as BaseStringPromptTemplate, a as BaseChatPromptTemplate, P as PromptTemplate, r as renderTemplate } from './index.esm2.js';
1
+ import { B as BasePromptTemplate, C as ChatPromptValue, c as checkValidTemplate, a as BaseStringPromptTemplate, P as PromptTemplate, r as renderTemplate } from './index.esm2.js';
2
+ import '@digipair/engine';
3
+
4
+ // Default generic "any" values are for backwards compatibility.
5
+ function _assert_this_initialized$1(self) {
6
+ if (self === void 0) {
7
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
8
+ }
9
+ return self;
10
+ }
11
+ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
12
+ try {
13
+ var info = gen[key](arg);
14
+ var value = info.value;
15
+ } catch (error) {
16
+ reject(error);
17
+ return;
18
+ }
19
+ if (info.done) {
20
+ resolve(value);
21
+ } else {
22
+ Promise.resolve(value).then(_next, _throw);
23
+ }
24
+ }
25
+ function _async_to_generator$1(fn) {
26
+ return function() {
27
+ var self = this, args = arguments;
28
+ return new Promise(function(resolve, reject) {
29
+ var gen = fn.apply(self, args);
30
+ function _next(value) {
31
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
32
+ }
33
+ function _throw(err) {
34
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
35
+ }
36
+ _next(undefined);
37
+ });
38
+ };
39
+ }
40
+ function _class_call_check$1(instance, Constructor) {
41
+ if (!(instance instanceof Constructor)) {
42
+ throw new TypeError("Cannot call a class as a function");
43
+ }
44
+ }
45
+ function _defineProperties$1(target, props) {
46
+ for(var i = 0; i < props.length; i++){
47
+ var descriptor = props[i];
48
+ descriptor.enumerable = descriptor.enumerable || false;
49
+ descriptor.configurable = true;
50
+ if ("value" in descriptor) descriptor.writable = true;
51
+ Object.defineProperty(target, descriptor.key, descriptor);
52
+ }
53
+ }
54
+ function _create_class$1(Constructor, protoProps, staticProps) {
55
+ if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
56
+ if (staticProps) _defineProperties$1(Constructor, staticProps);
57
+ return Constructor;
58
+ }
59
+ function _get_prototype_of$1(o) {
60
+ _get_prototype_of$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
61
+ return o.__proto__ || Object.getPrototypeOf(o);
62
+ };
63
+ return _get_prototype_of$1(o);
64
+ }
65
+ function _inherits$1(subClass, superClass) {
66
+ if (typeof superClass !== "function" && superClass !== null) {
67
+ throw new TypeError("Super expression must either be null or a function");
68
+ }
69
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
70
+ constructor: {
71
+ value: subClass,
72
+ writable: true,
73
+ configurable: true
74
+ }
75
+ });
76
+ if (superClass) _set_prototype_of$1(subClass, superClass);
77
+ }
78
+ function _possible_constructor_return$1(self, call) {
79
+ if (call && (_type_of$1(call) === "object" || typeof call === "function")) {
80
+ return call;
81
+ }
82
+ return _assert_this_initialized$1(self);
83
+ }
84
+ function _set_prototype_of$1(o, p) {
85
+ _set_prototype_of$1 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
86
+ o.__proto__ = p;
87
+ return o;
88
+ };
89
+ return _set_prototype_of$1(o, p);
90
+ }
91
+ function _type_of$1(obj) {
92
+ "@swc/helpers - typeof";
93
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
94
+ }
95
+ function _is_native_reflect_construct$1() {
96
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
97
+ if (Reflect.construct.sham) return false;
98
+ if (typeof Proxy === "function") return true;
99
+ try {
100
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
101
+ return true;
102
+ } catch (e) {
103
+ return false;
104
+ }
105
+ }
106
+ function _create_super$1(Derived) {
107
+ var hasNativeReflectConstruct = _is_native_reflect_construct$1();
108
+ return function _createSuperInternal() {
109
+ var Super = _get_prototype_of$1(Derived), result;
110
+ if (hasNativeReflectConstruct) {
111
+ var NewTarget = _get_prototype_of$1(this).constructor;
112
+ result = Reflect.construct(Super, arguments, NewTarget);
113
+ } else {
114
+ result = Super.apply(this, arguments);
115
+ }
116
+ return _possible_constructor_return$1(this, result);
117
+ };
118
+ }
119
+ function _ts_generator$1(thisArg, body) {
120
+ var f, y, t, g, _ = {
121
+ label: 0,
122
+ sent: function() {
123
+ if (t[0] & 1) throw t[1];
124
+ return t[1];
125
+ },
126
+ trys: [],
127
+ ops: []
128
+ };
129
+ return g = {
130
+ next: verb(0),
131
+ "throw": verb(1),
132
+ "return": verb(2)
133
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
134
+ return this;
135
+ }), g;
136
+ function verb(n) {
137
+ return function(v) {
138
+ return step([
139
+ n,
140
+ v
141
+ ]);
142
+ };
143
+ }
144
+ function step(op) {
145
+ if (f) throw new TypeError("Generator is already executing.");
146
+ while(_)try {
147
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
148
+ if (y = 0, t) op = [
149
+ op[0] & 2,
150
+ t.value
151
+ ];
152
+ switch(op[0]){
153
+ case 0:
154
+ case 1:
155
+ t = op;
156
+ break;
157
+ case 4:
158
+ _.label++;
159
+ return {
160
+ value: op[1],
161
+ done: false
162
+ };
163
+ case 5:
164
+ _.label++;
165
+ y = op[1];
166
+ op = [
167
+ 0
168
+ ];
169
+ continue;
170
+ case 7:
171
+ op = _.ops.pop();
172
+ _.trys.pop();
173
+ continue;
174
+ default:
175
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
176
+ _ = 0;
177
+ continue;
178
+ }
179
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
180
+ _.label = op[1];
181
+ break;
182
+ }
183
+ if (op[0] === 6 && _.label < t[1]) {
184
+ _.label = t[1];
185
+ t = op;
186
+ break;
187
+ }
188
+ if (t && _.label < t[2]) {
189
+ _.label = t[2];
190
+ _.ops.push(op);
191
+ break;
192
+ }
193
+ if (t[2]) _.ops.pop();
194
+ _.trys.pop();
195
+ continue;
196
+ }
197
+ op = body.call(thisArg, _);
198
+ } catch (e) {
199
+ op = [
200
+ 6,
201
+ e
202
+ ];
203
+ y = 0;
204
+ } finally{
205
+ f = t = 0;
206
+ }
207
+ if (op[0] & 5) throw op[1];
208
+ return {
209
+ value: op[0] ? op[1] : void 0,
210
+ done: true
211
+ };
212
+ }
213
+ }
214
+ /**
215
+ * Abstract class that serves as a base for creating chat prompt
216
+ * templates. It extends the BasePromptTemplate.
217
+ */ var BaseChatPromptTemplate = /*#__PURE__*/ function(BasePromptTemplate) {
218
+ _inherits$1(BaseChatPromptTemplate, BasePromptTemplate);
219
+ var _super = _create_super$1(BaseChatPromptTemplate);
220
+ function BaseChatPromptTemplate(input) {
221
+ _class_call_check$1(this, BaseChatPromptTemplate);
222
+ return _super.call(this, input);
223
+ }
224
+ _create_class$1(BaseChatPromptTemplate, [
225
+ {
226
+ key: "format",
227
+ value: function format(values) {
228
+ var _this = this;
229
+ return _async_to_generator$1(function() {
230
+ return _ts_generator$1(this, function(_state) {
231
+ switch(_state.label){
232
+ case 0:
233
+ return [
234
+ 4,
235
+ _this.formatPromptValue(values)
236
+ ];
237
+ case 1:
238
+ return [
239
+ 2,
240
+ _state.sent().toString()
241
+ ];
242
+ }
243
+ });
244
+ })();
245
+ }
246
+ },
247
+ {
248
+ key: "formatPromptValue",
249
+ value: function formatPromptValue(values) {
250
+ var _this = this;
251
+ return _async_to_generator$1(function() {
252
+ var resultMessages;
253
+ return _ts_generator$1(this, function(_state) {
254
+ switch(_state.label){
255
+ case 0:
256
+ return [
257
+ 4,
258
+ _this.formatMessages(values)
259
+ ];
260
+ case 1:
261
+ resultMessages = _state.sent();
262
+ return [
263
+ 2,
264
+ new ChatPromptValue(resultMessages)
265
+ ];
266
+ }
267
+ });
268
+ })();
269
+ }
270
+ }
271
+ ]);
272
+ return BaseChatPromptTemplate;
273
+ }(BasePromptTemplate);
2
274
 
3
275
  function _array_like_to_array(arr, len) {
4
276
  if (len == null || len > arr.length) len = arr.length;
package/index.cjs.js ADDED
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var index = require('./index.cjs2.js');
6
+ require('@digipair/engine');
7
+
8
+
9
+
10
+ exports.boost = index.boost;
11
+ exports.chatbot = index.chatbot;
12
+ exports.find = index.find;
13
+ exports.history = index.history;
14
+ exports.search = index.search;