@botonic/plugin-ai-agents 0.56.0-alpha.0 → 0.57.0-rslib-esm.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/{cjs/agents → agents}/base-agent.d.ts +4 -4
- package/lib/agents/base-agent.js +66 -0
- package/lib/agents/base-agent.js.map +1 -0
- package/lib/agents/index.d.ts +2 -0
- package/lib/agents/index.js +9 -0
- package/lib/agents/index.js.map +1 -0
- package/lib/{esm/agents → agents}/router-agent.d.ts +5 -5
- package/lib/agents/router-agent.js +50 -0
- package/lib/agents/router-agent.js.map +1 -0
- package/lib/{cjs/agents → agents}/specialist-agent.d.ts +5 -5
- package/lib/{cjs/agents → agents}/specialist-agent.js +65 -45
- package/lib/agents/specialist-agent.js.map +1 -0
- package/lib/{cjs/bot-config-tools.d.ts → bot-config-tools.d.ts} +1 -1
- package/lib/bot-config-tools.js +20 -0
- package/lib/bot-config-tools.js.map +1 -0
- package/lib/constants.js +26 -0
- package/lib/constants.js.map +1 -0
- package/lib/{esm/debug-logger.d.ts → debug-logger.d.ts} +1 -1
- package/lib/{cjs/debug-logger.js → debug-logger.js} +14 -9
- package/lib/debug-logger.js.map +1 -0
- package/lib/guardrails/index.d.ts +1 -0
- package/lib/guardrails/index.js +6 -0
- package/lib/guardrails/index.js.map +1 -0
- package/lib/{cjs/guardrails → guardrails}/input.d.ts +2 -2
- package/lib/guardrails/input.js +119 -0
- package/lib/guardrails/input.js.map +1 -0
- package/lib/{esm/index.d.ts → index.d.ts} +3 -3
- package/lib/{esm/index.js → index.js} +114 -74
- package/lib/index.js.map +1 -0
- package/lib/{cjs/llm-config.d.ts → llm-config.d.ts} +1 -1
- package/lib/llm-config.js +150 -0
- package/lib/llm-config.js.map +1 -0
- package/lib/{esm/runners → runners}/base-runner.d.ts +3 -3
- package/lib/{cjs/runners → runners}/base-runner.js +81 -69
- package/lib/runners/base-runner.js.map +1 -0
- package/lib/runners/index.d.ts +2 -0
- package/lib/runners/index.js +9 -0
- package/lib/runners/index.js.map +1 -0
- package/lib/{cjs/runners → runners}/router-runner.d.ts +2 -2
- package/lib/{cjs/runners → runners}/router-runner.js +19 -14
- package/lib/runners/router-runner.js.map +1 -0
- package/lib/{esm/runners → runners}/specialist-runner.d.ts +1 -1
- package/lib/runners/specialist-runner.js +10 -0
- package/lib/runners/specialist-runner.js.map +1 -0
- package/lib/{esm/services → services}/hubtype-api-client.d.ts +2 -2
- package/lib/services/hubtype-api-client.js +191 -0
- package/lib/services/hubtype-api-client.js.map +1 -0
- package/lib/{cjs/services → services}/types.d.ts +1 -1
- package/lib/services/types.js +13 -0
- package/lib/services/types.js.map +1 -0
- package/lib/structured-output/bot-executor.js +21 -0
- package/lib/structured-output/bot-executor.js.map +1 -0
- package/lib/structured-output/carousel.js +26 -0
- package/lib/structured-output/carousel.js.map +1 -0
- package/lib/structured-output/exit.js +14 -0
- package/lib/structured-output/exit.js.map +1 -0
- package/lib/{cjs/structured-output → structured-output}/index.d.ts +0 -10
- package/lib/structured-output/index.js +55 -0
- package/lib/structured-output/index.js.map +1 -0
- package/lib/structured-output/text-with-buttons.js +25 -0
- package/lib/structured-output/text-with-buttons.js.map +1 -0
- package/lib/structured-output/text.js +17 -0
- package/lib/structured-output/text.js.map +1 -0
- package/lib/{cjs/tools → tools}/index.d.ts +2 -2
- package/lib/tools/index.js +8 -0
- package/lib/tools/index.js.map +1 -0
- package/lib/{cjs/tools → tools}/retrieve-knowledge.d.ts +2 -2
- package/lib/tools/retrieve-knowledge.js +40 -0
- package/lib/tools/retrieve-knowledge.js.map +1 -0
- package/lib/{cjs/types.d.ts → types.d.ts} +3 -3
- package/lib/types.js +5 -0
- package/lib/types.js.map +1 -0
- package/package.json +10 -8
- package/src/structured-output/index.ts +0 -2
- package/src/types.ts +4 -4
- package/lib/cjs/agents/base-agent.js +0 -39
- package/lib/cjs/agents/base-agent.js.map +0 -1
- package/lib/cjs/agents/index.d.ts +0 -2
- package/lib/cjs/agents/index.js +0 -8
- package/lib/cjs/agents/index.js.map +0 -1
- package/lib/cjs/agents/router-agent.d.ts +0 -25
- package/lib/cjs/agents/router-agent.js +0 -33
- package/lib/cjs/agents/router-agent.js.map +0 -1
- package/lib/cjs/agents/specialist-agent.js.map +0 -1
- package/lib/cjs/bot-config-tools.js +0 -18
- package/lib/cjs/bot-config-tools.js.map +0 -1
- package/lib/cjs/constants.js +0 -25
- package/lib/cjs/constants.js.map +0 -1
- package/lib/cjs/debug-logger.d.ts +0 -33
- package/lib/cjs/debug-logger.js.map +0 -1
- package/lib/cjs/guardrails/index.d.ts +0 -1
- package/lib/cjs/guardrails/index.js +0 -5
- package/lib/cjs/guardrails/index.js.map +0 -1
- package/lib/cjs/guardrails/input.js +0 -96
- package/lib/cjs/guardrails/input.js.map +0 -1
- package/lib/cjs/index.d.ts +0 -22
- package/lib/cjs/index.js +0 -219
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/llm-config.js +0 -121
- package/lib/cjs/llm-config.js.map +0 -1
- package/lib/cjs/runners/base-runner.d.ts +0 -31
- package/lib/cjs/runners/base-runner.js.map +0 -1
- package/lib/cjs/runners/index.d.ts +0 -2
- package/lib/cjs/runners/index.js +0 -8
- package/lib/cjs/runners/index.js.map +0 -1
- package/lib/cjs/runners/router-runner.js.map +0 -1
- package/lib/cjs/runners/specialist-runner.d.ts +0 -4
- package/lib/cjs/runners/specialist-runner.js +0 -8
- package/lib/cjs/runners/specialist-runner.js.map +0 -1
- package/lib/cjs/services/hubtype-api-client.d.ts +0 -13
- package/lib/cjs/services/hubtype-api-client.js +0 -176
- package/lib/cjs/services/hubtype-api-client.js.map +0 -1
- package/lib/cjs/services/types.js +0 -13
- package/lib/cjs/services/types.js.map +0 -1
- package/lib/cjs/structured-output/bot-executor.js +0 -18
- package/lib/cjs/structured-output/bot-executor.js.map +0 -1
- package/lib/cjs/structured-output/carousel.js +0 -23
- package/lib/cjs/structured-output/carousel.js.map +0 -1
- package/lib/cjs/structured-output/exit.js +0 -11
- package/lib/cjs/structured-output/exit.js.map +0 -1
- package/lib/cjs/structured-output/index.js +0 -45
- package/lib/cjs/structured-output/index.js.map +0 -1
- package/lib/cjs/structured-output/request-contact-info.d.ts +0 -9
- package/lib/cjs/structured-output/request-contact-info.js +0 -14
- package/lib/cjs/structured-output/request-contact-info.js.map +0 -1
- package/lib/cjs/structured-output/text-with-buttons.js +0 -24
- package/lib/cjs/structured-output/text-with-buttons.js.map +0 -1
- package/lib/cjs/structured-output/text.js +0 -14
- package/lib/cjs/structured-output/text.js.map +0 -1
- package/lib/cjs/tools/index.js +0 -8
- package/lib/cjs/tools/index.js.map +0 -1
- package/lib/cjs/tools/retrieve-knowledge.js +0 -34
- package/lib/cjs/tools/retrieve-knowledge.js.map +0 -1
- package/lib/cjs/types.js +0 -3
- package/lib/cjs/types.js.map +0 -1
- package/lib/esm/agents/base-agent.d.ts +0 -28
- package/lib/esm/agents/base-agent.js +0 -39
- package/lib/esm/agents/base-agent.js.map +0 -1
- package/lib/esm/agents/index.d.ts +0 -2
- package/lib/esm/agents/index.js +0 -8
- package/lib/esm/agents/index.js.map +0 -1
- package/lib/esm/agents/router-agent.js +0 -33
- package/lib/esm/agents/router-agent.js.map +0 -1
- package/lib/esm/agents/specialist-agent.d.ts +0 -39
- package/lib/esm/agents/specialist-agent.js +0 -108
- package/lib/esm/agents/specialist-agent.js.map +0 -1
- package/lib/esm/bot-config-tools.d.ts +0 -7
- package/lib/esm/bot-config-tools.js +0 -18
- package/lib/esm/bot-config-tools.js.map +0 -1
- package/lib/esm/constants.d.ts +0 -21
- package/lib/esm/constants.js +0 -25
- package/lib/esm/constants.js.map +0 -1
- package/lib/esm/debug-logger.js +0 -116
- package/lib/esm/debug-logger.js.map +0 -1
- package/lib/esm/guardrails/index.d.ts +0 -1
- package/lib/esm/guardrails/index.js +0 -5
- package/lib/esm/guardrails/index.js.map +0 -1
- package/lib/esm/guardrails/input.d.ts +0 -10
- package/lib/esm/guardrails/input.js +0 -96
- package/lib/esm/guardrails/input.js.map +0 -1
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/llm-config.d.ts +0 -30
- package/lib/esm/llm-config.js +0 -121
- package/lib/esm/llm-config.js.map +0 -1
- package/lib/esm/runners/base-runner.js +0 -189
- package/lib/esm/runners/base-runner.js.map +0 -1
- package/lib/esm/runners/index.d.ts +0 -2
- package/lib/esm/runners/index.js +0 -8
- package/lib/esm/runners/index.js.map +0 -1
- package/lib/esm/runners/router-runner.d.ts +0 -8
- package/lib/esm/runners/router-runner.js +0 -44
- package/lib/esm/runners/router-runner.js.map +0 -1
- package/lib/esm/runners/specialist-runner.js +0 -8
- package/lib/esm/runners/specialist-runner.js.map +0 -1
- package/lib/esm/services/hubtype-api-client.js +0 -176
- package/lib/esm/services/hubtype-api-client.js.map +0 -1
- package/lib/esm/services/types.d.ts +0 -72
- package/lib/esm/services/types.js +0 -13
- package/lib/esm/services/types.js.map +0 -1
- package/lib/esm/structured-output/bot-executor.d.ts +0 -13
- package/lib/esm/structured-output/bot-executor.js +0 -18
- package/lib/esm/structured-output/bot-executor.js.map +0 -1
- package/lib/esm/structured-output/carousel.d.ts +0 -18
- package/lib/esm/structured-output/carousel.js +0 -23
- package/lib/esm/structured-output/carousel.js.map +0 -1
- package/lib/esm/structured-output/exit.d.ts +0 -6
- package/lib/esm/structured-output/exit.js +0 -11
- package/lib/esm/structured-output/exit.js.map +0 -1
- package/lib/esm/structured-output/index.d.ts +0 -108
- package/lib/esm/structured-output/index.js +0 -45
- package/lib/esm/structured-output/index.js.map +0 -1
- package/lib/esm/structured-output/request-contact-info.d.ts +0 -9
- package/lib/esm/structured-output/request-contact-info.js +0 -14
- package/lib/esm/structured-output/request-contact-info.js.map +0 -1
- package/lib/esm/structured-output/text-with-buttons.d.ts +0 -17
- package/lib/esm/structured-output/text-with-buttons.js +0 -24
- package/lib/esm/structured-output/text-with-buttons.js.map +0 -1
- package/lib/esm/structured-output/text.d.ts +0 -9
- package/lib/esm/structured-output/text.js +0 -14
- package/lib/esm/structured-output/text.js.map +0 -1
- package/lib/esm/tools/index.d.ts +0 -3
- package/lib/esm/tools/index.js +0 -8
- package/lib/esm/tools/index.js.map +0 -1
- package/lib/esm/tools/retrieve-knowledge.d.ts +0 -6
- package/lib/esm/tools/retrieve-knowledge.js +0 -34
- package/lib/esm/tools/retrieve-knowledge.js.map +0 -1
- package/lib/esm/types.d.ts +0 -53
- package/lib/esm/types.js +0 -3
- package/lib/esm/types.js.map +0 -1
- package/src/structured-output/request-contact-info.ts +0 -18
- /package/lib/{cjs/constants.d.ts → constants.d.ts} +0 -0
- /package/lib/{cjs/structured-output → structured-output}/bot-executor.d.ts +0 -0
- /package/lib/{cjs/structured-output → structured-output}/carousel.d.ts +0 -0
- /package/lib/{cjs/structured-output → structured-output}/exit.d.ts +0 -0
- /package/lib/{cjs/structured-output → structured-output}/text-with-buttons.d.ts +0 -0
- /package/lib/{cjs/structured-output → structured-output}/text.d.ts +0 -0
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import type { HubtypeAssistantMessage, HubtypeUserMessage } from '@botonic/core';
|
|
2
|
-
import type { AgenticInputMessage } from '../types';
|
|
3
|
-
export declare enum TrackProductName {
|
|
4
|
-
AI_AGENT = "ai_agent"
|
|
5
|
-
}
|
|
6
|
-
export declare enum TrackFeature {
|
|
7
|
-
AI_AGENT_RUN = "ai_agent_run",
|
|
8
|
-
AI_AGENT_GUARDRAIL = "ai_agent_guardrail"
|
|
9
|
-
}
|
|
10
|
-
export interface LlmRunData {
|
|
11
|
-
inference_id: string;
|
|
12
|
-
is_test: boolean;
|
|
13
|
-
product_name: string;
|
|
14
|
-
deployment_name: string;
|
|
15
|
-
model_name: string;
|
|
16
|
-
feature: string;
|
|
17
|
-
api_version?: string;
|
|
18
|
-
num_prompt_tokens: number;
|
|
19
|
-
num_completion_tokens: number;
|
|
20
|
-
duration_in_milliseconds: number;
|
|
21
|
-
temperature: number;
|
|
22
|
-
error: string | null;
|
|
23
|
-
}
|
|
24
|
-
export interface TrackLlmRunsData {
|
|
25
|
-
llm_runs: LlmRunData[];
|
|
26
|
-
}
|
|
27
|
-
export type HubtypeMessage = HubtypeAssistantMessage | HubtypeUserMessage;
|
|
28
|
-
interface HubtypeToolCall {
|
|
29
|
-
id: string;
|
|
30
|
-
type: 'function';
|
|
31
|
-
function: {
|
|
32
|
-
name: string;
|
|
33
|
-
arguments: string;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
interface HubtypeUserMessageV2 {
|
|
37
|
-
role: 'user';
|
|
38
|
-
content: string | null;
|
|
39
|
-
}
|
|
40
|
-
export interface HubtypeAssistantMessageV2 {
|
|
41
|
-
role: 'assistant';
|
|
42
|
-
content: string | null;
|
|
43
|
-
tool_calls?: HubtypeToolCall[] | null;
|
|
44
|
-
}
|
|
45
|
-
export interface HubtypeToolMessageV2 {
|
|
46
|
-
role: 'tool';
|
|
47
|
-
content: string | null;
|
|
48
|
-
tool_call_id: string;
|
|
49
|
-
}
|
|
50
|
-
interface HubtypeSystemMessageV2 {
|
|
51
|
-
role: 'system';
|
|
52
|
-
content: string | null;
|
|
53
|
-
}
|
|
54
|
-
export type HubtypeMessageV2 = HubtypeUserMessageV2 | HubtypeAssistantMessageV2 | HubtypeToolMessageV2 | HubtypeSystemMessageV2;
|
|
55
|
-
export interface MessageHistoryResponseV2 {
|
|
56
|
-
messages: HubtypeMessageV2[];
|
|
57
|
-
conversation_id: string | null;
|
|
58
|
-
truncated: boolean;
|
|
59
|
-
}
|
|
60
|
-
export interface GetMessagesV2Result {
|
|
61
|
-
messages: AgenticInputMessage[];
|
|
62
|
-
conversationId: string | null;
|
|
63
|
-
truncated: boolean;
|
|
64
|
-
}
|
|
65
|
-
export interface MessageHistoryV2Params {
|
|
66
|
-
last_message_id: string;
|
|
67
|
-
max_messages?: number;
|
|
68
|
-
include_tool_calls?: boolean;
|
|
69
|
-
max_full_tool_results?: number;
|
|
70
|
-
debug_mode?: boolean;
|
|
71
|
-
}
|
|
72
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TrackFeature = exports.TrackProductName = void 0;
|
|
4
|
-
var TrackProductName;
|
|
5
|
-
(function (TrackProductName) {
|
|
6
|
-
TrackProductName["AI_AGENT"] = "ai_agent";
|
|
7
|
-
})(TrackProductName || (exports.TrackProductName = TrackProductName = {}));
|
|
8
|
-
var TrackFeature;
|
|
9
|
-
(function (TrackFeature) {
|
|
10
|
-
TrackFeature["AI_AGENT_RUN"] = "ai_agent_run";
|
|
11
|
-
TrackFeature["AI_AGENT_GUARDRAIL"] = "ai_agent_guardrail";
|
|
12
|
-
})(TrackFeature || (exports.TrackFeature = TrackFeature = {}));
|
|
13
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/services/types.ts"],"names":[],"mappings":";;;AAGA,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IAC1B,yCAAqB,CAAA;AACvB,CAAC,EAFW,gBAAgB,gCAAhB,gBAAgB,QAE3B;AAED,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,6CAA6B,CAAA;IAC7B,yDAAyC,CAAA;AAC3C,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type BotExecutorMessage, OutputMessageType } from '@botonic/core';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
export type { BotExecutorMessage };
|
|
4
|
-
export declare const BotExecutorSchema: z.ZodObject<{
|
|
5
|
-
type: z.ZodLiteral<OutputMessageType.BotExecutor>;
|
|
6
|
-
content: z.ZodObject<{
|
|
7
|
-
text: z.ZodString;
|
|
8
|
-
buttons: z.ZodArray<z.ZodObject<{
|
|
9
|
-
text: z.ZodString;
|
|
10
|
-
payload: z.ZodString;
|
|
11
|
-
}, z.core.$strip>>;
|
|
12
|
-
}, z.core.$strip>;
|
|
13
|
-
}, z.core.$strip>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BotExecutorSchema = void 0;
|
|
4
|
-
const core_1 = require("@botonic/core");
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
exports.BotExecutorSchema = zod_1.z
|
|
7
|
-
.object({
|
|
8
|
-
type: zod_1.z.literal(core_1.OutputMessageType.BotExecutor),
|
|
9
|
-
content: zod_1.z.object({
|
|
10
|
-
text: zod_1.z.string(),
|
|
11
|
-
buttons: zod_1.z.array(zod_1.z.object({
|
|
12
|
-
text: zod_1.z.string(),
|
|
13
|
-
payload: zod_1.z.string(),
|
|
14
|
-
})),
|
|
15
|
-
}),
|
|
16
|
-
})
|
|
17
|
-
.describe('A text message with buttons to allow the bot to execute a specific action. Use it only when asked explicitly in the prompt');
|
|
18
|
-
//# sourceMappingURL=bot-executor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bot-executor.js","sourceRoot":"","sources":["../../../src/structured-output/bot-executor.ts"],"names":[],"mappings":";;;AAAA,wCAA0E;AAC1E,6BAAuB;AAIV,QAAA,iBAAiB,GAAG,OAAC;KAC/B,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAiB,CAAC,WAAW,CAAC;IAC9C,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,OAAC,CAAC,KAAK,CACd,OAAC,CAAC,MAAM,CAAC;YACP,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;YAChB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;SACpB,CAAC,CACH;KACF,CAAC;CACH,CAAC;KACD,QAAQ,CACP,4HAA4H,CAC7H,CAAA"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { type CarouselMessage, OutputMessageType } from '@botonic/core';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
export type { CarouselMessage };
|
|
4
|
-
export declare const CarouselSchema: z.ZodObject<{
|
|
5
|
-
type: z.ZodLiteral<OutputMessageType.Carousel>;
|
|
6
|
-
content: z.ZodObject<{
|
|
7
|
-
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
|
-
elements: z.ZodArray<z.ZodObject<{
|
|
9
|
-
title: z.ZodString;
|
|
10
|
-
subtitle: z.ZodString;
|
|
11
|
-
image: z.ZodString;
|
|
12
|
-
button: z.ZodObject<{
|
|
13
|
-
text: z.ZodString;
|
|
14
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
15
|
-
}, z.core.$strip>;
|
|
16
|
-
}, z.core.$strip>>;
|
|
17
|
-
}, z.core.$strip>;
|
|
18
|
-
}, z.core.$strip>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CarouselSchema = void 0;
|
|
4
|
-
const core_1 = require("@botonic/core");
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
exports.CarouselSchema = zod_1.z
|
|
7
|
-
.object({
|
|
8
|
-
type: zod_1.z.literal(core_1.OutputMessageType.Carousel),
|
|
9
|
-
content: zod_1.z.object({
|
|
10
|
-
text: zod_1.z.string().nullable().optional(),
|
|
11
|
-
elements: zod_1.z.array(zod_1.z.object({
|
|
12
|
-
title: zod_1.z.string(),
|
|
13
|
-
subtitle: zod_1.z.string(),
|
|
14
|
-
image: zod_1.z.string(),
|
|
15
|
-
button: zod_1.z.object({
|
|
16
|
-
text: zod_1.z.string(),
|
|
17
|
-
url: zod_1.z.string().nullable().optional(),
|
|
18
|
-
}),
|
|
19
|
-
})),
|
|
20
|
-
}),
|
|
21
|
-
})
|
|
22
|
-
.describe('A carousel message containing a list of elements');
|
|
23
|
-
//# sourceMappingURL=carousel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.js","sourceRoot":"","sources":["../../../src/structured-output/carousel.ts"],"names":[],"mappings":";;;AAAA,wCAAuE;AACvE,6BAAuB;AAIV,QAAA,cAAc,GAAG,OAAC;KAC5B,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAiB,CAAC,QAAQ,CAAC;IAC3C,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QACtC,QAAQ,EAAE,OAAC,CAAC,KAAK,CACf,OAAC,CAAC,MAAM,CAAC;YACP,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;YACjB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;YACpB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;YACjB,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;gBACf,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;gBAChB,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;aACtC,CAAC;SACH,CAAC,CACH;KACF,CAAC;CACH,CAAC;KACD,QAAQ,CAAC,kDAAkD,CAAC,CAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ExitSchema = void 0;
|
|
4
|
-
const core_1 = require("@botonic/core");
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
exports.ExitSchema = zod_1.z
|
|
7
|
-
.object({
|
|
8
|
-
type: zod_1.z.literal(core_1.OutputMessageType.Exit),
|
|
9
|
-
})
|
|
10
|
-
.describe('An exit message. This message should only be used to exit the agent due to out of context or the user asking to exit the conversation');
|
|
11
|
-
//# sourceMappingURL=exit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exit.js","sourceRoot":"","sources":["../../../src/structured-output/exit.ts"],"names":[],"mappings":";;;AAAA,wCAAmE;AACnE,6BAAuB;AAIV,QAAA,UAAU,GAAG,OAAC;KACxB,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAiB,CAAC,IAAI,CAAC;CACxC,CAAC;KACD,QAAQ,CACP,uIAAuI,CACxI,CAAA"}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import type { OutputMessage } from '@botonic/core';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
export interface Output {
|
|
4
|
-
messages: OutputMessage[];
|
|
5
|
-
}
|
|
6
|
-
export declare const OutputSchema: z.ZodObject<{
|
|
7
|
-
messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
8
|
-
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.Text>;
|
|
9
|
-
content: z.ZodObject<{
|
|
10
|
-
text: z.ZodString;
|
|
11
|
-
}, z.core.$strip>;
|
|
12
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
13
|
-
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.TextWithButtons>;
|
|
14
|
-
content: z.ZodObject<{
|
|
15
|
-
text: z.ZodString;
|
|
16
|
-
buttons: z.ZodArray<z.ZodObject<{
|
|
17
|
-
text: z.ZodString;
|
|
18
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19
|
-
target: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodEnum<{
|
|
20
|
-
_blank: "_blank";
|
|
21
|
-
_self: "_self";
|
|
22
|
-
}>>>>;
|
|
23
|
-
}, z.core.$strip>>;
|
|
24
|
-
}, z.core.$strip>;
|
|
25
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
26
|
-
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.Carousel>;
|
|
27
|
-
content: z.ZodObject<{
|
|
28
|
-
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
29
|
-
elements: z.ZodArray<z.ZodObject<{
|
|
30
|
-
title: z.ZodString;
|
|
31
|
-
subtitle: z.ZodString;
|
|
32
|
-
image: z.ZodString;
|
|
33
|
-
button: z.ZodObject<{
|
|
34
|
-
text: z.ZodString;
|
|
35
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
36
|
-
}, z.core.$strip>;
|
|
37
|
-
}, z.core.$strip>>;
|
|
38
|
-
}, z.core.$strip>;
|
|
39
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
40
|
-
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.Exit>;
|
|
41
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
42
|
-
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.BotExecutor>;
|
|
43
|
-
content: z.ZodObject<{
|
|
44
|
-
text: z.ZodString;
|
|
45
|
-
buttons: z.ZodArray<z.ZodObject<{
|
|
46
|
-
text: z.ZodString;
|
|
47
|
-
payload: z.ZodString;
|
|
48
|
-
}, z.core.$strip>>;
|
|
49
|
-
}, z.core.$strip>;
|
|
50
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
51
|
-
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.RequestContactInfo>;
|
|
52
|
-
content: z.ZodObject<{
|
|
53
|
-
text: z.ZodString;
|
|
54
|
-
}, z.core.$strip>;
|
|
55
|
-
}, z.core.$strip>]>>;
|
|
56
|
-
}, z.core.$strip>;
|
|
57
|
-
export declare function getOutputSchema(externalOutputMessagesSchemas: z.ZodObject<any>[]): z.ZodObject<{
|
|
58
|
-
messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
59
|
-
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.Text>;
|
|
60
|
-
content: z.ZodObject<{
|
|
61
|
-
text: z.ZodString;
|
|
62
|
-
}, z.core.$strip>;
|
|
63
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
64
|
-
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.TextWithButtons>;
|
|
65
|
-
content: z.ZodObject<{
|
|
66
|
-
text: z.ZodString;
|
|
67
|
-
buttons: z.ZodArray<z.ZodObject<{
|
|
68
|
-
text: z.ZodString;
|
|
69
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
70
|
-
target: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodEnum<{
|
|
71
|
-
_blank: "_blank";
|
|
72
|
-
_self: "_self";
|
|
73
|
-
}>>>>;
|
|
74
|
-
}, z.core.$strip>>;
|
|
75
|
-
}, z.core.$strip>;
|
|
76
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
77
|
-
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.Carousel>;
|
|
78
|
-
content: z.ZodObject<{
|
|
79
|
-
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
80
|
-
elements: z.ZodArray<z.ZodObject<{
|
|
81
|
-
title: z.ZodString;
|
|
82
|
-
subtitle: z.ZodString;
|
|
83
|
-
image: z.ZodString;
|
|
84
|
-
button: z.ZodObject<{
|
|
85
|
-
text: z.ZodString;
|
|
86
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
87
|
-
}, z.core.$strip>;
|
|
88
|
-
}, z.core.$strip>>;
|
|
89
|
-
}, z.core.$strip>;
|
|
90
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
91
|
-
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.Exit>;
|
|
92
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
93
|
-
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.BotExecutor>;
|
|
94
|
-
content: z.ZodObject<{
|
|
95
|
-
text: z.ZodString;
|
|
96
|
-
buttons: z.ZodArray<z.ZodObject<{
|
|
97
|
-
text: z.ZodString;
|
|
98
|
-
payload: z.ZodString;
|
|
99
|
-
}, z.core.$strip>>;
|
|
100
|
-
}, z.core.$strip>;
|
|
101
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
102
|
-
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.RequestContactInfo>;
|
|
103
|
-
content: z.ZodObject<{
|
|
104
|
-
text: z.ZodString;
|
|
105
|
-
}, z.core.$strip>;
|
|
106
|
-
}, z.core.$strip>, ...z.ZodObject<any, z.core.$strip>[]]>>;
|
|
107
|
-
}, z.core.$strip>;
|
|
108
|
-
export declare function getOutputInstructions(): string;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OutputSchema = void 0;
|
|
4
|
-
exports.getOutputSchema = getOutputSchema;
|
|
5
|
-
exports.getOutputInstructions = getOutputInstructions;
|
|
6
|
-
const zod_1 = require("zod");
|
|
7
|
-
const bot_executor_1 = require("./bot-executor");
|
|
8
|
-
const carousel_1 = require("./carousel");
|
|
9
|
-
const exit_1 = require("./exit");
|
|
10
|
-
const request_contact_info_1 = require("./request-contact-info");
|
|
11
|
-
const text_1 = require("./text");
|
|
12
|
-
const text_with_buttons_1 = require("./text-with-buttons");
|
|
13
|
-
const baseMessageSchemas = [
|
|
14
|
-
text_1.TextSchema,
|
|
15
|
-
text_with_buttons_1.TextWithButtonsSchema,
|
|
16
|
-
carousel_1.CarouselSchema,
|
|
17
|
-
exit_1.ExitSchema,
|
|
18
|
-
bot_executor_1.BotExecutorSchema,
|
|
19
|
-
request_contact_info_1.RequestContactInfoSchema,
|
|
20
|
-
];
|
|
21
|
-
exports.OutputSchema = zod_1.z
|
|
22
|
-
.object({
|
|
23
|
-
messages: zod_1.z.array(zod_1.z.union(baseMessageSchemas)),
|
|
24
|
-
})
|
|
25
|
-
.describe('The messages to be sent to the user');
|
|
26
|
-
function getOutputSchema(externalOutputMessagesSchemas) {
|
|
27
|
-
return zod_1.z.object({
|
|
28
|
-
messages: zod_1.z.array(zod_1.z.union([...baseMessageSchemas, ...externalOutputMessagesSchemas])),
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
function getOutputInstructions() {
|
|
32
|
-
const example = {
|
|
33
|
-
messages: [
|
|
34
|
-
{
|
|
35
|
-
type: 'text',
|
|
36
|
-
content: {
|
|
37
|
-
text: 'Hello, how can I help you today?',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
};
|
|
42
|
-
const output = `Return a JSON that follows the output schema provided. Never return multiple output schemas concatenated by a line break.\n<example>\n${JSON.stringify(example)}\n</example>`;
|
|
43
|
-
return `<output>\n${output}\n</output>`;
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/structured-output/index.ts"],"names":[],"mappings":";;;AA2BA,0CAQC;AAED,sDAaC;AAjDD,6BAAuB;AACvB,iDAAkD;AAClD,yCAA2C;AAC3C,iCAAmC;AACnC,iEAAiE;AACjE,iCAAmC;AACnC,2DAA2D;AAM3D,MAAM,kBAAkB,GAAG;IACzB,iBAAU;IACV,yCAAqB;IACrB,yBAAc;IACd,iBAAU;IACV,gCAAiB;IACjB,+CAAwB;CAChB,CAAA;AACG,QAAA,YAAY,GAAG,OAAC;KAC1B,MAAM,CAAC;IACN,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;CAC/C,CAAC;KACD,QAAQ,CAAC,qCAAqC,CAAC,CAAA;AAElD,SAAgB,eAAe,CAC7B,6BAAiD;IAEjD,OAAO,OAAC,CAAC,MAAM,CAAC;QACd,QAAQ,EAAE,OAAC,CAAC,KAAK,CACf,OAAC,CAAC,KAAK,CAAC,CAAC,GAAG,kBAAkB,EAAE,GAAG,6BAA6B,CAAC,CAAC,CACnE;KACF,CAAC,CAAA;AACJ,CAAC;AAED,SAAgB,qBAAqB;IACnC,MAAM,OAAO,GAAG;QACd,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,kCAAkC;iBACzC;aACF;SACF;KACF,CAAA;IACD,MAAM,MAAM,GAAG,yIAAyI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,cAAc,CAAA;IAC7L,OAAO,aAAa,MAAM,aAAa,CAAA;AACzC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { OutputMessageType, type RequestContactInfoMessage } from '@botonic/core';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
export type { RequestContactInfoMessage };
|
|
4
|
-
export declare const RequestContactInfoSchema: z.ZodObject<{
|
|
5
|
-
type: z.ZodLiteral<OutputMessageType.RequestContactInfo>;
|
|
6
|
-
content: z.ZodObject<{
|
|
7
|
-
text: z.ZodString;
|
|
8
|
-
}, z.core.$strip>;
|
|
9
|
-
}, z.core.$strip>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RequestContactInfoSchema = void 0;
|
|
4
|
-
const core_1 = require("@botonic/core");
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
exports.RequestContactInfoSchema = zod_1.z
|
|
7
|
-
.object({
|
|
8
|
-
type: zod_1.z.literal(core_1.OutputMessageType.RequestContactInfo),
|
|
9
|
-
content: zod_1.z.object({
|
|
10
|
-
text: zod_1.z.string().describe('The text of the message'),
|
|
11
|
-
}),
|
|
12
|
-
})
|
|
13
|
-
.describe('A message to request phone number from the user. Use it only when asked explicitly in the prompt.');
|
|
14
|
-
//# sourceMappingURL=request-contact-info.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request-contact-info.js","sourceRoot":"","sources":["../../../src/structured-output/request-contact-info.ts"],"names":[],"mappings":";;;AAAA,wCAGsB;AACtB,6BAAuB;AAIV,QAAA,wBAAwB,GAAG,OAAC;KACtC,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAiB,CAAC,kBAAkB,CAAC;IACrD,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;KACrD,CAAC;CACH,CAAC;KACD,QAAQ,CACP,mGAAmG,CACpG,CAAA"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { OutputMessageType, type TextWithButtonsMessage } from '@botonic/core';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
export type { TextWithButtonsMessage };
|
|
4
|
-
export declare const TextWithButtonsSchema: z.ZodObject<{
|
|
5
|
-
type: z.ZodLiteral<OutputMessageType.TextWithButtons>;
|
|
6
|
-
content: z.ZodObject<{
|
|
7
|
-
text: z.ZodString;
|
|
8
|
-
buttons: z.ZodArray<z.ZodObject<{
|
|
9
|
-
text: z.ZodString;
|
|
10
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
-
target: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodEnum<{
|
|
12
|
-
_blank: "_blank";
|
|
13
|
-
_self: "_self";
|
|
14
|
-
}>>>>;
|
|
15
|
-
}, z.core.$strip>>;
|
|
16
|
-
}, z.core.$strip>;
|
|
17
|
-
}, z.core.$strip>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TextWithButtonsSchema = void 0;
|
|
4
|
-
const core_1 = require("@botonic/core");
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
exports.TextWithButtonsSchema = zod_1.z
|
|
7
|
-
.object({
|
|
8
|
-
type: zod_1.z.literal(core_1.OutputMessageType.TextWithButtons),
|
|
9
|
-
content: zod_1.z.object({
|
|
10
|
-
text: zod_1.z.string(),
|
|
11
|
-
buttons: zod_1.z.array(zod_1.z.object({
|
|
12
|
-
text: zod_1.z.string(),
|
|
13
|
-
url: zod_1.z.string().nullable().optional(),
|
|
14
|
-
target: zod_1.z
|
|
15
|
-
.enum(['_blank', '_self'])
|
|
16
|
-
.default('_blank')
|
|
17
|
-
.nullable()
|
|
18
|
-
.optional()
|
|
19
|
-
.describe('The target of the button when it has an url. If not provided, it will default to _blank.'),
|
|
20
|
-
})),
|
|
21
|
-
}),
|
|
22
|
-
})
|
|
23
|
-
.describe('A text message with buttons to allow the user to use quick replies');
|
|
24
|
-
//# sourceMappingURL=text-with-buttons.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-with-buttons.js","sourceRoot":"","sources":["../../../src/structured-output/text-with-buttons.ts"],"names":[],"mappings":";;;AAAA,wCAA8E;AAC9E,6BAAuB;AAIV,QAAA,qBAAqB,GAAG,OAAC;KACnC,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAiB,CAAC,eAAe,CAAC;IAClD,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,OAAC,CAAC,KAAK,CACd,OAAC,CAAC,MAAM,CAAC;YACP,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;YAChB,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;YACrC,MAAM,EAAE,OAAC;iBACN,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;iBACzB,OAAO,CAAC,QAAQ,CAAC;iBACjB,QAAQ,EAAE;iBACV,QAAQ,EAAE;iBACV,QAAQ,CACP,0FAA0F,CAC3F;SACJ,CAAC,CACH;KACF,CAAC;CACH,CAAC;KACD,QAAQ,CACP,oEAAoE,CACrE,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { OutputMessageType, type TextMessage } from '@botonic/core';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
export type { TextMessage };
|
|
4
|
-
export declare const TextSchema: z.ZodObject<{
|
|
5
|
-
type: z.ZodLiteral<OutputMessageType.Text>;
|
|
6
|
-
content: z.ZodObject<{
|
|
7
|
-
text: z.ZodString;
|
|
8
|
-
}, z.core.$strip>;
|
|
9
|
-
}, z.core.$strip>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TextSchema = void 0;
|
|
4
|
-
const core_1 = require("@botonic/core");
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
exports.TextSchema = zod_1.z
|
|
7
|
-
.object({
|
|
8
|
-
type: zod_1.z.literal(core_1.OutputMessageType.Text),
|
|
9
|
-
content: zod_1.z.object({
|
|
10
|
-
text: zod_1.z.string(),
|
|
11
|
-
}),
|
|
12
|
-
})
|
|
13
|
-
.describe('A text message');
|
|
14
|
-
//# sourceMappingURL=text.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/structured-output/text.ts"],"names":[],"mappings":";;;AAAA,wCAAmE;AACnE,6BAAuB;AAIV,QAAA,UAAU,GAAG,OAAC;KACxB,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAiB,CAAC,IAAI,CAAC;IACvC,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;KACjB,CAAC;CACH,CAAC;KACD,QAAQ,CAAC,gBAAgB,CAAC,CAAA"}
|
package/lib/esm/tools/index.d.ts
DELETED
package/lib/esm/tools/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mandatoryTools = exports.RETRIEVE_KNOWLEDGE_TOOL_NAME = exports.createRetrieveKnowledge = void 0;
|
|
4
|
-
var retrieve_knowledge_1 = require("./retrieve-knowledge");
|
|
5
|
-
Object.defineProperty(exports, "createRetrieveKnowledge", { enumerable: true, get: function () { return retrieve_knowledge_1.createRetrieveKnowledge; } });
|
|
6
|
-
Object.defineProperty(exports, "RETRIEVE_KNOWLEDGE_TOOL_NAME", { enumerable: true, get: function () { return retrieve_knowledge_1.RETRIEVE_KNOWLEDGE_TOOL_NAME; } });
|
|
7
|
-
exports.mandatoryTools = [];
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":";;;AAEA,2DAG6B;AAF3B,6HAAA,uBAAuB,OAAA;AACvB,kIAAA,4BAA4B,OAAA;AAGjB,QAAA,cAAc,GAAW,EAAE,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import type { Context } from '../types';
|
|
3
|
-
export declare const RETRIEVE_KNOWLEDGE_TOOL_NAME = "retrieve_knowledge";
|
|
4
|
-
export declare const createRetrieveKnowledge: (sourceIds: string[]) => import("@openai/agents").FunctionTool<Context<import("@botonic/core").ResolvedPlugins, any>, z.ZodObject<{
|
|
5
|
-
query: z.ZodString;
|
|
6
|
-
}, z.core.$strip>, string>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createRetrieveKnowledge = exports.RETRIEVE_KNOWLEDGE_TOOL_NAME = void 0;
|
|
4
|
-
const agents_1 = require("@openai/agents");
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
const hubtype_api_client_1 = require("../services/hubtype-api-client");
|
|
7
|
-
exports.RETRIEVE_KNOWLEDGE_TOOL_NAME = 'retrieve_knowledge';
|
|
8
|
-
const createRetrieveKnowledge = (sourceIds) => (0, agents_1.tool)({
|
|
9
|
-
name: exports.RETRIEVE_KNOWLEDGE_TOOL_NAME,
|
|
10
|
-
description: 'Consult the knowledge base for information before answering. Use this tool to make sure the information you provide is faithful.',
|
|
11
|
-
parameters: zod_1.z.object({
|
|
12
|
-
query: zod_1.z.string().describe('The query to search the knowledge base for'),
|
|
13
|
-
}),
|
|
14
|
-
execute: async (input, runContext) => {
|
|
15
|
-
const context = runContext?.context;
|
|
16
|
-
const query = input.query;
|
|
17
|
-
if (!context) {
|
|
18
|
-
throw new Error('Context is required');
|
|
19
|
-
}
|
|
20
|
-
const client = new hubtype_api_client_1.HubtypeApiClient(context.authToken);
|
|
21
|
-
const chunks = await client.retrieveSimilarChunks(query, sourceIds);
|
|
22
|
-
const chunksIds = chunks.map(chunk => chunk.id);
|
|
23
|
-
const chunkTexts = chunks.map(chunk => chunk.text);
|
|
24
|
-
context.knowledgeUsed = {
|
|
25
|
-
query,
|
|
26
|
-
sourceIds,
|
|
27
|
-
chunksIds,
|
|
28
|
-
chunkTexts,
|
|
29
|
-
};
|
|
30
|
-
return chunkTexts;
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
exports.createRetrieveKnowledge = createRetrieveKnowledge;
|
|
34
|
-
//# sourceMappingURL=retrieve-knowledge.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retrieve-knowledge.js","sourceRoot":"","sources":["../../../src/tools/retrieve-knowledge.ts"],"names":[],"mappings":";;;AAAA,2CAAsD;AACtD,6BAAuB;AAEvB,uEAAiE;AAGpD,QAAA,4BAA4B,GAAG,oBAAoB,CAAA;AAEzD,MAAM,uBAAuB,GAAG,CAAC,SAAmB,EAAE,EAAE,CAC7D,IAAA,aAAI,EAAC;IACH,IAAI,EAAE,oCAA4B;IAClC,WAAW,EACT,kIAAkI;IACpI,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC;QACnB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;KACzE,CAAC;IACF,OAAO,EAAE,KAAK,EACZ,KAAwB,EACxB,UAAgC,EACb,EAAE;QACrB,MAAM,OAAO,GAAG,UAAU,EAAE,OAAO,CAAA;QACnC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;QACzB,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;QACxC,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,qCAAgB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QACtD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;QACnE,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAC/C,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAElD,OAAO,CAAC,aAAa,GAAG;YACtB,KAAK;YACL,SAAS;YACT,SAAS;YACT,UAAU;SACX,CAAA;QAED,OAAO,UAAU,CAAA;IACnB,CAAC;CACF,CAAC,CAAA;AA/BS,QAAA,uBAAuB,2BA+BhC"}
|
package/lib/esm/types.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { AgenticOutputMessage, AiAgentArgs, type BotContext, GuardrailRule, InferenceResponse, type ResolvedPlugins, RunResult } from '@botonic/core';
|
|
2
|
-
import type { Agent, AgentInputItem, AgentOutputType, RunContext as OpenAIRunContext, Tool as OpenAITool } from '@openai/agents';
|
|
3
|
-
import type { ZodType } from 'zod';
|
|
4
|
-
import type { OutputSchema } from './structured-output';
|
|
5
|
-
export interface Context<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
|
|
6
|
-
authToken: string;
|
|
7
|
-
knowledgeUsed: {
|
|
8
|
-
query: string;
|
|
9
|
-
sourceIds: string[];
|
|
10
|
-
chunksIds: string[];
|
|
11
|
-
chunkTexts: string[];
|
|
12
|
-
};
|
|
13
|
-
request: BotContext<TPlugins, TExtraData>;
|
|
14
|
-
}
|
|
15
|
-
export type RunContext<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> = OpenAIRunContext<Context<TPlugins, TExtraData>>;
|
|
16
|
-
export interface CustomTool<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
|
|
17
|
-
name: string;
|
|
18
|
-
description: string;
|
|
19
|
-
schema: ZodType;
|
|
20
|
-
func: (input?: any, runContext?: RunContext<TPlugins, TExtraData>) => Promise<any>;
|
|
21
|
-
}
|
|
22
|
-
export interface Chunk {
|
|
23
|
-
id: string;
|
|
24
|
-
text: string;
|
|
25
|
-
}
|
|
26
|
-
export type Tool<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> = OpenAITool<Context<TPlugins, TExtraData>>;
|
|
27
|
-
export type AIAgent<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> = Agent<Context<TPlugins, TExtraData>, AgentOutputType<typeof OutputSchema>>;
|
|
28
|
-
export interface MemoryOptions {
|
|
29
|
-
maxMessages: number;
|
|
30
|
-
includeToolCalls: boolean;
|
|
31
|
-
maxFullToolResults: number;
|
|
32
|
-
debugMode: boolean;
|
|
33
|
-
}
|
|
34
|
-
export interface PluginAiAgentOptions<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
|
|
35
|
-
authToken?: string;
|
|
36
|
-
customTools?: CustomTool<TPlugins, TExtraData>[];
|
|
37
|
-
maxRetries?: number;
|
|
38
|
-
timeout?: number;
|
|
39
|
-
memory?: Partial<MemoryOptions>;
|
|
40
|
-
/** Enable debug logging for AI agent configuration and execution details. */
|
|
41
|
-
enableDebug?: boolean;
|
|
42
|
-
/** Key for the local storage to to get messages in local development mode */
|
|
43
|
-
localStorageKey?: string;
|
|
44
|
-
}
|
|
45
|
-
export interface ResultRawResponse {
|
|
46
|
-
usage: {
|
|
47
|
-
inputTokens: number;
|
|
48
|
-
outputTokens: number;
|
|
49
|
-
};
|
|
50
|
-
providerData?: Record<string, unknown>;
|
|
51
|
-
}
|
|
52
|
-
export type AgenticInputMessage = AgentInputItem;
|
|
53
|
-
export { AgenticOutputMessage, AiAgentArgs, GuardrailRule, InferenceResponse, RunResult, };
|
package/lib/esm/types.js
DELETED
package/lib/esm/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
OutputMessageType,
|
|
3
|
-
type RequestContactInfoMessage,
|
|
4
|
-
} from '@botonic/core'
|
|
5
|
-
import { z } from 'zod'
|
|
6
|
-
|
|
7
|
-
export type { RequestContactInfoMessage }
|
|
8
|
-
|
|
9
|
-
export const RequestContactInfoSchema = z
|
|
10
|
-
.object({
|
|
11
|
-
type: z.literal(OutputMessageType.RequestContactInfo),
|
|
12
|
-
content: z.object({
|
|
13
|
-
text: z.string().describe('The text of the message'),
|
|
14
|
-
}),
|
|
15
|
-
})
|
|
16
|
-
.describe(
|
|
17
|
-
'A message to request phone number from the user. Use it only when asked explicitly in the prompt.'
|
|
18
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|