@botonic/core 0.46.0-alpha.2 → 0.46.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.
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
export interface BaseMessage<T extends string = 'text' | 'textWithButtons' | 'botExecutor' | 'carousel' | 'exit'> {
|
|
3
|
+
type: T;
|
|
3
4
|
}
|
|
4
5
|
export interface Button {
|
|
5
6
|
text: string;
|
|
6
7
|
payload?: string;
|
|
7
8
|
url?: string;
|
|
9
|
+
target?: string;
|
|
8
10
|
}
|
|
9
11
|
export interface ButtonWithPayload {
|
|
10
12
|
text: string;
|
|
@@ -46,8 +48,8 @@ export interface CarouselMessage extends BaseMessage {
|
|
|
46
48
|
export interface ExitMessage extends BaseMessage {
|
|
47
49
|
type: 'exit';
|
|
48
50
|
}
|
|
49
|
-
export type OutputMessage = TextMessage | TextWithButtonsMessage | BotExecutorMessage | CarouselMessage | ExitMessage;
|
|
50
|
-
export type AgenticOutputMessage = Exclude<OutputMessage
|
|
51
|
+
export type OutputMessage<Extra extends BaseMessage<string> = never> = TextMessage | TextWithButtonsMessage | BotExecutorMessage | CarouselMessage | ExitMessage | Extra;
|
|
52
|
+
export type AgenticOutputMessage<Extra extends BaseMessage<string> = never> = Exclude<OutputMessage<Extra>, ExitMessage>;
|
|
51
53
|
export interface ToolExecution {
|
|
52
54
|
toolName: string;
|
|
53
55
|
toolArguments: Record<string, any>;
|
|
@@ -55,8 +57,8 @@ export interface ToolExecution {
|
|
|
55
57
|
knowledgebaseSourcesIds?: string[];
|
|
56
58
|
knowledgebaseChunksIds?: string[];
|
|
57
59
|
}
|
|
58
|
-
export interface RunResult {
|
|
59
|
-
messages: AgenticOutputMessage[];
|
|
60
|
+
export interface RunResult<Extra extends BaseMessage<string> = never> {
|
|
61
|
+
messages: AgenticOutputMessage<Extra>[];
|
|
60
62
|
toolsExecuted: ToolExecution[];
|
|
61
63
|
memoryLength: number;
|
|
62
64
|
exit: boolean;
|
|
@@ -64,7 +66,7 @@ export interface RunResult {
|
|
|
64
66
|
inputGuardrailsTriggered: string[];
|
|
65
67
|
outputGuardrailsTriggered: string[];
|
|
66
68
|
}
|
|
67
|
-
export type InferenceResponse = RunResult
|
|
69
|
+
export type InferenceResponse<Extra extends BaseMessage<string> = never> = RunResult<Extra>;
|
|
68
70
|
export interface GuardrailRule {
|
|
69
71
|
name: string;
|
|
70
72
|
description: string;
|
|
@@ -84,5 +86,6 @@ export interface AiAgentArgs {
|
|
|
84
86
|
}[];
|
|
85
87
|
inputGuardrailRules?: GuardrailRule[];
|
|
86
88
|
sourceIds?: string[];
|
|
89
|
+
outputMessagesSchemas?: z.ZodObject<any>[];
|
|
87
90
|
}
|
|
88
91
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-agents.js","sourceRoot":"","sources":["../../../src/models/ai-agents.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ai-agents.js","sourceRoot":"","sources":["../../../src/models/ai-agents.ts"],"names":[],"mappings":";;;AAqGA,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,mCAAiB,CAAA;IACjB,+BAAa,CAAA;AACf,CAAC,EAJW,cAAc,8BAAd,cAAc,QAIzB"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
export interface BaseMessage<T extends string = 'text' | 'textWithButtons' | 'botExecutor' | 'carousel' | 'exit'> {
|
|
3
|
+
type: T;
|
|
3
4
|
}
|
|
4
5
|
export interface Button {
|
|
5
6
|
text: string;
|
|
6
7
|
payload?: string;
|
|
7
8
|
url?: string;
|
|
9
|
+
target?: string;
|
|
8
10
|
}
|
|
9
11
|
export interface ButtonWithPayload {
|
|
10
12
|
text: string;
|
|
@@ -46,8 +48,8 @@ export interface CarouselMessage extends BaseMessage {
|
|
|
46
48
|
export interface ExitMessage extends BaseMessage {
|
|
47
49
|
type: 'exit';
|
|
48
50
|
}
|
|
49
|
-
export type OutputMessage = TextMessage | TextWithButtonsMessage | BotExecutorMessage | CarouselMessage | ExitMessage;
|
|
50
|
-
export type AgenticOutputMessage = Exclude<OutputMessage
|
|
51
|
+
export type OutputMessage<Extra extends BaseMessage<string> = never> = TextMessage | TextWithButtonsMessage | BotExecutorMessage | CarouselMessage | ExitMessage | Extra;
|
|
52
|
+
export type AgenticOutputMessage<Extra extends BaseMessage<string> = never> = Exclude<OutputMessage<Extra>, ExitMessage>;
|
|
51
53
|
export interface ToolExecution {
|
|
52
54
|
toolName: string;
|
|
53
55
|
toolArguments: Record<string, any>;
|
|
@@ -55,8 +57,8 @@ export interface ToolExecution {
|
|
|
55
57
|
knowledgebaseSourcesIds?: string[];
|
|
56
58
|
knowledgebaseChunksIds?: string[];
|
|
57
59
|
}
|
|
58
|
-
export interface RunResult {
|
|
59
|
-
messages: AgenticOutputMessage[];
|
|
60
|
+
export interface RunResult<Extra extends BaseMessage<string> = never> {
|
|
61
|
+
messages: AgenticOutputMessage<Extra>[];
|
|
60
62
|
toolsExecuted: ToolExecution[];
|
|
61
63
|
memoryLength: number;
|
|
62
64
|
exit: boolean;
|
|
@@ -64,7 +66,7 @@ export interface RunResult {
|
|
|
64
66
|
inputGuardrailsTriggered: string[];
|
|
65
67
|
outputGuardrailsTriggered: string[];
|
|
66
68
|
}
|
|
67
|
-
export type InferenceResponse = RunResult
|
|
69
|
+
export type InferenceResponse<Extra extends BaseMessage<string> = never> = RunResult<Extra>;
|
|
68
70
|
export interface GuardrailRule {
|
|
69
71
|
name: string;
|
|
70
72
|
description: string;
|
|
@@ -84,5 +86,6 @@ export interface AiAgentArgs {
|
|
|
84
86
|
}[];
|
|
85
87
|
inputGuardrailRules?: GuardrailRule[];
|
|
86
88
|
sourceIds?: string[];
|
|
89
|
+
outputMessagesSchemas?: z.ZodObject<any>[];
|
|
87
90
|
}
|
|
88
91
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-agents.js","sourceRoot":"","sources":["../../../src/models/ai-agents.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ai-agents.js","sourceRoot":"","sources":["../../../src/models/ai-agents.ts"],"names":[],"mappings":";;;AAqGA,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,mCAAiB,CAAA;IACjB,+BAAa,CAAA;AACf,CAAC,EAJW,cAAc,8BAAd,cAAc,QAIzB"}
|
package/package.json
CHANGED
package/src/models/ai-agents.ts
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { z } from 'zod'
|
|
2
|
+
export interface BaseMessage<
|
|
3
|
+
T extends string =
|
|
4
|
+
| 'text'
|
|
5
|
+
| 'textWithButtons'
|
|
6
|
+
| 'botExecutor'
|
|
7
|
+
| 'carousel'
|
|
8
|
+
| 'exit',
|
|
9
|
+
> {
|
|
10
|
+
type: T
|
|
3
11
|
}
|
|
4
12
|
|
|
5
13
|
export interface Button {
|
|
6
14
|
text: string
|
|
7
15
|
payload?: string
|
|
8
16
|
url?: string
|
|
17
|
+
target?: string
|
|
9
18
|
}
|
|
10
19
|
export interface ButtonWithPayload {
|
|
11
20
|
text: string
|
|
@@ -54,14 +63,16 @@ export interface ExitMessage extends BaseMessage {
|
|
|
54
63
|
type: 'exit'
|
|
55
64
|
}
|
|
56
65
|
|
|
57
|
-
export type OutputMessage =
|
|
66
|
+
export type OutputMessage<Extra extends BaseMessage<string> = never> =
|
|
58
67
|
| TextMessage
|
|
59
68
|
| TextWithButtonsMessage
|
|
60
69
|
| BotExecutorMessage
|
|
61
70
|
| CarouselMessage
|
|
62
71
|
| ExitMessage
|
|
72
|
+
| Extra
|
|
63
73
|
|
|
64
|
-
export type AgenticOutputMessage
|
|
74
|
+
export type AgenticOutputMessage<Extra extends BaseMessage<string> = never> =
|
|
75
|
+
Exclude<OutputMessage<Extra>, ExitMessage>
|
|
65
76
|
|
|
66
77
|
export interface ToolExecution {
|
|
67
78
|
toolName: string
|
|
@@ -71,8 +82,8 @@ export interface ToolExecution {
|
|
|
71
82
|
knowledgebaseChunksIds?: string[]
|
|
72
83
|
}
|
|
73
84
|
|
|
74
|
-
export interface RunResult {
|
|
75
|
-
messages: AgenticOutputMessage[]
|
|
85
|
+
export interface RunResult<Extra extends BaseMessage<string> = never> {
|
|
86
|
+
messages: AgenticOutputMessage<Extra>[]
|
|
76
87
|
toolsExecuted: ToolExecution[]
|
|
77
88
|
memoryLength: number
|
|
78
89
|
exit: boolean
|
|
@@ -81,7 +92,8 @@ export interface RunResult {
|
|
|
81
92
|
outputGuardrailsTriggered: string[]
|
|
82
93
|
}
|
|
83
94
|
|
|
84
|
-
export type InferenceResponse =
|
|
95
|
+
export type InferenceResponse<Extra extends BaseMessage<string> = never> =
|
|
96
|
+
RunResult<Extra>
|
|
85
97
|
|
|
86
98
|
export interface GuardrailRule {
|
|
87
99
|
name: string
|
|
@@ -101,4 +113,5 @@ export interface AiAgentArgs {
|
|
|
101
113
|
activeTools?: { name: string }[]
|
|
102
114
|
inputGuardrailRules?: GuardrailRule[]
|
|
103
115
|
sourceIds?: string[]
|
|
116
|
+
outputMessagesSchemas?: z.ZodObject<any>[]
|
|
104
117
|
}
|