@autobe/agent 0.5.2 → 0.6.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.
- package/lib/AutoBeAgent.js +4 -4
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +1 -1
- package/lib/context/AutoBeContext.d.ts +2 -2
- package/lib/context/IAutoBeApplicationProps.d.ts +6 -0
- package/lib/factory/createAgenticaHistory.js +1 -0
- package/lib/factory/createAgenticaHistory.js.map +1 -1
- package/lib/factory/createAutoBeApplication.js +16 -16
- package/lib/factory/createAutoBeApplication.js.map +1 -1
- package/lib/index.mjs +3946 -3841
- package/lib/index.mjs.map +1 -1
- package/lib/{analyze → orchestrate/analyze}/AutoBeAnalyzeAgent.d.ts +4 -8
- package/lib/{analyze → orchestrate/analyze}/AutoBeAnalyzeAgent.js +10 -2
- package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js.map +1 -0
- package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.js.map +1 -0
- package/lib/orchestrate/analyze/AutoBeAnalyzePointer.d.ts +9 -0
- package/lib/orchestrate/analyze/AutoBeAnalyzePointer.js +3 -0
- package/lib/orchestrate/analyze/AutoBeAnalyzePointer.js.map +1 -0
- package/lib/{analyze → orchestrate/analyze}/AutoBeAnalyzeReviewer.d.ts +1 -1
- package/lib/{analyze → orchestrate/analyze}/AutoBeAnalyzeReviewer.js +5 -0
- package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js.map +1 -0
- package/lib/orchestrate/{orchestrateAnalyze.d.ts → analyze/orchestrateAnalyze.d.ts} +2 -2
- package/lib/orchestrate/{orchestrateAnalyze.js → analyze/orchestrateAnalyze.js} +101 -38
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -0
- package/lib/orchestrate/facade/transformFacadeStateMessage.js +1 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
- package/lib/orchestrate/index.d.ts +3 -3
- package/lib/orchestrate/index.js +6 -6
- package/lib/orchestrate/index.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +5 -0
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +3 -0
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +1 -1
- package/lib/orchestrate/interface/transformInterfaceHistories.js +15 -0
- package/lib/orchestrate/interface/transformInterfaceHistories.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js +7 -0
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaCorrectHistories.js +9 -0
- package/lib/orchestrate/prisma/transformPrismaCorrectHistories.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaHistories.js +9 -0
- package/lib/orchestrate/prisma/transformPrismaHistories.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +7 -0
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/structures/IAutoBeVendor.d.ts +45 -2
- package/package.json +6 -6
- package/src/AutoBeAgent.ts +5 -3
- package/src/constants/AutoBeSystemPromptConstant.ts +1 -1
- package/src/context/AutoBeContext.ts +2 -2
- package/src/context/IAutoBeApplicationProps.ts +6 -0
- package/src/factory/createAgenticaHistory.ts +1 -0
- package/src/factory/createAutoBeApplication.ts +1 -1
- package/src/{analyze → orchestrate/analyze}/AutoBeAnalyzeAgent.ts +20 -15
- package/src/orchestrate/analyze/AutoBeAnalyzePointer.ts +10 -0
- package/src/{analyze → orchestrate/analyze}/AutoBeAnalyzeReviewer.ts +7 -2
- package/src/orchestrate/{orchestrateAnalyze.ts → analyze/orchestrateAnalyze.ts} +43 -24
- package/src/orchestrate/index.ts +3 -3
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +5 -0
- package/src/orchestrate/interface/orchestrateInterfaceComponents.ts +3 -0
- package/src/orchestrate/interface/transformInterfaceHistories.ts +15 -0
- package/src/orchestrate/prisma/transformPrismaComponentsHistories.ts +7 -0
- package/src/orchestrate/prisma/transformPrismaCorrectHistories.ts +9 -0
- package/src/orchestrate/prisma/transformPrismaHistories.ts +9 -0
- package/src/orchestrate/prisma/transformPrismaSchemaHistories.ts +7 -0
- package/src/structures/IAutoBeVendor.ts +48 -2
- package/lib/analyze/AnalyzeAgent.d.ts +0 -24
- package/lib/analyze/AnalyzeAgent.js +0 -942
- package/lib/analyze/AnalyzeAgent.js.map +0 -1
- package/lib/analyze/AutoBeAnalyzeAgent.js.map +0 -1
- package/lib/analyze/AutoBeAnalyzeFileSystem.js.map +0 -1
- package/lib/analyze/AutoBeAnalyzeReviewer.js.map +0 -1
- package/lib/orchestrate/orchestrateAnalyze.js.map +0 -1
- package/src/analyze/AnalyzeAgent.ts +0 -183
- /package/lib/{analyze → orchestrate/analyze}/AutoBeAnalyzeFileSystem.d.ts +0 -0
- /package/lib/{analyze → orchestrate/analyze}/AutoBeAnalyzeFileSystem.js +0 -0
- /package/src/{analyze → orchestrate/analyze}/AutoBeAnalyzeFileSystem.ts +0 -0
|
@@ -5,8 +5,8 @@ import typia from "typia";
|
|
|
5
5
|
import { AutoBeContext } from "../context/AutoBeContext";
|
|
6
6
|
import { IAutoBeApplication } from "../context/IAutoBeApplication";
|
|
7
7
|
import { assertSchemaModel } from "../context/assertSchemaModel";
|
|
8
|
+
import { orchestrateAnalyze } from "../orchestrate/analyze/orchestrateAnalyze";
|
|
8
9
|
import { orchestrateInterface } from "../orchestrate/interface/orchestrateInterface";
|
|
9
|
-
import { orchestrateAnalyze } from "../orchestrate/orchestrateAnalyze";
|
|
10
10
|
import { orchestrateRealize } from "../orchestrate/orchestrateRealize";
|
|
11
11
|
import { orchestrateTest } from "../orchestrate/orchestrateTest";
|
|
12
12
|
import { orchestratePrisma } from "../orchestrate/prisma/orchestratePrisma";
|
|
@@ -1,38 +1,37 @@
|
|
|
1
1
|
import { IAgenticaController, MicroAgentica } from "@agentica/core";
|
|
2
2
|
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
3
|
-
import { IPointer } from "tstl";
|
|
4
3
|
import typia from "typia";
|
|
4
|
+
import { v4 } from "uuid";
|
|
5
5
|
|
|
6
|
-
import { AutoBeSystemPromptConstant } from "
|
|
7
|
-
import { AutoBeContext } from "
|
|
8
|
-
import { assertSchemaModel } from "
|
|
6
|
+
import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
|
|
7
|
+
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
8
|
+
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
9
9
|
import {
|
|
10
10
|
AutoBeAnalyzeFileSystem,
|
|
11
11
|
IAutoBeAnalyzeFileSystem,
|
|
12
12
|
} from "./AutoBeAnalyzeFileSystem";
|
|
13
|
+
import {
|
|
14
|
+
AutoBEAnalyzeFileMap,
|
|
15
|
+
AutoBeAnalyzePointer,
|
|
16
|
+
} from "./AutoBeAnalyzePointer";
|
|
13
17
|
import { AutoBeAnalyzeReviewer } from "./AutoBeAnalyzeReviewer";
|
|
14
18
|
|
|
15
|
-
type Filename = string;
|
|
16
|
-
type FileContent = string;
|
|
17
|
-
|
|
18
19
|
export class AutoBeAnalyzeAgent<Model extends ILlmSchema.Model> {
|
|
19
20
|
private readonly createAnalyzeAgent: () => MicroAgentica<Model>;
|
|
20
|
-
private readonly fileMap:
|
|
21
|
+
private readonly fileMap: AutoBEAnalyzeFileMap = {};
|
|
21
22
|
|
|
22
23
|
constructor(
|
|
23
24
|
private readonly createReviewerAgentFn: typeof AutoBeAnalyzeReviewer,
|
|
24
25
|
private readonly ctx: AutoBeContext<Model>,
|
|
25
|
-
private readonly pointer:
|
|
26
|
-
|
|
27
|
-
} | null>,
|
|
28
|
-
filenames: string[],
|
|
26
|
+
private readonly pointer: AutoBeAnalyzePointer,
|
|
27
|
+
private readonly filenames: string[],
|
|
29
28
|
) {
|
|
30
29
|
assertSchemaModel(ctx.model);
|
|
31
30
|
|
|
32
31
|
const controller = createController<Model>({
|
|
33
32
|
model: ctx.model,
|
|
34
33
|
execute: new AutoBeAnalyzeFileSystem(this.fileMap),
|
|
35
|
-
build: async (files:
|
|
34
|
+
build: async (files: AutoBEAnalyzeFileMap) => {
|
|
36
35
|
this.pointer.value = { files };
|
|
37
36
|
},
|
|
38
37
|
});
|
|
@@ -53,6 +52,8 @@ export class AutoBeAnalyzeAgent<Model extends ILlmSchema.Model> {
|
|
|
53
52
|
tokenUsage: ctx.usage(),
|
|
54
53
|
histories: [
|
|
55
54
|
{
|
|
55
|
+
id: v4(),
|
|
56
|
+
created_at: new Date().toISOString(),
|
|
56
57
|
type: "systemMessage",
|
|
57
58
|
text: AutoBeSystemPromptConstant.ANALYZE.replace(
|
|
58
59
|
"{% User Locale %}",
|
|
@@ -60,6 +61,8 @@ export class AutoBeAnalyzeAgent<Model extends ILlmSchema.Model> {
|
|
|
60
61
|
),
|
|
61
62
|
},
|
|
62
63
|
{
|
|
64
|
+
id: v4(),
|
|
65
|
+
created_at: new Date().toISOString(),
|
|
63
66
|
type: "systemMessage",
|
|
64
67
|
text: [
|
|
65
68
|
"# Guidelines",
|
|
@@ -68,11 +71,13 @@ export class AutoBeAnalyzeAgent<Model extends ILlmSchema.Model> {
|
|
|
68
71
|
].join("\n"),
|
|
69
72
|
},
|
|
70
73
|
{
|
|
74
|
+
id: v4(),
|
|
75
|
+
created_at: new Date().toISOString(),
|
|
71
76
|
type: "systemMessage",
|
|
72
77
|
text: [
|
|
73
78
|
"The following is the name of the entire file.",
|
|
74
79
|
"Use it to build a table of contents.",
|
|
75
|
-
filenames.map((filename) => `- ${filename}`),
|
|
80
|
+
this.filenames.map((filename) => `- ${filename}`),
|
|
76
81
|
"",
|
|
77
82
|
"However, do not touch other than the file you have to create.",
|
|
78
83
|
].join("\n"),
|
|
@@ -167,7 +172,7 @@ export class AutoBeAnalyzeAgent<Model extends ILlmSchema.Model> {
|
|
|
167
172
|
function createController<Model extends ILlmSchema.Model>(props: {
|
|
168
173
|
model: Model;
|
|
169
174
|
execute: AutoBeAnalyzeFileSystem;
|
|
170
|
-
build: (input:
|
|
175
|
+
build: (input: AutoBEAnalyzeFileMap) => void;
|
|
171
176
|
}): IAgenticaController.IClass<Model> {
|
|
172
177
|
assertSchemaModel(props.model);
|
|
173
178
|
const application: ILlmApplication<Model> = collection[
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IPointer } from "tstl";
|
|
2
|
+
|
|
3
|
+
type Filename = string;
|
|
4
|
+
type FileContent = string;
|
|
5
|
+
|
|
6
|
+
export interface AutoBEAnalyzeFileMap extends Record<Filename, FileContent> {}
|
|
7
|
+
|
|
8
|
+
export type AutoBeAnalyzePointer = IPointer<{
|
|
9
|
+
files: AutoBEAnalyzeFileMap;
|
|
10
|
+
} | null>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { MicroAgentica } from "@agentica/core";
|
|
2
2
|
import { ILlmSchema } from "@samchon/openapi";
|
|
3
|
+
import { v4 } from "uuid";
|
|
3
4
|
|
|
4
|
-
import { AutoBeSystemPromptConstant } from "
|
|
5
|
-
import { AutoBeContext } from "
|
|
5
|
+
import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
|
|
6
|
+
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
6
7
|
|
|
7
8
|
export const AutoBeAnalyzeReviewer = <Model extends ILlmSchema.Model>(
|
|
8
9
|
ctx: AutoBeContext<Model>,
|
|
@@ -27,10 +28,14 @@ export const AutoBeAnalyzeReviewer = <Model extends ILlmSchema.Model>(
|
|
|
27
28
|
(el) => el.type === "assistantMessage" || el.type === "userMessage",
|
|
28
29
|
),
|
|
29
30
|
{
|
|
31
|
+
id: v4(),
|
|
32
|
+
created_at: new Date().toISOString(),
|
|
30
33
|
type: "systemMessage",
|
|
31
34
|
text: AutoBeSystemPromptConstant.ANALYZE_REVIEWER,
|
|
32
35
|
},
|
|
33
36
|
{
|
|
37
|
+
id: v4(),
|
|
38
|
+
created_at: new Date().toISOString(),
|
|
34
39
|
type: "systemMessage",
|
|
35
40
|
text: [
|
|
36
41
|
"Below are all of the files.",
|
|
@@ -4,20 +4,17 @@ import {
|
|
|
4
4
|
AutoBeAssistantMessageHistory,
|
|
5
5
|
} from "@autobe/interface";
|
|
6
6
|
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
7
|
-
import { IPointer } from "tstl";
|
|
8
7
|
import typia from "typia";
|
|
9
8
|
import { v4 } from "uuid";
|
|
10
9
|
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
type Filename = string;
|
|
20
|
-
type FileContent = string;
|
|
10
|
+
import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
|
|
11
|
+
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
12
|
+
import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
|
|
13
|
+
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
14
|
+
import { AutoBeAnalyzeAgent } from "./AutoBeAnalyzeAgent";
|
|
15
|
+
import { IFile } from "./AutoBeAnalyzeFileSystem";
|
|
16
|
+
import { AutoBeAnalyzePointer } from "./AutoBeAnalyzePointer";
|
|
17
|
+
import { AutoBeAnalyzeReviewer } from "./AutoBeAnalyzeReviewer";
|
|
21
18
|
|
|
22
19
|
/** @todo Kakasoo */
|
|
23
20
|
export const orchestrateAnalyze =
|
|
@@ -98,14 +95,16 @@ export const orchestrateAnalyze =
|
|
|
98
95
|
}
|
|
99
96
|
|
|
100
97
|
const described = determined.find((el) => el.type === "describe");
|
|
101
|
-
const
|
|
98
|
+
const describedFiles = Array.from(
|
|
102
99
|
new Set(
|
|
103
100
|
described
|
|
104
101
|
? described.executes
|
|
105
102
|
.flatMap((el) => {
|
|
106
103
|
if (el.protocol === "class") {
|
|
107
104
|
return (
|
|
108
|
-
el.arguments as {
|
|
105
|
+
el.arguments as {
|
|
106
|
+
files: Array<Pick<IFile, "filename" | "reason">>;
|
|
107
|
+
}
|
|
109
108
|
).files;
|
|
110
109
|
}
|
|
111
110
|
return null;
|
|
@@ -115,33 +114,49 @@ export const orchestrateAnalyze =
|
|
|
115
114
|
),
|
|
116
115
|
);
|
|
117
116
|
|
|
117
|
+
if (describedFiles.length === 0) {
|
|
118
|
+
const history: AutoBeAssistantMessageHistory = {
|
|
119
|
+
id: v4(),
|
|
120
|
+
type: "assistantMessage",
|
|
121
|
+
text: "The current requirements are insufficient, so file generation will be suspended. It would be better to continue the conversation.",
|
|
122
|
+
created_at,
|
|
123
|
+
completed_at: new Date().toISOString(),
|
|
124
|
+
};
|
|
125
|
+
ctx.dispatch({
|
|
126
|
+
type: "assistantMessage",
|
|
127
|
+
text: "The current requirements are insufficient, so file generation will be suspended. It would be better to continue the conversation.",
|
|
128
|
+
created_at,
|
|
129
|
+
});
|
|
130
|
+
return history;
|
|
131
|
+
}
|
|
132
|
+
|
|
118
133
|
const pointers = await Promise.all(
|
|
119
|
-
|
|
120
|
-
const pointer:
|
|
121
|
-
files: Record<Filename, FileContent>;
|
|
122
|
-
} | null> = {
|
|
123
|
-
value: null,
|
|
124
|
-
};
|
|
134
|
+
describedFiles.map(async ({ filename, reason }) => {
|
|
135
|
+
const pointer: AutoBeAnalyzePointer = { value: null };
|
|
125
136
|
|
|
126
137
|
const agent = new AutoBeAnalyzeAgent(
|
|
127
138
|
AutoBeAnalyzeReviewer,
|
|
128
139
|
ctx,
|
|
129
140
|
pointer,
|
|
130
|
-
|
|
141
|
+
describedFiles.map((el) => el.filename),
|
|
131
142
|
);
|
|
132
143
|
|
|
133
144
|
await agent.conversate(
|
|
134
145
|
[
|
|
135
|
-
|
|
146
|
+
`# Instruction`,
|
|
147
|
+
`The names of all the files are as follows: ${describedFiles.join(",")}`,
|
|
136
148
|
"Assume that all files are in the same folder. Also, when pointing to the location of a file, go to the relative path.",
|
|
137
149
|
"",
|
|
138
150
|
`Among the various documents, the part you decided to take care of is as follows.: ${filename}`,
|
|
139
151
|
`Only write this document named '${filename}'.`,
|
|
140
152
|
"Never write other documents.",
|
|
141
153
|
"",
|
|
154
|
+
"# User Planning Requirements",
|
|
142
155
|
"```md",
|
|
143
156
|
JSON.stringify(userPlanningRequirements),
|
|
144
157
|
"```",
|
|
158
|
+
"The reason why this document needs to be written is as follows.",
|
|
159
|
+
`- reason: ${reason}`,
|
|
145
160
|
].join("\n"),
|
|
146
161
|
);
|
|
147
162
|
|
|
@@ -193,16 +208,20 @@ export const orchestrateAnalyze =
|
|
|
193
208
|
|
|
194
209
|
class DeterminingFiles {
|
|
195
210
|
/**
|
|
196
|
-
* Determining the Initial File List
|
|
211
|
+
* Determining the Initial File List.
|
|
197
212
|
*
|
|
198
213
|
* Design a list of initial documents that you need to create for that
|
|
199
214
|
* requirement. The list of documents is determined only by the name of the
|
|
200
|
-
* file.
|
|
215
|
+
* file. If you determine from the conversation that the user's requirements
|
|
216
|
+
* have not been fully gathered, you must stop the analysis and continue
|
|
217
|
+
* collecting the remaining requirements. In this case, you do not need to
|
|
218
|
+
* generate any files. Simply pass an empty array to `input.files`, which is
|
|
219
|
+
* the input value for the `determine` tool.
|
|
201
220
|
*
|
|
202
221
|
* @param input
|
|
203
222
|
* @returns
|
|
204
223
|
*/
|
|
205
|
-
determine(input: { files: Array<Pick<IFile, "filename">> }) {
|
|
224
|
+
determine(input: { files: Array<Pick<IFile, "filename" | "reason">> }) {
|
|
206
225
|
return input;
|
|
207
226
|
}
|
|
208
227
|
}
|
package/src/orchestrate/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { orchestrateAnalyze as analyze } from "./orchestrateAnalyze";
|
|
1
|
+
export { orchestrateAnalyze as analyze } from "./analyze/orchestrateAnalyze";
|
|
2
2
|
export { orchestrateInterface as interface } from "./interface/orchestrateInterface";
|
|
3
|
-
export { orchestratePrisma as prisma } from "./prisma/orchestratePrisma";
|
|
4
|
-
export { orchestrateTest as test } from "./orchestrateTest";
|
|
5
3
|
export { orchestrateRealize as realize } from "./orchestrateRealize";
|
|
4
|
+
export { orchestrateTest as test } from "./orchestrateTest";
|
|
5
|
+
export { orchestratePrisma as prisma } from "./prisma/orchestratePrisma";
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import { OpenApiV3_1Emender } from "@samchon/openapi/lib/converters/OpenApiV3_1Emender";
|
|
9
9
|
import { IPointer } from "tstl";
|
|
10
10
|
import typia from "typia";
|
|
11
|
+
import { v4 } from "uuid";
|
|
11
12
|
|
|
12
13
|
import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
|
|
13
14
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
@@ -51,6 +52,8 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
51
52
|
AutoBeSystemPromptConstant.INTERFACE_COMPLEMENT,
|
|
52
53
|
),
|
|
53
54
|
{
|
|
55
|
+
id: v4(),
|
|
56
|
+
created_at: new Date().toISOString(),
|
|
54
57
|
type: "assistantMessage",
|
|
55
58
|
text: [
|
|
56
59
|
"Here is the OpenAPI document what you've made:",
|
|
@@ -61,6 +64,8 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
61
64
|
].join("\n"),
|
|
62
65
|
},
|
|
63
66
|
{
|
|
67
|
+
id: v4(),
|
|
68
|
+
created_at: new Date().toISOString(),
|
|
64
69
|
type: "assistantMessage",
|
|
65
70
|
text: [
|
|
66
71
|
"You have missed below schema types in the document.components.schemas:",
|
|
@@ -4,6 +4,7 @@ import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
|
4
4
|
import { OpenApiV3_1Emender } from "@samchon/openapi/lib/converters/OpenApiV3_1Emender";
|
|
5
5
|
import { IPointer } from "tstl";
|
|
6
6
|
import typia from "typia";
|
|
7
|
+
import { v4 } from "uuid";
|
|
7
8
|
|
|
8
9
|
import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
|
|
9
10
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
@@ -113,6 +114,8 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
113
114
|
AutoBeSystemPromptConstant.INTERFACE_SCHEMA,
|
|
114
115
|
),
|
|
115
116
|
{
|
|
117
|
+
id: v4(),
|
|
118
|
+
created_at: new Date().toISOString(),
|
|
116
119
|
type: "assistantMessage",
|
|
117
120
|
text: [
|
|
118
121
|
"Here is the OpenAPI operations generated by phase 2.",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
+
import { v4 } from "uuid";
|
|
2
3
|
|
|
3
4
|
import { AutoBeState } from "../../context/AutoBeState";
|
|
4
5
|
|
|
@@ -11,6 +12,8 @@ export const transformInterfaceHistories = (
|
|
|
11
12
|
if (state.analyze === null)
|
|
12
13
|
return [
|
|
13
14
|
{
|
|
15
|
+
id: v4(),
|
|
16
|
+
created_at: new Date().toISOString(),
|
|
14
17
|
type: "systemMessage",
|
|
15
18
|
text: [
|
|
16
19
|
"Requirement analysis is not yet completed.",
|
|
@@ -22,6 +25,8 @@ export const transformInterfaceHistories = (
|
|
|
22
25
|
else if (state.prisma === null)
|
|
23
26
|
return [
|
|
24
27
|
{
|
|
28
|
+
id: v4(),
|
|
29
|
+
created_at: new Date().toISOString(),
|
|
25
30
|
type: "systemMessage",
|
|
26
31
|
text: [
|
|
27
32
|
"Prisma DB schema generation is not yet completed.",
|
|
@@ -33,6 +38,8 @@ export const transformInterfaceHistories = (
|
|
|
33
38
|
else if (state.analyze.step !== state.prisma.step)
|
|
34
39
|
return [
|
|
35
40
|
{
|
|
41
|
+
id: v4(),
|
|
42
|
+
created_at: new Date().toISOString(),
|
|
36
43
|
type: "systemMessage",
|
|
37
44
|
text: [
|
|
38
45
|
"Prisma DB schema generation has not been updated",
|
|
@@ -45,6 +52,8 @@ export const transformInterfaceHistories = (
|
|
|
45
52
|
else if (state.prisma.compiled.type !== "success")
|
|
46
53
|
return [
|
|
47
54
|
{
|
|
55
|
+
id: v4(),
|
|
56
|
+
created_at: new Date().toISOString(),
|
|
48
57
|
type: "systemMessage",
|
|
49
58
|
text: [
|
|
50
59
|
"Prisma DB schema generation has not been updated",
|
|
@@ -56,10 +65,14 @@ export const transformInterfaceHistories = (
|
|
|
56
65
|
];
|
|
57
66
|
return [
|
|
58
67
|
{
|
|
68
|
+
id: v4(),
|
|
69
|
+
created_at: new Date().toISOString(),
|
|
59
70
|
type: "systemMessage",
|
|
60
71
|
text: systemMessage,
|
|
61
72
|
},
|
|
62
73
|
{
|
|
74
|
+
id: v4(),
|
|
75
|
+
created_at: new Date().toISOString(),
|
|
63
76
|
type: "assistantMessage",
|
|
64
77
|
text: [
|
|
65
78
|
"Requirement analysis and Prisma DB schema generation are ready.",
|
|
@@ -81,6 +94,8 @@ export const transformInterfaceHistories = (
|
|
|
81
94
|
].join("\n"),
|
|
82
95
|
},
|
|
83
96
|
{
|
|
97
|
+
id: v4(),
|
|
98
|
+
created_at: new Date().toISOString(),
|
|
84
99
|
type: "assistantMessage",
|
|
85
100
|
text: [
|
|
86
101
|
"Database schema and entity relationship diagrams are ready.",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
+
import { v4 } from "uuid";
|
|
2
3
|
|
|
3
4
|
import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
|
|
4
5
|
import { AutoBeState } from "../../context/AutoBeState";
|
|
@@ -11,6 +12,8 @@ export const transformPrismaComponentsHistories = (
|
|
|
11
12
|
if (state.analyze === null)
|
|
12
13
|
return [
|
|
13
14
|
{
|
|
15
|
+
id: v4(),
|
|
16
|
+
created_at: new Date().toISOString(),
|
|
14
17
|
type: "systemMessage",
|
|
15
18
|
text: [
|
|
16
19
|
"Requirement analysis is not yet completed.",
|
|
@@ -21,10 +24,14 @@ export const transformPrismaComponentsHistories = (
|
|
|
21
24
|
];
|
|
22
25
|
return [
|
|
23
26
|
{
|
|
27
|
+
id: v4(),
|
|
28
|
+
created_at: new Date().toISOString(),
|
|
24
29
|
type: "systemMessage",
|
|
25
30
|
text: AutoBeSystemPromptConstant.PRISMA_COMPONENT,
|
|
26
31
|
},
|
|
27
32
|
{
|
|
33
|
+
id: v4(),
|
|
34
|
+
created_at: new Date().toISOString(),
|
|
28
35
|
type: "assistantMessage",
|
|
29
36
|
text: [
|
|
30
37
|
"Here is the requirement analysis report.",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
2
|
import { IAutoBePrismaValidation } from "@autobe/interface";
|
|
3
|
+
import { v4 } from "uuid";
|
|
3
4
|
|
|
4
5
|
import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
|
|
5
6
|
|
|
@@ -10,10 +11,14 @@ export const transformPrismaCorrectHistories = (
|
|
|
10
11
|
> => {
|
|
11
12
|
return [
|
|
12
13
|
{
|
|
14
|
+
id: v4(),
|
|
15
|
+
created_at: new Date().toISOString(),
|
|
13
16
|
type: "systemMessage",
|
|
14
17
|
text: AutoBeSystemPromptConstant.PRISMA_CORRECT,
|
|
15
18
|
},
|
|
16
19
|
{
|
|
20
|
+
id: v4(),
|
|
21
|
+
created_at: new Date().toISOString(),
|
|
17
22
|
type: "assistantMessage",
|
|
18
23
|
text: [
|
|
19
24
|
"Here is the Prisma application data what you made:",
|
|
@@ -24,6 +29,8 @@ export const transformPrismaCorrectHistories = (
|
|
|
24
29
|
].join("\n"),
|
|
25
30
|
},
|
|
26
31
|
{
|
|
32
|
+
id: v4(),
|
|
33
|
+
created_at: new Date().toISOString(),
|
|
27
34
|
type: "assistantMessage",
|
|
28
35
|
text: [
|
|
29
36
|
"Below are the list of errors what you have to fix:",
|
|
@@ -34,6 +41,8 @@ export const transformPrismaCorrectHistories = (
|
|
|
34
41
|
].join("\n"),
|
|
35
42
|
},
|
|
36
43
|
{
|
|
44
|
+
id: v4(),
|
|
45
|
+
created_at: new Date().toISOString(),
|
|
37
46
|
type: "systemMessage",
|
|
38
47
|
text: [
|
|
39
48
|
"Before fixing the schema files,",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
+
import { v4 } from "uuid";
|
|
2
3
|
|
|
3
4
|
import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
|
|
4
5
|
import { AutoBeState } from "../../context/AutoBeState";
|
|
@@ -11,6 +12,8 @@ export const transformPrismaHistories = (
|
|
|
11
12
|
if (state.analyze === null)
|
|
12
13
|
return [
|
|
13
14
|
{
|
|
15
|
+
id: v4(),
|
|
16
|
+
created_at: new Date().toISOString(),
|
|
14
17
|
type: "systemMessage",
|
|
15
18
|
text: [
|
|
16
19
|
"Requirement analysis is not yet completed.",
|
|
@@ -21,14 +24,20 @@ export const transformPrismaHistories = (
|
|
|
21
24
|
];
|
|
22
25
|
return [
|
|
23
26
|
{
|
|
27
|
+
id: v4(),
|
|
28
|
+
created_at: new Date().toISOString(),
|
|
24
29
|
type: "systemMessage",
|
|
25
30
|
text: AutoBeSystemPromptConstant.PRISMA,
|
|
26
31
|
},
|
|
27
32
|
{
|
|
33
|
+
id: v4(),
|
|
34
|
+
created_at: new Date().toISOString(),
|
|
28
35
|
type: "assistantMessage",
|
|
29
36
|
text: AutoBeSystemPromptConstant.PRISMA_EXAMPLE,
|
|
30
37
|
},
|
|
31
38
|
{
|
|
39
|
+
id: v4(),
|
|
40
|
+
created_at: new Date().toISOString(),
|
|
32
41
|
type: "assistantMessage",
|
|
33
42
|
text: [
|
|
34
43
|
"Here is the requirement analysis report.",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
2
|
import { AutoBeAnalyzeHistory } from "@autobe/interface";
|
|
3
|
+
import { v4 } from "uuid";
|
|
3
4
|
|
|
4
5
|
import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
|
|
5
6
|
|
|
@@ -15,10 +16,14 @@ export const transformPrismaSchemaHistories = (
|
|
|
15
16
|
> => {
|
|
16
17
|
return [
|
|
17
18
|
{
|
|
19
|
+
id: v4(),
|
|
20
|
+
created_at: new Date().toISOString(),
|
|
18
21
|
type: "systemMessage",
|
|
19
22
|
text: AutoBeSystemPromptConstant.PRISMA_SCHEMA,
|
|
20
23
|
},
|
|
21
24
|
{
|
|
25
|
+
id: v4(),
|
|
26
|
+
created_at: new Date().toISOString(),
|
|
22
27
|
type: "systemMessage",
|
|
23
28
|
text: [
|
|
24
29
|
"Before making prisma schema files,",
|
|
@@ -29,6 +34,8 @@ export const transformPrismaSchemaHistories = (
|
|
|
29
34
|
].join("\n"),
|
|
30
35
|
},
|
|
31
36
|
{
|
|
37
|
+
id: v4(),
|
|
38
|
+
created_at: new Date().toISOString(),
|
|
32
39
|
type: "assistantMessage",
|
|
33
40
|
text: [
|
|
34
41
|
"Here is the requirement analysis report.",
|
|
@@ -1,3 +1,49 @@
|
|
|
1
|
-
import
|
|
1
|
+
import OpenAI from "openai";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* LLM service vendor for Agentica Chat.
|
|
5
|
+
*
|
|
6
|
+
* `IAgenticaVendor` is a type represents an LLM (Large Language Model) vendor
|
|
7
|
+
* of the {@link AutoBeAgent}.
|
|
8
|
+
*
|
|
9
|
+
* Currently, {@link AutoBeAgent} supports OpenAI SDK. However, it does not mean
|
|
10
|
+
* that you can use only OpenAI's GPT model in the {@link AutoBeAgent}. The
|
|
11
|
+
* OpenAI SDK is just a connection tool to the LLM vendor's API, and you can use
|
|
12
|
+
* other LLM vendors by configuring its `baseURL` and API key.
|
|
13
|
+
*
|
|
14
|
+
* Therefore, if you want to use another LLM vendor like Claude or Gemini,
|
|
15
|
+
* please configure the `baseURL` to the {@link api}, and set
|
|
16
|
+
* {@link IAutoBeProps.model schema model} as "cluade" or "gemini".
|
|
17
|
+
*
|
|
18
|
+
* @author Samchon
|
|
19
|
+
*/
|
|
20
|
+
export interface IAutoBeVendor {
|
|
21
|
+
/** OpenAI API instance. */
|
|
22
|
+
api: OpenAI;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Chat model to be used.
|
|
26
|
+
*
|
|
27
|
+
* `({}) & string` means to support third party hosting cloud(eg. openRouter,
|
|
28
|
+
* aws)
|
|
29
|
+
*/
|
|
30
|
+
model: OpenAI.ChatModel | ({} & string);
|
|
31
|
+
|
|
32
|
+
/** Options for the request. */
|
|
33
|
+
options?: OpenAI.RequestOptions | undefined;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Number of concurrent requests allowed.
|
|
37
|
+
*
|
|
38
|
+
* If you configure this property, {@link AutoBeAgent} will constrain the
|
|
39
|
+
* number of concurrent requests to the LLM vendor. If you want to share the
|
|
40
|
+
* semaphore instance with other agents, you can directly assign the
|
|
41
|
+
* {@link Semaphore} instance to this property.
|
|
42
|
+
*
|
|
43
|
+
* Otherwise, it will not limit the number of concurrent requests, and the
|
|
44
|
+
* {@link AutoBeAgent} will send requests asynchronously without any limit.
|
|
45
|
+
*
|
|
46
|
+
* @default 16
|
|
47
|
+
*/
|
|
48
|
+
semaphore?: number | undefined;
|
|
49
|
+
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
import { IPointer } from "tstl";
|
|
3
|
-
import { AutoBeContext } from "../context/AutoBeContext";
|
|
4
|
-
import { AutoBeAnalyzeReviewer } from "./AutoBeAnalyzeReviewer";
|
|
5
|
-
type Filename = string;
|
|
6
|
-
type FileContent = string;
|
|
7
|
-
export declare class AnalyzeAgent<Model extends ILlmSchema.Model> {
|
|
8
|
-
private readonly createReviewerAgentFn;
|
|
9
|
-
private readonly ctx;
|
|
10
|
-
private readonly pointer;
|
|
11
|
-
private readonly createInnerAgent;
|
|
12
|
-
private readonly fileMap;
|
|
13
|
-
constructor(createReviewerAgentFn: typeof AutoBeAnalyzeReviewer, ctx: AutoBeContext<Model>, pointer: IPointer<{
|
|
14
|
-
files: Record<Filename, FileContent>;
|
|
15
|
-
} | null>);
|
|
16
|
-
/**
|
|
17
|
-
* Conversate with planner agent
|
|
18
|
-
*
|
|
19
|
-
* @param content Conversation from user in this time.
|
|
20
|
-
* @returns
|
|
21
|
-
*/
|
|
22
|
-
conversate(content: string): Promise<string>;
|
|
23
|
-
}
|
|
24
|
-
export {};
|