@agentica/core 0.13.5 → 0.14.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/lib/Agentica.js +8 -10
- package/lib/Agentica.js.map +1 -1
- package/lib/context/AgenticaCancelPrompt.d.ts +4 -12
- package/lib/context/AgenticaCancelPrompt.js +0 -17
- package/lib/context/AgenticaCancelPrompt.js.map +1 -1
- package/lib/context/AgenticaOperationSelection.d.ts +4 -11
- package/lib/context/AgenticaOperationSelection.js +0 -14
- package/lib/context/AgenticaOperationSelection.js.map +1 -1
- package/lib/context/AgenticaTokenUsage.js.map +1 -1
- package/lib/context/internal/AgenticaTokenUsageAggregator.js.map +1 -1
- package/lib/events/AgenticaCallEvent.d.ts +23 -13
- package/lib/events/AgenticaCallEvent.js +0 -19
- package/lib/events/AgenticaCallEvent.js.map +1 -1
- package/lib/events/AgenticaCancelEvent.d.ts +4 -10
- package/lib/events/AgenticaCancelEvent.js +0 -15
- package/lib/events/AgenticaCancelEvent.js.map +1 -1
- package/lib/events/AgenticaDescribeEvent.d.ts +8 -27
- package/lib/events/AgenticaDescribeEvent.js +0 -52
- package/lib/events/AgenticaDescribeEvent.js.map +1 -1
- package/lib/events/AgenticaEvent.d.ts +13 -1
- package/lib/events/AgenticaEventBase.d.ts +5 -3
- package/lib/events/AgenticaEventBase.js +0 -7
- package/lib/events/AgenticaEventBase.js.map +1 -1
- package/lib/events/AgenticaExecuteEvent.d.ts +15 -15
- package/lib/events/AgenticaExecuteEvent.js +0 -30
- package/lib/events/AgenticaExecuteEvent.js.map +1 -1
- package/lib/events/AgenticaInitializeEvent.d.ts +3 -4
- package/lib/events/AgenticaInitializeEvent.js +0 -13
- package/lib/events/AgenticaInitializeEvent.js.map +1 -1
- package/lib/events/AgenticaRequestEvent.d.ts +5 -24
- package/lib/events/AgenticaRequestEvent.js +0 -19
- package/lib/events/AgenticaRequestEvent.js.map +1 -1
- package/lib/events/AgenticaResponseEvent.d.ts +22 -32
- package/lib/events/AgenticaResponseEvent.js +0 -13
- package/lib/events/AgenticaResponseEvent.js.map +1 -1
- package/lib/events/AgenticaSelectEvent.d.ts +6 -12
- package/lib/events/AgenticaSelectEvent.js +0 -23
- package/lib/events/AgenticaSelectEvent.js.map +1 -1
- package/lib/events/AgenticaTextEvent.d.ts +8 -27
- package/lib/events/AgenticaTextEvent.js +0 -52
- package/lib/events/AgenticaTextEvent.js.map +1 -1
- package/lib/events/AgenticaValidateEvent.d.ts +25 -0
- package/lib/events/AgenticaValidateEvent.js +3 -0
- package/lib/events/AgenticaValidateEvent.js.map +1 -0
- package/lib/factory/events.d.ts +65 -0
- package/lib/factory/events.js +173 -0
- package/lib/factory/events.js.map +1 -0
- package/lib/factory/index.d.ts +3 -0
- package/lib/factory/index.js +20 -0
- package/lib/factory/index.js.map +1 -0
- package/lib/factory/operations.d.ts +7 -0
- package/lib/factory/operations.js +14 -0
- package/lib/factory/operations.js.map +1 -0
- package/lib/factory/prompts.d.ts +30 -0
- package/lib/factory/prompts.js +76 -0
- package/lib/factory/prompts.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +25 -4
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +328 -347
- package/lib/index.mjs.map +1 -1
- package/lib/json/IAgenticaEventJson.d.ts +4 -2
- package/lib/json/IAgenticaPromptJson.d.ts +1 -1
- package/lib/orchestrate/ChatGptAgent.js.map +1 -0
- package/lib/{chatgpt → orchestrate}/ChatGptCallFunctionAgent.d.ts +2 -1
- package/lib/{chatgpt → orchestrate}/ChatGptCallFunctionAgent.js +33 -28
- package/lib/orchestrate/ChatGptCallFunctionAgent.js.map +1 -0
- package/lib/orchestrate/ChatGptCancelFunctionAgent.d.ts +12 -0
- package/lib/{chatgpt → orchestrate}/ChatGptCancelFunctionAgent.js +7 -9
- package/lib/orchestrate/ChatGptCancelFunctionAgent.js.map +1 -0
- package/lib/orchestrate/ChatGptCompletionMessageUtil.d.ts +14 -0
- package/lib/{chatgpt → orchestrate}/ChatGptCompletionMessageUtil.js +0 -5
- package/lib/orchestrate/ChatGptCompletionMessageUtil.js.map +1 -0
- package/lib/{chatgpt → orchestrate}/ChatGptDescribeFunctionAgent.d.ts +3 -2
- package/lib/{chatgpt → orchestrate}/ChatGptDescribeFunctionAgent.js +4 -5
- package/lib/orchestrate/ChatGptDescribeFunctionAgent.js.map +1 -0
- package/lib/{chatgpt → orchestrate}/ChatGptHistoryDecoder.d.ts +2 -1
- package/lib/{chatgpt → orchestrate}/ChatGptHistoryDecoder.js +0 -1
- package/lib/orchestrate/ChatGptHistoryDecoder.js.map +1 -0
- package/lib/{chatgpt → orchestrate}/ChatGptInitializeFunctionAgent.d.ts +2 -1
- package/lib/{chatgpt → orchestrate}/ChatGptInitializeFunctionAgent.js +4 -5
- package/lib/orchestrate/ChatGptInitializeFunctionAgent.js.map +1 -0
- package/lib/{chatgpt → orchestrate}/ChatGptSelectFunctionAgent.d.ts +1 -1
- package/lib/{chatgpt → orchestrate}/ChatGptSelectFunctionAgent.js +10 -13
- package/lib/orchestrate/ChatGptSelectFunctionAgent.js.map +1 -0
- package/lib/orchestrate/ChatGptUsageAggregator.d.ts +10 -0
- package/lib/{chatgpt → orchestrate}/ChatGptUsageAggregator.js +0 -3
- package/lib/orchestrate/ChatGptUsageAggregator.js.map +1 -0
- package/lib/orchestrate/index.d.ts +8 -0
- package/lib/orchestrate/index.js +25 -0
- package/lib/orchestrate/index.js.map +1 -0
- package/lib/prompts/AgenticaCancelPrompt.d.ts +4 -12
- package/lib/prompts/AgenticaCancelPrompt.js +0 -17
- package/lib/prompts/AgenticaCancelPrompt.js.map +1 -1
- package/lib/prompts/AgenticaDescribePrompt.d.ts +4 -12
- package/lib/prompts/AgenticaDescribePrompt.js +0 -17
- package/lib/prompts/AgenticaDescribePrompt.js.map +1 -1
- package/lib/prompts/AgenticaExecutePrompt.d.ts +42 -13
- package/lib/prompts/AgenticaExecutePrompt.js +0 -21
- package/lib/prompts/AgenticaExecutePrompt.js.map +1 -1
- package/lib/prompts/AgenticaPrompt.d.ts +10 -0
- package/lib/prompts/AgenticaPromptBase.d.ts +5 -6
- package/lib/prompts/AgenticaPromptBase.js +0 -19
- package/lib/prompts/AgenticaPromptBase.js.map +1 -1
- package/lib/prompts/AgenticaSelectPrompt.d.ts +4 -12
- package/lib/prompts/AgenticaSelectPrompt.js +0 -17
- package/lib/prompts/AgenticaSelectPrompt.js.map +1 -1
- package/lib/prompts/AgenticaTextPrompt.d.ts +4 -12
- package/lib/prompts/AgenticaTextPrompt.js +0 -17
- package/lib/prompts/AgenticaTextPrompt.js.map +1 -1
- package/lib/transformers/AgenticaEventTransformer.d.ts +16 -16
- package/lib/transformers/AgenticaEventTransformer.js +12 -30
- package/lib/transformers/AgenticaEventTransformer.js.map +1 -1
- package/lib/transformers/AgenticaPromptTransformer.d.ts +12 -11
- package/lib/transformers/AgenticaPromptTransformer.js +9 -19
- package/lib/transformers/AgenticaPromptTransformer.js.map +1 -1
- package/package.json +3 -3
- package/src/Agentica.ts +11 -11
- package/src/context/AgenticaCancelPrompt.ts +4 -25
- package/src/context/AgenticaContext.ts +0 -1
- package/src/context/AgenticaOperation.ts +0 -1
- package/src/context/AgenticaOperationCollection.ts +0 -1
- package/src/context/AgenticaOperationSelection.ts +4 -22
- package/src/context/AgenticaTokenUsage.ts +2 -2
- package/src/context/internal/AgenticaTokenUsageAggregator.ts +0 -1
- package/src/events/AgenticaCallEvent.ts +26 -29
- package/src/events/AgenticaCancelEvent.ts +4 -21
- package/src/events/AgenticaDescribeEvent.ts +8 -57
- package/src/events/AgenticaEvent.ts +14 -2
- package/src/events/AgenticaEventBase.ts +5 -6
- package/src/events/AgenticaExecuteEvent.ts +33 -41
- package/src/events/AgenticaInitializeEvent.ts +3 -11
- package/src/events/AgenticaRequestEvent.ts +5 -40
- package/src/events/AgenticaResponseEvent.ts +22 -39
- package/src/events/AgenticaSelectEvent.ts +6 -30
- package/src/events/AgenticaTextEvent.ts +11 -60
- package/src/events/AgenticaValidateEvent.ts +31 -0
- package/src/factory/events.ts +229 -0
- package/src/factory/index.ts +3 -0
- package/src/factory/operations.ts +17 -0
- package/src/factory/prompts.ts +104 -0
- package/src/index.ts +5 -6
- package/src/json/IAgenticaEventJson.ts +5 -3
- package/src/json/IAgenticaPromptJson.ts +1 -1
- package/src/{chatgpt → orchestrate}/ChatGptCallFunctionAgent.ts +62 -50
- package/src/{chatgpt → orchestrate}/ChatGptCancelFunctionAgent.ts +18 -16
- package/src/{chatgpt → orchestrate}/ChatGptCompletionMessageUtil.ts +7 -6
- package/src/{chatgpt → orchestrate}/ChatGptDescribeFunctionAgent.ts +7 -6
- package/src/{chatgpt → orchestrate}/ChatGptHistoryDecoder.ts +1 -2
- package/src/{chatgpt → orchestrate}/ChatGptInitializeFunctionAgent.ts +8 -7
- package/src/{chatgpt → orchestrate}/ChatGptSelectFunctionAgent.ts +18 -16
- package/src/{chatgpt → orchestrate}/ChatGptUsageAggregator.ts +3 -3
- package/src/orchestrate/index.ts +8 -0
- package/src/prompts/AgenticaCancelPrompt.ts +4 -25
- package/src/prompts/AgenticaDescribePrompt.ts +4 -25
- package/src/prompts/AgenticaExecutePrompt.ts +52 -44
- package/src/prompts/AgenticaPrompt.ts +10 -1
- package/src/prompts/AgenticaPromptBase.ts +5 -9
- package/src/prompts/AgenticaSelectPrompt.ts +4 -25
- package/src/prompts/AgenticaTextPrompt.ts +4 -26
- package/src/transformers/AgenticaEventTransformer.ts +30 -32
- package/src/transformers/AgenticaPromptTransformer.ts +22 -22
- package/lib/chatgpt/ChatGptAgent.js.map +0 -1
- package/lib/chatgpt/ChatGptCallFunctionAgent.js.map +0 -1
- package/lib/chatgpt/ChatGptCancelFunctionAgent.d.ts +0 -11
- package/lib/chatgpt/ChatGptCancelFunctionAgent.js.map +0 -1
- package/lib/chatgpt/ChatGptCompletionMessageUtil.d.ts +0 -13
- package/lib/chatgpt/ChatGptCompletionMessageUtil.js.map +0 -1
- package/lib/chatgpt/ChatGptDescribeFunctionAgent.js.map +0 -1
- package/lib/chatgpt/ChatGptHistoryDecoder.js.map +0 -1
- package/lib/chatgpt/ChatGptInitializeFunctionAgent.js.map +0 -1
- package/lib/chatgpt/ChatGptSelectFunctionAgent.js.map +0 -1
- package/lib/chatgpt/ChatGptUsageAggregator.d.ts +0 -9
- package/lib/chatgpt/ChatGptUsageAggregator.js.map +0 -1
- package/lib/context/AgenticaClassOperation.d.ts +0 -8
- package/lib/context/AgenticaClassOperation.js +0 -11
- package/lib/context/AgenticaClassOperation.js.map +0 -1
- package/lib/context/AgenticaHttpOperation.d.ts +0 -8
- package/lib/context/AgenticaHttpOperation.js +0 -11
- package/lib/context/AgenticaHttpOperation.js.map +0 -1
- package/lib/context/AgenticaOperationBase.d.ts +0 -29
- package/lib/context/AgenticaOperationBase.js +0 -21
- package/lib/context/AgenticaOperationBase.js.map +0 -1
- package/src/context/AgenticaClassOperation.ts +0 -23
- package/src/context/AgenticaHttpOperation.ts +0 -27
- package/src/context/AgenticaOperationBase.ts +0 -57
- package/lib/{chatgpt → orchestrate}/ChatGptAgent.d.ts +0 -0
- package/lib/{chatgpt → orchestrate}/ChatGptAgent.js +0 -0
- package/src/{chatgpt → orchestrate}/ChatGptAgent.ts +1 -1
|
@@ -1,22 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AgenticaRequestEvent = void 0;
|
|
4
|
-
const AgenticaEventBase_1 = require("./AgenticaEventBase");
|
|
5
|
-
class AgenticaRequestEvent extends AgenticaEventBase_1.AgenticaEventBase {
|
|
6
|
-
constructor(props) {
|
|
7
|
-
super("request");
|
|
8
|
-
this.source = props.source;
|
|
9
|
-
this.body = props.body;
|
|
10
|
-
this.options = props.options;
|
|
11
|
-
}
|
|
12
|
-
toJSON() {
|
|
13
|
-
return {
|
|
14
|
-
type: "request",
|
|
15
|
-
source: this.source,
|
|
16
|
-
body: this.body,
|
|
17
|
-
options: this.options,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.AgenticaRequestEvent = AgenticaRequestEvent;
|
|
22
3
|
//# sourceMappingURL=AgenticaRequestEvent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgenticaRequestEvent.js","sourceRoot":"","sources":["../../src/events/AgenticaRequestEvent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AgenticaRequestEvent.js","sourceRoot":"","sources":["../../src/events/AgenticaRequestEvent.ts"],"names":[],"mappings":""}
|
|
@@ -1,35 +1,25 @@
|
|
|
1
1
|
import type OpenAI from "openai";
|
|
2
|
+
import type { AgenticaEventBase } from "./AgenticaEventBase";
|
|
2
3
|
import type { AgenticaEventSource } from "./AgenticaEventSource";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*/
|
|
25
|
-
options?: OpenAI.RequestOptions | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* The text content stream.
|
|
28
|
-
*/
|
|
29
|
-
stream: ReadableStream<OpenAI.ChatCompletionChunk>;
|
|
30
|
-
/**
|
|
31
|
-
* Get the description text.
|
|
32
|
-
*/
|
|
33
|
-
join: () => Promise<OpenAI.ChatCompletion>;
|
|
34
|
-
}
|
|
4
|
+
export interface AgenticaResponseEvent extends AgenticaEventBase<"response"> {
|
|
5
|
+
/**
|
|
6
|
+
* The source agent of the response.
|
|
7
|
+
*/
|
|
8
|
+
source: AgenticaEventSource;
|
|
9
|
+
/**
|
|
10
|
+
* Request body.
|
|
11
|
+
*/
|
|
12
|
+
body: OpenAI.ChatCompletionCreateParamsStreaming;
|
|
13
|
+
/**
|
|
14
|
+
* The text content stream.
|
|
15
|
+
*/
|
|
16
|
+
stream: ReadableStream<OpenAI.ChatCompletionChunk>;
|
|
17
|
+
/**
|
|
18
|
+
* Options for the request.
|
|
19
|
+
*/
|
|
20
|
+
options?: OpenAI.RequestOptions | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Wait the completion.
|
|
23
|
+
*/
|
|
24
|
+
join: () => Promise<OpenAI.ChatCompletion>;
|
|
35
25
|
}
|
|
@@ -1,16 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AgenticaResponseEvent = void 0;
|
|
4
|
-
const AgenticaEventBase_1 = require("./AgenticaEventBase");
|
|
5
|
-
class AgenticaResponseEvent extends AgenticaEventBase_1.AgenticaEventBase {
|
|
6
|
-
constructor(props) {
|
|
7
|
-
super("response");
|
|
8
|
-
this.source = props.source;
|
|
9
|
-
this.body = props.body;
|
|
10
|
-
this.stream = props.stream;
|
|
11
|
-
this.options = props.options;
|
|
12
|
-
this.join = props.join;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.AgenticaResponseEvent = AgenticaResponseEvent;
|
|
16
3
|
//# sourceMappingURL=AgenticaResponseEvent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgenticaResponseEvent.js","sourceRoot":"","sources":["../../src/events/AgenticaResponseEvent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AgenticaResponseEvent.js","sourceRoot":"","sources":["../../src/events/AgenticaResponseEvent.ts"],"names":[],"mappings":""}
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
2
|
import type { AgenticaOperationSelection } from "../context/AgenticaOperationSelection";
|
|
3
3
|
import type { IAgenticaEventJson } from "../json/IAgenticaEventJson";
|
|
4
|
-
import { AgenticaSelectPrompt } from "../prompts/AgenticaSelectPrompt";
|
|
5
|
-
import { AgenticaEventBase } from "./AgenticaEventBase";
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
toPrompt(): AgenticaSelectPrompt<Model>;
|
|
11
|
-
}
|
|
12
|
-
export declare namespace AgenticaSelectEvent {
|
|
13
|
-
interface IProps<Model extends ILlmSchema.Model> {
|
|
14
|
-
selection: AgenticaOperationSelection<Model>;
|
|
15
|
-
}
|
|
4
|
+
import type { AgenticaSelectPrompt } from "../prompts/AgenticaSelectPrompt";
|
|
5
|
+
import type { AgenticaEventBase } from "./AgenticaEventBase";
|
|
6
|
+
export interface AgenticaSelectEvent<Model extends ILlmSchema.Model> extends AgenticaEventBase<"select"> {
|
|
7
|
+
selection: AgenticaOperationSelection<Model>;
|
|
8
|
+
toJSON: () => IAgenticaEventJson.ISelect;
|
|
9
|
+
toPrompt: () => AgenticaSelectPrompt<Model>;
|
|
16
10
|
}
|
|
@@ -1,26 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AgenticaSelectEvent = void 0;
|
|
4
|
-
const uuid_1 = require("uuid");
|
|
5
|
-
const AgenticaSelectPrompt_1 = require("../prompts/AgenticaSelectPrompt");
|
|
6
|
-
const AgenticaEventBase_1 = require("./AgenticaEventBase");
|
|
7
|
-
class AgenticaSelectEvent extends AgenticaEventBase_1.AgenticaEventBase {
|
|
8
|
-
constructor(props) {
|
|
9
|
-
super("select");
|
|
10
|
-
this.selection = props.selection;
|
|
11
|
-
}
|
|
12
|
-
toJSON() {
|
|
13
|
-
return {
|
|
14
|
-
type: "select",
|
|
15
|
-
selection: this.selection.toJSON(),
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
toPrompt() {
|
|
19
|
-
return new AgenticaSelectPrompt_1.AgenticaSelectPrompt({
|
|
20
|
-
id: (0, uuid_1.v4)(),
|
|
21
|
-
selections: [this.selection],
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.AgenticaSelectEvent = AgenticaSelectEvent;
|
|
26
3
|
//# sourceMappingURL=AgenticaSelectEvent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgenticaSelectEvent.js","sourceRoot":"","sources":["../../src/events/AgenticaSelectEvent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AgenticaSelectEvent.js","sourceRoot":"","sources":["../../src/events/AgenticaSelectEvent.ts"],"names":[],"mappings":""}
|
|
@@ -1,29 +1,10 @@
|
|
|
1
1
|
import type { IAgenticaEventJson } from "../json/IAgenticaEventJson";
|
|
2
|
-
import { AgenticaTextPrompt } from "../prompts/AgenticaTextPrompt";
|
|
3
|
-
import { AgenticaEventBase } from "./AgenticaEventBase";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* Returns true if the response is ready to be returned by the join method.
|
|
11
|
-
*/
|
|
12
|
-
get done(): boolean;
|
|
13
|
-
constructor(props: AgenticaTextEvent.IProps);
|
|
14
|
-
join(): Promise<string>;
|
|
15
|
-
toJSON(): IAgenticaEventJson.IText;
|
|
16
|
-
toPrompt(): AgenticaTextPrompt;
|
|
17
|
-
private readonly done_;
|
|
18
|
-
private readonly get_;
|
|
19
|
-
private readonly join_;
|
|
20
|
-
}
|
|
21
|
-
export declare namespace AgenticaTextEvent {
|
|
22
|
-
interface IProps {
|
|
23
|
-
role: "assistant" | "user";
|
|
24
|
-
stream: ReadableStream<string>;
|
|
25
|
-
done: () => boolean;
|
|
26
|
-
get: () => string;
|
|
27
|
-
join: () => Promise<string>;
|
|
28
|
-
}
|
|
2
|
+
import type { AgenticaTextPrompt } from "../prompts/AgenticaTextPrompt";
|
|
3
|
+
import type { AgenticaEventBase } from "./AgenticaEventBase";
|
|
4
|
+
export interface AgenticaTextEvent<Role extends "assistant" | "user" = "assistant" | "user"> extends AgenticaEventBase<"text"> {
|
|
5
|
+
role: Role;
|
|
6
|
+
stream: ReadableStream<string>;
|
|
7
|
+
join: () => Promise<string>;
|
|
8
|
+
toJSON: () => IAgenticaEventJson.IText;
|
|
9
|
+
toPrompt: () => AgenticaTextPrompt;
|
|
29
10
|
}
|
|
@@ -1,55 +1,3 @@
|
|
|
1
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); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
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());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.AgenticaTextEvent = void 0;
|
|
13
|
-
const AgenticaTextPrompt_1 = require("../prompts/AgenticaTextPrompt");
|
|
14
|
-
const AgenticaEventBase_1 = require("./AgenticaEventBase");
|
|
15
|
-
class AgenticaTextEvent extends AgenticaEventBase_1.AgenticaEventBase {
|
|
16
|
-
get text() {
|
|
17
|
-
return this.get_();
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Check if the join method can return a response immediately.
|
|
21
|
-
* Returns true if the response is ready to be returned by the join method.
|
|
22
|
-
*/
|
|
23
|
-
get done() {
|
|
24
|
-
return this.done_();
|
|
25
|
-
}
|
|
26
|
-
constructor(props) {
|
|
27
|
-
super("text");
|
|
28
|
-
this.role = props.role;
|
|
29
|
-
this.stream = props.stream;
|
|
30
|
-
this.done_ = props.done;
|
|
31
|
-
this.get_ = props.get;
|
|
32
|
-
this.join_ = props.join;
|
|
33
|
-
}
|
|
34
|
-
join() {
|
|
35
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
return this.join_();
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
toJSON() {
|
|
40
|
-
return {
|
|
41
|
-
type: "text",
|
|
42
|
-
role: this.role,
|
|
43
|
-
text: this.text,
|
|
44
|
-
done: this.done,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
toPrompt() {
|
|
48
|
-
return new AgenticaTextPrompt_1.AgenticaTextPrompt({
|
|
49
|
-
role: this.role,
|
|
50
|
-
text: this.text,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.AgenticaTextEvent = AgenticaTextEvent;
|
|
55
3
|
//# sourceMappingURL=AgenticaTextEvent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgenticaTextEvent.js","sourceRoot":"","sources":["../../src/events/AgenticaTextEvent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AgenticaTextEvent.js","sourceRoot":"","sources":["../../src/events/AgenticaTextEvent.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
import type { IValidation } from "typia";
|
|
3
|
+
import type { AgenticaEventBase } from "./AgenticaEventBase";
|
|
4
|
+
import type { AgenticaOperation } from "../context/AgenticaOperation";
|
|
5
|
+
import type { IAgenticaEventJson } from "../json/IAgenticaEventJson";
|
|
6
|
+
/**
|
|
7
|
+
* Event of a validation feedback.
|
|
8
|
+
*
|
|
9
|
+
* @author Samchon
|
|
10
|
+
*/
|
|
11
|
+
export interface AgenticaValidateEvent<Model extends ILlmSchema.Model> extends AgenticaEventBase<"validate"> {
|
|
12
|
+
/**
|
|
13
|
+
* ID of the tool calling.
|
|
14
|
+
*/
|
|
15
|
+
id: string;
|
|
16
|
+
/**
|
|
17
|
+
* Target operation to call.
|
|
18
|
+
*/
|
|
19
|
+
operation: AgenticaOperation<Model>;
|
|
20
|
+
/**
|
|
21
|
+
* Validation result as a failure.
|
|
22
|
+
*/
|
|
23
|
+
result: IValidation.IFailure;
|
|
24
|
+
toJSON: () => IAgenticaEventJson.IValidate;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgenticaValidateEvent.js","sourceRoot":"","sources":["../../src/events/AgenticaValidateEvent.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ILlmSchema, IValidation } from "@samchon/openapi";
|
|
2
|
+
import type OpenAI from "openai";
|
|
3
|
+
import type { AgenticaOperation } from "../context/AgenticaOperation";
|
|
4
|
+
import type { AgenticaOperationSelection } from "../context/AgenticaOperationSelection";
|
|
5
|
+
import type { AgenticaCallEvent } from "../events/AgenticaCallEvent";
|
|
6
|
+
import type { AgenticaCancelEvent } from "../events/AgenticaCancelEvent";
|
|
7
|
+
import type { AgenticaDescribeEvent } from "../events/AgenticaDescribeEvent";
|
|
8
|
+
import type { AgenticaEventSource } from "../events/AgenticaEventSource";
|
|
9
|
+
import type { AgenticaInitializeEvent } from "../events/AgenticaInitializeEvent";
|
|
10
|
+
import type { AgenticaRequestEvent } from "../events/AgenticaRequestEvent";
|
|
11
|
+
import type { AgenticaResponseEvent } from "../events/AgenticaResponseEvent";
|
|
12
|
+
import type { AgenticaTextEvent } from "../events/AgenticaTextEvent";
|
|
13
|
+
import type { AgenticaExecutePrompt } from "../prompts/AgenticaExecutePrompt";
|
|
14
|
+
import type { AgenticaExecuteEvent } from "../events/AgenticaExecuteEvent";
|
|
15
|
+
import type { AgenticaSelectEvent } from "../events/AgenticaSelectEvent";
|
|
16
|
+
import type { AgenticaValidateEvent } from "../events/AgenticaValidateEvent";
|
|
17
|
+
export declare function createInitializeEvent(): AgenticaInitializeEvent;
|
|
18
|
+
export declare function createSelectEvent<Model extends ILlmSchema.Model>(props: {
|
|
19
|
+
selection: AgenticaOperationSelection<Model>;
|
|
20
|
+
}): AgenticaSelectEvent<Model>;
|
|
21
|
+
export declare function createCancelEvent<Model extends ILlmSchema.Model>(props: {
|
|
22
|
+
selection: AgenticaOperationSelection<Model>;
|
|
23
|
+
}): AgenticaCancelEvent<Model>;
|
|
24
|
+
export declare function createCallEvent<Model extends ILlmSchema.Model>(props: {
|
|
25
|
+
id: string;
|
|
26
|
+
operation: AgenticaOperation<Model>;
|
|
27
|
+
arguments: Record<string, any>;
|
|
28
|
+
}): AgenticaCallEvent<Model>;
|
|
29
|
+
export declare function createValidateEvent<Model extends ILlmSchema.Model>(props: {
|
|
30
|
+
id: string;
|
|
31
|
+
operation: AgenticaOperation<Model>;
|
|
32
|
+
result: IValidation.IFailure;
|
|
33
|
+
}): AgenticaValidateEvent<Model>;
|
|
34
|
+
export declare function createExecuteEvent<Model extends ILlmSchema.Model>(props: {
|
|
35
|
+
id: string;
|
|
36
|
+
operation: AgenticaOperation<Model>;
|
|
37
|
+
arguments: Record<string, unknown>;
|
|
38
|
+
value: unknown;
|
|
39
|
+
}): AgenticaExecuteEvent<Model>;
|
|
40
|
+
export declare function createTextEvent<Role extends "user" | "assistant">(props: {
|
|
41
|
+
role: Role;
|
|
42
|
+
stream: ReadableStream<string>;
|
|
43
|
+
done: () => boolean;
|
|
44
|
+
get: () => string;
|
|
45
|
+
join: () => Promise<string>;
|
|
46
|
+
}): AgenticaTextEvent<Role>;
|
|
47
|
+
export declare function createDescribeEvent<Model extends ILlmSchema.Model>(props: {
|
|
48
|
+
executes: AgenticaExecutePrompt<Model>[];
|
|
49
|
+
stream: ReadableStream<string>;
|
|
50
|
+
done: () => boolean;
|
|
51
|
+
get: () => string;
|
|
52
|
+
join: () => Promise<string>;
|
|
53
|
+
}): AgenticaDescribeEvent<Model>;
|
|
54
|
+
export declare function createRequestEvent(props: {
|
|
55
|
+
source: AgenticaEventSource;
|
|
56
|
+
body: OpenAI.ChatCompletionCreateParamsStreaming;
|
|
57
|
+
options?: OpenAI.RequestOptions | undefined;
|
|
58
|
+
}): AgenticaRequestEvent;
|
|
59
|
+
export declare function createResponseEvent(props: {
|
|
60
|
+
source: AgenticaEventSource;
|
|
61
|
+
body: OpenAI.ChatCompletionCreateParamsStreaming;
|
|
62
|
+
options?: OpenAI.RequestOptions | undefined;
|
|
63
|
+
stream: ReadableStream<OpenAI.ChatCompletionChunk>;
|
|
64
|
+
join: () => Promise<OpenAI.ChatCompletion>;
|
|
65
|
+
}): AgenticaResponseEvent;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createInitializeEvent = createInitializeEvent;
|
|
4
|
+
exports.createSelectEvent = createSelectEvent;
|
|
5
|
+
exports.createCancelEvent = createCancelEvent;
|
|
6
|
+
exports.createCallEvent = createCallEvent;
|
|
7
|
+
exports.createValidateEvent = createValidateEvent;
|
|
8
|
+
exports.createExecuteEvent = createExecuteEvent;
|
|
9
|
+
exports.createTextEvent = createTextEvent;
|
|
10
|
+
exports.createDescribeEvent = createDescribeEvent;
|
|
11
|
+
exports.createRequestEvent = createRequestEvent;
|
|
12
|
+
exports.createResponseEvent = createResponseEvent;
|
|
13
|
+
const uuid_1 = require("uuid");
|
|
14
|
+
const prompts_1 = require("./prompts");
|
|
15
|
+
/* -----------------------------------------------------------
|
|
16
|
+
FUNCTION SELECTS
|
|
17
|
+
----------------------------------------------------------- */
|
|
18
|
+
function createInitializeEvent() {
|
|
19
|
+
const event = {
|
|
20
|
+
type: "initialize",
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
type: event.type,
|
|
24
|
+
toJSON: () => event,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function createSelectEvent(props) {
|
|
28
|
+
return {
|
|
29
|
+
type: "select",
|
|
30
|
+
selection: props.selection,
|
|
31
|
+
toJSON: () => ({
|
|
32
|
+
type: "select",
|
|
33
|
+
selection: props.selection.toJSON(),
|
|
34
|
+
}),
|
|
35
|
+
toPrompt: () => (0, prompts_1.createSelectPrompt)({
|
|
36
|
+
id: (0, uuid_1.v4)(),
|
|
37
|
+
selections: [props.selection],
|
|
38
|
+
}),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function createCancelEvent(props) {
|
|
42
|
+
return {
|
|
43
|
+
type: "cancel",
|
|
44
|
+
selection: props.selection,
|
|
45
|
+
toJSON: () => ({
|
|
46
|
+
type: "cancel",
|
|
47
|
+
selection: props.selection.toJSON(),
|
|
48
|
+
}),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/* -----------------------------------------------------------
|
|
52
|
+
FUNCTION CALLS
|
|
53
|
+
----------------------------------------------------------- */
|
|
54
|
+
function createCallEvent(props) {
|
|
55
|
+
return {
|
|
56
|
+
type: "call",
|
|
57
|
+
id: props.id,
|
|
58
|
+
operation: props.operation,
|
|
59
|
+
arguments: props.arguments,
|
|
60
|
+
toJSON: () => ({
|
|
61
|
+
type: "call",
|
|
62
|
+
id: props.id,
|
|
63
|
+
operation: props.operation.toJSON(),
|
|
64
|
+
arguments: props.arguments,
|
|
65
|
+
}),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function createValidateEvent(props) {
|
|
69
|
+
return {
|
|
70
|
+
type: "validate",
|
|
71
|
+
id: props.id,
|
|
72
|
+
operation: props.operation,
|
|
73
|
+
result: props.result,
|
|
74
|
+
toJSON: () => ({
|
|
75
|
+
type: "validate",
|
|
76
|
+
id: props.id,
|
|
77
|
+
operation: props.operation.toJSON(),
|
|
78
|
+
result: props.result,
|
|
79
|
+
}),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function createExecuteEvent(props) {
|
|
83
|
+
return {
|
|
84
|
+
type: "execute",
|
|
85
|
+
protocol: props.operation.protocol,
|
|
86
|
+
id: props.id,
|
|
87
|
+
operation: props.operation,
|
|
88
|
+
arguments: props.arguments,
|
|
89
|
+
value: props.value,
|
|
90
|
+
toJSON: () => ({
|
|
91
|
+
type: "execute",
|
|
92
|
+
protocol: props.operation.protocol,
|
|
93
|
+
id: props.id,
|
|
94
|
+
operation: props.operation.toJSON(),
|
|
95
|
+
arguments: props.arguments,
|
|
96
|
+
value: props.value,
|
|
97
|
+
}),
|
|
98
|
+
toPrompt: () => (0, prompts_1.createExecutePrompt)(props),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/* -----------------------------------------------------------
|
|
102
|
+
TEXT STEAMING
|
|
103
|
+
----------------------------------------------------------- */
|
|
104
|
+
function createTextEvent(props) {
|
|
105
|
+
return {
|
|
106
|
+
type: "text",
|
|
107
|
+
role: props.role,
|
|
108
|
+
stream: props.stream,
|
|
109
|
+
join: props.join,
|
|
110
|
+
toJSON: () => ({
|
|
111
|
+
type: "text",
|
|
112
|
+
role: props.role,
|
|
113
|
+
done: props.done(),
|
|
114
|
+
text: props.get(),
|
|
115
|
+
}),
|
|
116
|
+
toPrompt: () => ({
|
|
117
|
+
type: "text",
|
|
118
|
+
role: props.role,
|
|
119
|
+
text: props.get(),
|
|
120
|
+
toJSON: () => ({
|
|
121
|
+
type: "text",
|
|
122
|
+
role: props.role,
|
|
123
|
+
text: props.get(),
|
|
124
|
+
}),
|
|
125
|
+
}),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function createDescribeEvent(props) {
|
|
129
|
+
return {
|
|
130
|
+
type: "describe",
|
|
131
|
+
executes: props.executes,
|
|
132
|
+
stream: props.stream,
|
|
133
|
+
join: props.join,
|
|
134
|
+
toJSON: () => ({
|
|
135
|
+
type: "describe",
|
|
136
|
+
executes: props.executes.map(execute => execute.toJSON()),
|
|
137
|
+
done: props.done(),
|
|
138
|
+
text: props.get(),
|
|
139
|
+
}),
|
|
140
|
+
toPrompt: () => ({
|
|
141
|
+
type: "describe",
|
|
142
|
+
executes: props.executes,
|
|
143
|
+
text: props.get(),
|
|
144
|
+
toJSON: () => ({
|
|
145
|
+
type: "describe",
|
|
146
|
+
executes: props.executes.map(execute => execute.toJSON()),
|
|
147
|
+
text: props.get(),
|
|
148
|
+
}),
|
|
149
|
+
}),
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/* -----------------------------------------------------------
|
|
153
|
+
API REQUESTS
|
|
154
|
+
----------------------------------------------------------- */
|
|
155
|
+
function createRequestEvent(props) {
|
|
156
|
+
return {
|
|
157
|
+
type: "request",
|
|
158
|
+
source: props.source,
|
|
159
|
+
body: props.body,
|
|
160
|
+
options: props.options,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function createResponseEvent(props) {
|
|
164
|
+
return {
|
|
165
|
+
type: "response",
|
|
166
|
+
source: props.source,
|
|
167
|
+
body: props.body,
|
|
168
|
+
options: props.options,
|
|
169
|
+
stream: props.stream,
|
|
170
|
+
join: props.join,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/factory/events.ts"],"names":[],"mappings":";;AAyBA,sDAQC;AAED,8CAeC;AAED,8CAWC;AAKD,0CAiBC;AAED,kDAiBC;AAED,gDAwBC;AAKD,0CA6BC;AAED,kDA6BC;AAKD,gDAWC;AAED,kDAeC;AApOD,+BAA0B;AAoB1B,uCAAoE;AAEpE;;gEAEgE;AAChE,SAAgB,qBAAqB;IACnC,MAAM,KAAK,GAAmC;QAC5C,IAAI,EAAE,YAAY;KACnB,CAAC;IACF,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK;KACpB,CAAC;AACJ,CAAC;AAED,SAAgB,iBAAiB,CAAiC,KAEjE;IACC,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;YACb,IAAI,EAAE,QAAQ;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,KAAK,CAAC,IAAI;QAChB,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAC;AACJ,CAAC;AAED,SAAgB,mBAAmB,CAAC,KAMnC;IACC,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./events"), exports);
|
|
18
|
+
__exportStar(require("./operations"), exports);
|
|
19
|
+
__exportStar(require("./prompts"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,+CAA6B;AAC7B,4CAA0B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
import type { AgenticaOperation } from "../context/AgenticaOperation";
|
|
3
|
+
import type { AgenticaOperationSelection } from "../context/AgenticaOperationSelection";
|
|
4
|
+
export declare function createOperationSelection<Model extends ILlmSchema.Model>(props: {
|
|
5
|
+
operation: AgenticaOperation<Model>;
|
|
6
|
+
reason: string;
|
|
7
|
+
}): AgenticaOperationSelection<Model>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createOperationSelection = createOperationSelection;
|
|
4
|
+
function createOperationSelection(props) {
|
|
5
|
+
return {
|
|
6
|
+
operation: props.operation,
|
|
7
|
+
reason: props.reason,
|
|
8
|
+
toJSON: () => ({
|
|
9
|
+
operation: props.operation.toJSON(),
|
|
10
|
+
reason: props.reason,
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../src/factory/operations.ts"],"names":[],"mappings":";;AAIA,4DAYC;AAZD,SAAgB,wBAAwB,CAAiC,KAGxE;IACC,OAAO;QACL,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;YACb,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE;YACnC,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
import type { AgenticaTextPrompt } from "../prompts/AgenticaTextPrompt";
|
|
3
|
+
import type { AgenticaDescribePrompt } from "../prompts/AgenticaDescribePrompt";
|
|
4
|
+
import type { AgenticaExecutePrompt } from "../prompts/AgenticaExecutePrompt";
|
|
5
|
+
import type { AgenticaOperationSelection } from "../context/AgenticaOperationSelection";
|
|
6
|
+
import type { AgenticaSelectPrompt } from "../prompts/AgenticaSelectPrompt";
|
|
7
|
+
import type { AgenticaCancelPrompt } from "../context/AgenticaCancelPrompt";
|
|
8
|
+
import type { AgenticaOperation } from "../context/AgenticaOperation";
|
|
9
|
+
export declare function createTextPrompt<Role extends "assistant" | "user" = "assistant" | "user">(props: {
|
|
10
|
+
role: Role;
|
|
11
|
+
text: string;
|
|
12
|
+
}): AgenticaTextPrompt<Role>;
|
|
13
|
+
export declare function createDescribePrompt<Model extends ILlmSchema.Model>(props: {
|
|
14
|
+
executes: AgenticaExecutePrompt<Model>[];
|
|
15
|
+
text: string;
|
|
16
|
+
}): AgenticaDescribePrompt<Model>;
|
|
17
|
+
export declare function createSelectPrompt<Model extends ILlmSchema.Model>(props: {
|
|
18
|
+
id: string;
|
|
19
|
+
selections: AgenticaOperationSelection<Model>[];
|
|
20
|
+
}): AgenticaSelectPrompt<Model>;
|
|
21
|
+
export declare function createCancelPrompt<Model extends ILlmSchema.Model>(props: {
|
|
22
|
+
id: string;
|
|
23
|
+
selections: AgenticaOperationSelection<Model>[];
|
|
24
|
+
}): AgenticaCancelPrompt<Model>;
|
|
25
|
+
export declare function createExecutePrompt<Model extends ILlmSchema.Model>(props: {
|
|
26
|
+
id: string;
|
|
27
|
+
operation: AgenticaOperation<Model>;
|
|
28
|
+
arguments: Record<string, any>;
|
|
29
|
+
value: unknown;
|
|
30
|
+
}): AgenticaExecutePrompt<Model>;
|