@proteinjs/conversation 1.0.7 → 1.0.8
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/.eslintrc.js +1 -1
- package/.prettierignore +4 -0
- package/CHANGELOG.md +11 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +28 -40
- package/dist/src/CodegenConversation.d.ts +11 -11
- package/dist/src/CodegenConversation.js +180 -294
- package/dist/src/Conversation.d.ts +49 -52
- package/dist/src/Conversation.js +288 -478
- package/dist/src/ConversationModule.d.ts +6 -6
- package/dist/src/ConversationModule.js +3 -3
- package/dist/src/Function.d.ts +4 -4
- package/dist/src/Function.js +3 -3
- package/dist/src/OpenAi.d.ts +10 -42
- package/dist/src/OpenAi.js +305 -495
- package/dist/src/Paragraph.d.ts +4 -4
- package/dist/src/Paragraph.js +17 -17
- package/dist/src/Sentence.d.ts +4 -4
- package/dist/src/Sentence.js +21 -21
- package/dist/src/code_template/Code.d.ts +15 -15
- package/dist/src/code_template/Code.js +73 -167
- package/dist/src/code_template/CodeTemplate.d.ts +11 -11
- package/dist/src/code_template/CodeTemplate.js +80 -169
- package/dist/src/code_template/CodeTemplateModule.d.ts +6 -6
- package/dist/src/code_template/CodeTemplateModule.js +26 -28
- package/dist/src/code_template/Repo.d.ts +38 -34
- package/dist/src/code_template/Repo.js +195 -291
- package/dist/src/fs/conversation_fs/ConversationFsModerator.d.ts +12 -12
- package/dist/src/fs/conversation_fs/ConversationFsModerator.js +108 -110
- package/dist/src/fs/conversation_fs/ConversationFsModule.d.ts +11 -11
- package/dist/src/fs/conversation_fs/ConversationFsModule.js +97 -204
- package/dist/src/fs/conversation_fs/FsFunctions.d.ts +62 -58
- package/dist/src/fs/conversation_fs/FsFunctions.js +252 -414
- package/dist/src/fs/git/GitModule.d.ts +8 -8
- package/dist/src/fs/git/GitModule.js +74 -163
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.d.ts +18 -16
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.js +58 -158
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.d.ts +26 -27
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.js +131 -234
- package/dist/src/fs/package/PackageFunctions.d.ts +60 -54
- package/dist/src/fs/package/PackageFunctions.js +213 -366
- package/dist/src/fs/package/PackageModule.d.ts +24 -24
- package/dist/src/fs/package/PackageModule.js +170 -292
- package/dist/src/history/MessageHistory.d.ts +12 -12
- package/dist/src/history/MessageHistory.js +46 -52
- package/dist/src/history/MessageModerator.d.ts +2 -2
- package/dist/src/history/MessageModerator.js +3 -3
- package/dist/src/template/ConversationTemplate.d.ts +8 -8
- package/dist/src/template/ConversationTemplate.js +3 -3
- package/dist/src/template/ConversationTemplateFunctions.d.ts +35 -33
- package/dist/src/template/ConversationTemplateFunctions.js +75 -176
- package/dist/src/template/ConversationTemplateModule.d.ts +48 -51
- package/dist/src/template/ConversationTemplateModule.js +116 -211
- package/dist/src/template/createApp/CreateAppTemplate.d.ts +1 -1
- package/dist/src/template/createApp/CreateAppTemplate.js +59 -151
- package/dist/src/template/createCode/CreateCodeConversationTemplate.d.ts +1 -1
- package/dist/src/template/createCode/CreateCodeConversationTemplate.js +67 -183
- package/dist/src/template/createPackage/CreatePackageConversationTemplate.d.ts +1 -1
- package/dist/src/template/createPackage/CreatePackageConversationTemplate.js +77 -174
- package/dist/src/template/createPackage/tsconfig.json +11 -11
- package/dist/test/createKeywordFilesIndex.test.d.ts +1 -1
- package/dist/test/createKeywordFilesIndex.test.js +41 -132
- package/dist/test/openai/openai.generateList.test.d.ts +1 -1
- package/dist/test/openai/openai.generateList.test.js +47 -136
- package/dist/test/openai/openai.parseCodeFromMarkdown.test.d.ts +1 -1
- package/dist/test/openai/openai.parseCodeFromMarkdown.test.js +12 -13
- package/dist/test/repo/repo.test.d.ts +1 -1
- package/dist/test/repo/repo.test.js +38 -127
- package/package.json +2 -2
|
@@ -1,56 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MessageHistory = void 0;
|
|
4
|
-
var util_1 = require(
|
|
4
|
+
var util_1 = require("@proteinjs/util");
|
|
5
5
|
var MessageHistory = /** @class */ (function () {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
MessageHistory.prototype.getMessages = function () {
|
|
12
|
-
return this.messages;
|
|
13
|
-
};
|
|
14
|
-
MessageHistory.prototype.toString = function () {
|
|
15
|
-
return this.messages
|
|
16
|
-
.map(function (message) {
|
|
17
|
-
return message.content;
|
|
18
|
-
})
|
|
19
|
-
.join('. ');
|
|
20
|
-
};
|
|
21
|
-
MessageHistory.prototype.setMessages = function (messages) {
|
|
22
|
-
this.messages = messages;
|
|
23
|
-
this.prune();
|
|
24
|
-
return this;
|
|
25
|
-
};
|
|
26
|
-
MessageHistory.prototype.push = function (messages) {
|
|
27
|
-
var _a;
|
|
28
|
-
(_a = this.messages).push.apply(_a, messages);
|
|
29
|
-
this.prune();
|
|
30
|
-
return this;
|
|
31
|
-
};
|
|
32
|
-
MessageHistory.prototype.prune = function () {
|
|
33
|
-
if (this.params.enforceMessageLimit === false) {
|
|
34
|
-
return;
|
|
6
|
+
function MessageHistory(params) {
|
|
7
|
+
this.logger = new util_1.Logger(this.constructor.name);
|
|
8
|
+
this.messages = [];
|
|
9
|
+
this.params = Object.assign({ maxMessages: 20 }, params);
|
|
35
10
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
11
|
+
MessageHistory.prototype.getMessages = function () {
|
|
12
|
+
return this.messages;
|
|
13
|
+
};
|
|
14
|
+
MessageHistory.prototype.toString = function () {
|
|
15
|
+
return this.messages.map(function (message) { return message.content; }).join('. ');
|
|
16
|
+
};
|
|
17
|
+
MessageHistory.prototype.setMessages = function (messages) {
|
|
18
|
+
this.messages = messages;
|
|
19
|
+
this.prune();
|
|
20
|
+
return this;
|
|
21
|
+
};
|
|
22
|
+
MessageHistory.prototype.push = function (messages) {
|
|
23
|
+
var _a;
|
|
24
|
+
(_a = this.messages).push.apply(_a, messages);
|
|
25
|
+
this.prune();
|
|
26
|
+
return this;
|
|
27
|
+
};
|
|
28
|
+
MessageHistory.prototype.prune = function () {
|
|
29
|
+
if (this.params.enforceMessageLimit === false) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
var messageCount = 0;
|
|
33
|
+
var messagesToRemoveIndexes = [];
|
|
34
|
+
for (var i = this.messages.length - 1; i >= 0; i--) {
|
|
35
|
+
var message = this.messages[i];
|
|
36
|
+
if (message.role == 'system') {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
messageCount++;
|
|
40
|
+
if (messageCount > this.params.maxMessages) {
|
|
41
|
+
messagesToRemoveIndexes.push(i);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
this.messages = this.messages.filter(function (message, i) { return !messagesToRemoveIndexes.includes(i); });
|
|
45
|
+
this.logger.debug("Pruned ".concat(messagesToRemoveIndexes.length, " messages"));
|
|
46
|
+
};
|
|
47
|
+
return MessageHistory;
|
|
48
|
+
}());
|
|
55
49
|
exports.MessageHistory = MessageHistory;
|
|
56
|
-
//# sourceMappingURL=MessageHistory.js.map
|
|
50
|
+
//# sourceMappingURL=MessageHistory.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChatCompletionMessageParam } from 'openai/resources/chat';
|
|
2
2
|
export interface MessageModerator {
|
|
3
|
-
|
|
3
|
+
observe(messages: ChatCompletionMessageParam[]): ChatCompletionMessageParam[];
|
|
4
4
|
}
|
|
5
|
-
//# sourceMappingURL=MessageModerator.d.ts.map
|
|
5
|
+
//# sourceMappingURL=MessageModerator.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
//# sourceMappingURL=MessageModerator.js.map
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
//# sourceMappingURL=MessageModerator.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export type Question = {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
text: string;
|
|
3
|
+
optional?: boolean;
|
|
4
4
|
};
|
|
5
5
|
export type ConversationTemplate = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
name: string;
|
|
7
|
+
keywords: string[];
|
|
8
|
+
description: string;
|
|
9
|
+
questions: Question[];
|
|
10
|
+
instructions: () => Promise<string[]>;
|
|
11
11
|
};
|
|
12
|
-
//# sourceMappingURL=ConversationTemplate.d.ts.map
|
|
12
|
+
//# sourceMappingURL=ConversationTemplate.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
//# sourceMappingURL=ConversationTemplate.js.map
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
//# sourceMappingURL=ConversationTemplate.js.map
|
|
@@ -1,42 +1,44 @@
|
|
|
1
1
|
import { ConversationTemplateModule } from './ConversationTemplateModule';
|
|
2
|
-
export declare const searchConversationTemplatesFunctionName =
|
|
2
|
+
export declare const searchConversationTemplatesFunctionName = "searchConversationTemplates";
|
|
3
3
|
export declare const searchConversationTemplatesFunction: (repo: ConversationTemplateModule) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
definition: {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
parameters: {
|
|
8
|
+
type: string;
|
|
9
|
+
properties: {
|
|
10
|
+
keyword: {
|
|
11
|
+
type: string;
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
required: string[];
|
|
13
16
|
};
|
|
14
|
-
};
|
|
15
|
-
required: string[];
|
|
16
17
|
};
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
call: (params: {
|
|
19
|
+
keyword: string;
|
|
20
|
+
}) => Promise<string[]>;
|
|
19
21
|
};
|
|
20
|
-
export declare const getConversationTemplateFunctionName =
|
|
22
|
+
export declare const getConversationTemplateFunctionName = "getConversationTemplate";
|
|
21
23
|
export declare const getConversationTemplateFunction: (repo: ConversationTemplateModule) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
definition: {
|
|
25
|
+
name: string;
|
|
26
|
+
description: string;
|
|
27
|
+
parameters: {
|
|
28
|
+
type: string;
|
|
29
|
+
properties: {
|
|
30
|
+
conversationTemplateName: {
|
|
31
|
+
type: string;
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
required: string[];
|
|
31
36
|
};
|
|
32
|
-
};
|
|
33
|
-
required: string[];
|
|
34
37
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Omit<import(
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
>;
|
|
38
|
+
call: (params: {
|
|
39
|
+
conversationTemplateName: string;
|
|
40
|
+
}) => Promise<Omit<import("./ConversationTemplate").ConversationTemplate, "instructions"> & {
|
|
41
|
+
instructions: string[];
|
|
42
|
+
}>;
|
|
41
43
|
};
|
|
42
|
-
//# sourceMappingURL=ConversationTemplateFunctions.d.ts.map
|
|
44
|
+
//# sourceMappingURL=ConversationTemplateFunctions.d.ts.map
|
|
@@ -1,190 +1,89 @@
|
|
|
1
|
-
|
|
2
|
-
var __awaiter =
|
|
3
|
-
|
|
4
|
-
function (thisArg, _arguments, P, generator) {
|
|
5
|
-
function adopt(value) {
|
|
6
|
-
return value instanceof P
|
|
7
|
-
? value
|
|
8
|
-
: new P(function (resolve) {
|
|
9
|
-
resolve(value);
|
|
10
|
-
});
|
|
11
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
12
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
reject(e);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function rejected(value) {
|
|
21
|
-
try {
|
|
22
|
-
step(generator['throw'](value));
|
|
23
|
-
} catch (e) {
|
|
24
|
-
reject(e);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function step(result) {
|
|
28
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
29
|
-
}
|
|
30
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
31
9
|
});
|
|
32
|
-
|
|
33
|
-
var __generator =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
label: 0,
|
|
38
|
-
sent: function () {
|
|
39
|
-
if (t[0] & 1) throw t[1];
|
|
40
|
-
return t[1];
|
|
41
|
-
},
|
|
42
|
-
trys: [],
|
|
43
|
-
ops: [],
|
|
44
|
-
},
|
|
45
|
-
f,
|
|
46
|
-
y,
|
|
47
|
-
t,
|
|
48
|
-
g;
|
|
49
|
-
return (
|
|
50
|
-
(g = { next: verb(0), throw: verb(1), return: verb(2) }),
|
|
51
|
-
typeof Symbol === 'function' &&
|
|
52
|
-
(g[Symbol.iterator] = function () {
|
|
53
|
-
return this;
|
|
54
|
-
}),
|
|
55
|
-
g
|
|
56
|
-
);
|
|
57
|
-
function verb(n) {
|
|
58
|
-
return function (v) {
|
|
59
|
-
return step([n, v]);
|
|
60
|
-
};
|
|
61
|
-
}
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
62
15
|
function step(op) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
_.label++;
|
|
84
|
-
y = op[1];
|
|
85
|
-
op = [0];
|
|
86
|
-
continue;
|
|
87
|
-
case 7:
|
|
88
|
-
op = _.ops.pop();
|
|
89
|
-
_.trys.pop();
|
|
90
|
-
continue;
|
|
91
|
-
default:
|
|
92
|
-
if (!((t = _.trys), (t = t.length > 0 && t[t.length - 1])) && (op[0] === 6 || op[0] === 2)) {
|
|
93
|
-
_ = 0;
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
97
|
-
_.label = op[1];
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
101
|
-
_.label = t[1];
|
|
102
|
-
t = op;
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
if (t && _.label < t[2]) {
|
|
106
|
-
_.label = t[2];
|
|
107
|
-
_.ops.push(op);
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
if (t[2]) _.ops.pop();
|
|
111
|
-
_.trys.pop();
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
op = body.call(thisArg, _);
|
|
115
|
-
} catch (e) {
|
|
116
|
-
op = [6, e];
|
|
117
|
-
y = 0;
|
|
118
|
-
} finally {
|
|
119
|
-
f = t = 0;
|
|
120
|
-
}
|
|
121
|
-
if (op[0] & 5) throw op[1];
|
|
122
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
123
36
|
}
|
|
124
|
-
|
|
125
|
-
Object.defineProperty(exports,
|
|
126
|
-
exports.getConversationTemplateFunction =
|
|
127
|
-
exports.getConversationTemplateFunctionName =
|
|
128
|
-
exports.searchConversationTemplatesFunction =
|
|
129
|
-
exports.searchConversationTemplatesFunctionName =
|
|
130
|
-
void 0;
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getConversationTemplateFunction = exports.getConversationTemplateFunctionName = exports.searchConversationTemplatesFunction = exports.searchConversationTemplatesFunctionName = void 0;
|
|
131
40
|
exports.searchConversationTemplatesFunctionName = 'searchConversationTemplates';
|
|
132
41
|
var searchConversationTemplatesFunction = function (repo) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
42
|
+
return {
|
|
43
|
+
definition: {
|
|
44
|
+
name: exports.searchConversationTemplatesFunctionName,
|
|
45
|
+
description: 'Get the conversation template names for templates matching the keyword',
|
|
46
|
+
parameters: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
properties: {
|
|
49
|
+
keyword: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
description: 'Search for conversation template names that match this keyword',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
required: ['keyword'],
|
|
55
|
+
},
|
|
144
56
|
},
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
150
|
-
return __generator(this, function (_a) {
|
|
151
|
-
return [2 /*return*/, repo.searchConversationTemplates(params.keyword)];
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
},
|
|
155
|
-
};
|
|
57
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
58
|
+
return [2 /*return*/, repo.searchConversationTemplates(params.keyword)];
|
|
59
|
+
}); }); },
|
|
60
|
+
};
|
|
156
61
|
};
|
|
157
62
|
exports.searchConversationTemplatesFunction = searchConversationTemplatesFunction;
|
|
158
63
|
exports.getConversationTemplateFunctionName = 'getConversationTemplate';
|
|
159
64
|
var getConversationTemplateFunction = function (repo) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
65
|
+
return {
|
|
66
|
+
definition: {
|
|
67
|
+
name: exports.getConversationTemplateFunctionName,
|
|
68
|
+
description: 'Get the conversation template matching the name',
|
|
69
|
+
parameters: {
|
|
70
|
+
type: 'object',
|
|
71
|
+
properties: {
|
|
72
|
+
conversationTemplateName: {
|
|
73
|
+
type: 'string',
|
|
74
|
+
description: 'Get the conversation template that has this name',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
required: ['conversationTemplateName'],
|
|
78
|
+
},
|
|
171
79
|
},
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
case 0:
|
|
180
|
-
return [4 /*yield*/, repo.getConversationTemplate(params.conversationTemplateName)];
|
|
181
|
-
case 1:
|
|
182
|
-
return [2 /*return*/, _a.sent()];
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
},
|
|
187
|
-
};
|
|
80
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
81
|
+
switch (_a.label) {
|
|
82
|
+
case 0: return [4 /*yield*/, repo.getConversationTemplate(params.conversationTemplateName)];
|
|
83
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
84
|
+
}
|
|
85
|
+
}); }); },
|
|
86
|
+
};
|
|
188
87
|
};
|
|
189
88
|
exports.getConversationTemplateFunction = getConversationTemplateFunction;
|
|
190
|
-
//# sourceMappingURL=ConversationTemplateFunctions.js.map
|
|
89
|
+
//# sourceMappingURL=ConversationTemplateFunctions.js.map
|
|
@@ -1,68 +1,65 @@
|
|
|
1
1
|
import { ConversationTemplate } from './ConversationTemplate';
|
|
2
2
|
import { ConversationModule, ConversationModuleFactory } from '../ConversationModule';
|
|
3
3
|
export type ConversationTemplateModuleParams = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
conversationTemplates: {
|
|
5
|
+
[conversationTemplateName: string]: ConversationTemplate;
|
|
6
|
+
};
|
|
7
|
+
conversationTemplateKeywordIndex: {
|
|
8
|
+
[keyword: string]: string[]; /** conversationTemplateNames */
|
|
9
|
+
};
|
|
10
10
|
};
|
|
11
11
|
export declare class ConversationTemplateModule implements ConversationModule {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
getSystemMessages(): string[];
|
|
23
|
-
getFunctions(): (
|
|
24
|
-
| {
|
|
12
|
+
private logger;
|
|
13
|
+
params: ConversationTemplateModuleParams;
|
|
14
|
+
constructor(params: ConversationTemplateModuleParams);
|
|
15
|
+
getName(): string;
|
|
16
|
+
searchConversationTemplates(keyword: string): string[];
|
|
17
|
+
getConversationTemplate(conversationTemplateName: string): Promise<Omit<ConversationTemplate, 'instructions'> & {
|
|
18
|
+
instructions: string[];
|
|
19
|
+
}>;
|
|
20
|
+
getSystemMessages(): string[];
|
|
21
|
+
getFunctions(): ({
|
|
25
22
|
definition: {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
type: string;
|
|
30
|
-
properties: {
|
|
31
|
-
keyword: {
|
|
23
|
+
name: string;
|
|
24
|
+
description: string;
|
|
25
|
+
parameters: {
|
|
32
26
|
type: string;
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
properties: {
|
|
28
|
+
keyword: {
|
|
29
|
+
type: string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
required: string[];
|
|
35
34
|
};
|
|
36
|
-
required: string[];
|
|
37
|
-
};
|
|
38
35
|
};
|
|
39
|
-
call: (params: {
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
call: (params: {
|
|
37
|
+
keyword: string;
|
|
38
|
+
}) => Promise<string[]>;
|
|
39
|
+
} | {
|
|
42
40
|
definition: {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
type: string;
|
|
47
|
-
properties: {
|
|
48
|
-
conversationTemplateName: {
|
|
41
|
+
name: string;
|
|
42
|
+
description: string;
|
|
43
|
+
parameters: {
|
|
49
44
|
type: string;
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
properties: {
|
|
46
|
+
conversationTemplateName: {
|
|
47
|
+
type: string;
|
|
48
|
+
description: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
required: string[];
|
|
52
52
|
};
|
|
53
|
-
required: string[];
|
|
54
|
-
};
|
|
55
53
|
};
|
|
56
|
-
call: (params: {
|
|
57
|
-
|
|
54
|
+
call: (params: {
|
|
55
|
+
conversationTemplateName: string;
|
|
56
|
+
}) => Promise<Omit<ConversationTemplate, "instructions"> & {
|
|
58
57
|
instructions: string[];
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
)[];
|
|
63
|
-
getMessageModerators(): never[];
|
|
58
|
+
}>;
|
|
59
|
+
})[];
|
|
60
|
+
getMessageModerators(): never[];
|
|
64
61
|
}
|
|
65
62
|
export declare class ConversationTemplateModuleFactory implements ConversationModuleFactory {
|
|
66
|
-
|
|
63
|
+
createModule(repoPath: string): Promise<ConversationTemplateModule>;
|
|
67
64
|
}
|
|
68
|
-
//# sourceMappingURL=ConversationTemplateModule.d.ts.map
|
|
65
|
+
//# sourceMappingURL=ConversationTemplateModule.d.ts.map
|