@botonic/plugin-ai-agents 0.43.0-beta.0 → 0.44.0-alpha.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/cjs/agent-builder.d.ts +14 -3
- package/lib/cjs/agent-builder.js +43 -13
- package/lib/cjs/agent-builder.js.map +1 -1
- package/lib/cjs/constants.d.ts +3 -0
- package/lib/cjs/constants.js +6 -1
- package/lib/cjs/constants.js.map +1 -1
- package/lib/cjs/guardrails/input.js +4 -6
- package/lib/cjs/guardrails/input.js.map +1 -1
- package/lib/cjs/hubtype-api-client.js +97 -106
- package/lib/cjs/hubtype-api-client.js.map +1 -1
- package/lib/cjs/index.js +63 -62
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/openai.js +19 -5
- package/lib/cjs/openai.js.map +1 -1
- package/lib/cjs/runner.js +39 -38
- package/lib/cjs/runner.js.map +1 -1
- package/lib/cjs/tools/retrieve-knowledge.d.ts +8 -1
- package/lib/cjs/tools/retrieve-knowledge.js +5 -5
- package/lib/cjs/tools/retrieve-knowledge.js.map +1 -1
- package/lib/cjs/types.d.ts +2 -3
- package/lib/esm/agent-builder.d.ts +14 -3
- package/lib/esm/agent-builder.js +57 -23
- package/lib/esm/agent-builder.js.map +1 -1
- package/lib/esm/constants.d.ts +3 -0
- package/lib/esm/constants.js +15 -7
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/guardrails/index.js +4 -1
- package/lib/esm/guardrails/index.js.map +1 -1
- package/lib/esm/guardrails/input.js +11 -9
- package/lib/esm/guardrails/input.js.map +1 -1
- package/lib/esm/hubtype-api-client.js +105 -110
- package/lib/esm/hubtype-api-client.js.map +1 -1
- package/lib/esm/index.js +76 -72
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/openai.js +33 -15
- package/lib/esm/openai.js.map +1 -1
- package/lib/esm/runner.js +47 -42
- package/lib/esm/runner.js.map +1 -1
- package/lib/esm/structured-output/carousel.js +15 -12
- package/lib/esm/structured-output/carousel.js.map +1 -1
- package/lib/esm/structured-output/exit.js +7 -3
- package/lib/esm/structured-output/exit.js.map +1 -1
- package/lib/esm/structured-output/index.js +10 -7
- package/lib/esm/structured-output/index.js.map +1 -1
- package/lib/esm/structured-output/text-with-buttons.js +12 -8
- package/lib/esm/structured-output/text-with-buttons.js.map +1 -1
- package/lib/esm/structured-output/text.js +8 -5
- package/lib/esm/structured-output/text.js.map +1 -1
- package/lib/esm/tools/index.js +6 -2
- package/lib/esm/tools/index.js.map +1 -1
- package/lib/esm/tools/retrieve-knowledge.d.ts +8 -1
- package/lib/esm/tools/retrieve-knowledge.js +15 -12
- package/lib/esm/tools/retrieve-knowledge.js.map +1 -1
- package/lib/esm/types.d.ts +2 -3
- package/lib/esm/types.js +2 -1
- package/package.json +5 -5
- package/src/agent-builder.ts +79 -26
- package/src/constants.ts +7 -0
- package/src/guardrails/input.ts +1 -1
- package/src/hubtype-api-client.ts +21 -14
- package/src/index.ts +10 -10
- package/src/openai.ts +19 -3
- package/src/runner.ts +15 -6
- package/src/tools/retrieve-knowledge.ts +3 -2
- package/src/types.ts +4 -3
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
import { ResolvedPlugins } from '@botonic/core';
|
|
2
|
-
import { AIAgent,
|
|
1
|
+
import { CampaignV2, ContactInfo, ResolvedPlugins } from '@botonic/core';
|
|
2
|
+
import { AIAgent, GuardrailRule, Tool } from './types';
|
|
3
|
+
interface AIAgentBuilderOptions<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
|
|
4
|
+
name: string;
|
|
5
|
+
instructions: string;
|
|
6
|
+
tools: Tool<TPlugins, TExtraData>[];
|
|
7
|
+
campaignContext?: CampaignV2;
|
|
8
|
+
contactInfo: ContactInfo[];
|
|
9
|
+
inputGuardrailRules: GuardrailRule[];
|
|
10
|
+
sourceIds: string[];
|
|
11
|
+
}
|
|
3
12
|
export declare class AIAgentBuilder<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
|
|
4
13
|
private name;
|
|
5
14
|
private instructions;
|
|
6
15
|
private tools;
|
|
7
16
|
private inputGuardrails;
|
|
8
|
-
constructor(
|
|
17
|
+
constructor(options: AIAgentBuilderOptions<TPlugins, TExtraData>);
|
|
9
18
|
build(): AIAgent<TPlugins, TExtraData>;
|
|
10
19
|
private addExtraInstructions;
|
|
11
20
|
private getContactInfoInstructions;
|
|
12
21
|
private getMetadataInstructions;
|
|
22
|
+
private getCampaignInstructions;
|
|
13
23
|
private getOutputInstructions;
|
|
14
24
|
private addHubtypeTools;
|
|
15
25
|
}
|
|
26
|
+
export {};
|
package/lib/cjs/agent-builder.js
CHANGED
|
@@ -2,27 +2,43 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AIAgentBuilder = void 0;
|
|
4
4
|
const agents_1 = require("@openai/agents");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
5
6
|
const guardrails_1 = require("./guardrails");
|
|
6
7
|
const structured_output_1 = require("./structured-output");
|
|
7
8
|
const tools_1 = require("./tools");
|
|
8
9
|
class AIAgentBuilder {
|
|
9
|
-
constructor(
|
|
10
|
-
this.name = name;
|
|
11
|
-
this.instructions = this.addExtraInstructions(instructions, contactInfo);
|
|
12
|
-
this.tools = this.addHubtypeTools(tools, sourceIds);
|
|
10
|
+
constructor(options) {
|
|
11
|
+
this.name = options.name;
|
|
12
|
+
this.instructions = this.addExtraInstructions(options.instructions, options.contactInfo, options.campaignContext);
|
|
13
|
+
this.tools = this.addHubtypeTools(options.tools, options.sourceIds);
|
|
13
14
|
this.inputGuardrails = [];
|
|
14
|
-
if (inputGuardrailRules.length > 0) {
|
|
15
|
-
const inputGuardrail = (0, guardrails_1.createInputGuardrail)(inputGuardrailRules);
|
|
15
|
+
if (options.inputGuardrailRules.length > 0) {
|
|
16
|
+
const inputGuardrail = (0, guardrails_1.createInputGuardrail)(options.inputGuardrailRules);
|
|
16
17
|
this.inputGuardrails.push(inputGuardrail);
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
build() {
|
|
20
21
|
const modelSettings = {};
|
|
21
|
-
if (
|
|
22
|
+
if (constants_1.OPENAI_PROVIDER === 'openai') {
|
|
23
|
+
modelSettings.reasoning = { effort: 'none' };
|
|
24
|
+
modelSettings.text = { verbosity: 'medium' };
|
|
25
|
+
}
|
|
26
|
+
if (this.tools.includes(tools_1.retrieveKnowledge) && constants_1.OPENAI_PROVIDER === 'azure') {
|
|
22
27
|
modelSettings.toolChoice = tools_1.retrieveKnowledge.name;
|
|
23
28
|
}
|
|
29
|
+
// When using standard OpenAI API, we need to specify the model
|
|
30
|
+
// Azure OpenAI uses deployment name instead
|
|
31
|
+
const model = constants_1.OPENAI_PROVIDER === 'openai' ? constants_1.OPENAI_MODEL : undefined;
|
|
32
|
+
// TODO: Improve type safety - replace AgentOutputType<any> with AgentOutputType<typeof OutputSchema>
|
|
33
|
+
// Currently using explicit type parameters to avoid type inference issues where Agent constructor
|
|
34
|
+
// infers ZodObject instead of AgentOutputType<typeof OutputSchema>. The explicit type parameters
|
|
35
|
+
// ensure compatibility with AIAgent type definition. Future improvements:
|
|
36
|
+
// 1. Update @openai/agents package to properly infer AgentOutputType from outputType parameter
|
|
37
|
+
// 2. Replace AgentOutputType<any> with AgentOutputType<typeof OutputSchema> once type system allows
|
|
38
|
+
// 3. Consider updating AIAgent type definition if @openai/agents types change significantly
|
|
24
39
|
return new agents_1.Agent({
|
|
25
40
|
name: this.name,
|
|
41
|
+
model,
|
|
26
42
|
instructions: this.instructions,
|
|
27
43
|
tools: this.tools,
|
|
28
44
|
outputType: structured_output_1.OutputSchema,
|
|
@@ -31,23 +47,37 @@ class AIAgentBuilder {
|
|
|
31
47
|
modelSettings,
|
|
32
48
|
});
|
|
33
49
|
}
|
|
34
|
-
addExtraInstructions(initialInstructions, contactInfo) {
|
|
35
|
-
const instructions = `<instructions>\n${initialInstructions}\n</instructions>`;
|
|
50
|
+
addExtraInstructions(initialInstructions, contactInfo, campaignContext) {
|
|
51
|
+
const instructions = `<instructions>\n${initialInstructions.trim()}\n</instructions>`;
|
|
36
52
|
const metadataInstructions = this.getMetadataInstructions();
|
|
37
53
|
const contactInfoInstructions = this.getContactInfoInstructions(contactInfo);
|
|
54
|
+
const campaignInstructions = this.getCampaignInstructions(campaignContext);
|
|
38
55
|
const outputInstructions = this.getOutputInstructions();
|
|
39
|
-
return `${instructions}\n\n${metadataInstructions}\n\n${contactInfoInstructions}\n\n${outputInstructions}`;
|
|
56
|
+
return `${instructions}\n\n${metadataInstructions}\n\n${contactInfoInstructions}\n\n${campaignInstructions}\n\n${outputInstructions}`;
|
|
40
57
|
}
|
|
41
58
|
getContactInfoInstructions(contactInfo) {
|
|
42
|
-
const structuredContactInfo =
|
|
43
|
-
.map(
|
|
59
|
+
const structuredContactInfo = contactInfo
|
|
60
|
+
.map(info => ` <contact_info>
|
|
61
|
+
<name>${info.name}</name>
|
|
62
|
+
<value>${info.value}</value>
|
|
63
|
+
<type>${info.type}</type>
|
|
64
|
+
${info.description
|
|
65
|
+
? `<description>${info.description}</description>`
|
|
66
|
+
: ''}
|
|
67
|
+
</contact_info>`)
|
|
44
68
|
.join('\n');
|
|
45
|
-
return `<
|
|
69
|
+
return `<contact_info_fields>\n${structuredContactInfo}</contact_info_fields>`;
|
|
46
70
|
}
|
|
47
71
|
getMetadataInstructions() {
|
|
48
72
|
const metadata = `Current Date: ${new Date().toISOString()}`;
|
|
49
73
|
return `<metadata>\n${metadata}\n</metadata>`;
|
|
50
74
|
}
|
|
75
|
+
getCampaignInstructions(campaignContext) {
|
|
76
|
+
if (!campaignContext || !campaignContext.agent_context) {
|
|
77
|
+
return '';
|
|
78
|
+
}
|
|
79
|
+
return `<campaign_context>\n${campaignContext.agent_context}\n</campaign_context>`;
|
|
80
|
+
}
|
|
51
81
|
getOutputInstructions() {
|
|
52
82
|
const example = {
|
|
53
83
|
messages: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-builder.js","sourceRoot":"","sources":["../../src/agent-builder.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"agent-builder.js","sourceRoot":"","sources":["../../src/agent-builder.ts"],"names":[],"mappings":";;;AACA,2CAKuB;AAEvB,2CAA2D;AAC3D,6CAAmD;AACnD,2DAAkD;AAClD,mCAA2D;AAgB3D,MAAa,cAAc;IASzB,YAAY,OAAoD;QAC9D,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;QACxB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,oBAAoB,CAC3C,OAAO,CAAC,YAAY,EACpB,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,eAAe,CACxB,CAAA;QACD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;QACnE,IAAI,CAAC,eAAe,GAAG,EAAE,CAAA;QACzB,IAAI,OAAO,CAAC,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3C,MAAM,cAAc,GAAG,IAAA,iCAAoB,EAAC,OAAO,CAAC,mBAAmB,CAAC,CAAA;YACxE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;QAC3C,CAAC;IACH,CAAC;IAED,KAAK;QACH,MAAM,aAAa,GAAkB,EAAmB,CAAA;QACxD,IAAI,2BAAe,KAAK,QAAQ,EAAE,CAAC;YACjC,aAAa,CAAC,SAAS,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;YAC5C,aAAa,CAAC,IAAI,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAA;QAC9C,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,yBAAiB,CAAC,IAAI,2BAAe,KAAK,OAAO,EAAE,CAAC;YAC1E,aAAa,CAAC,UAAU,GAAG,yBAAiB,CAAC,IAAI,CAAA;QACnD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ined;
|
|
3
|
+
export declare const OPENAI_MODEL: string;
|
|
4
|
+
export declare const OPENAI_PROVIDER: 'openai' | 'azure';
|
|
2
5
|
export declare const AZURE_OPENAI_API_KEY: string | undefined;
|
|
3
6
|
export declare const AZURE_OPENAI_API_BASE: string | undefined;
|
|
4
7
|
export declare const AZURE_OPENAI_API_DEPLOYMENT_NAME: string;
|
package/lib/cjs/constants.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MAX_MEMORY_LENGTH = exports.isProd = exports.AZURE_OPENAI_API_VERSION = exports.AZURE_OPENAI_API_DEPLOYMENT_NAME = exports.AZURE_OPENAI_API_BASE = exports.AZURE_OPENAI_API_KEY = exports.HUBTYPE_API_URL = void 0;
|
|
3
|
+
exports.MAX_MEMORY_LENGTH = exports.isProd = exports.AZURE_OPENAI_API_VERSION = exports.AZURE_OPENAI_API_DEPLOYMENT_NAME = exports.AZURE_OPENAI_API_BASE = exports.AZURE_OPENAI_API_KEY = exports.OPENAI_PROVIDER = exports.OPENAI_MODEL = exports.OPENAI_API_KEY = exports.HUBTYPE_API_URL = void 0;
|
|
4
4
|
exports.HUBTYPE_API_URL = process.env.HUBTYPE_API_URL || 'https://api.hubtype.com';
|
|
5
|
+
// OpenAI Provider Configuration
|
|
6
|
+
exports.OPENAI_API_KEY = process.env.OPENAI_API_KEY; // pragma: allowlist secret
|
|
7
|
+
exports.OPENAI_MODEL = process.env.OPENAI_MODEL || 'gpt-4.1-mini';
|
|
8
|
+
exports.OPENAI_PROVIDER = process.env.OPENAI_PROVIDER || 'azure';
|
|
9
|
+
// Azure OpenAI Configuration
|
|
5
10
|
exports.AZURE_OPENAI_API_KEY = process.env.AZURE_OPENAI_API_KEY; // pragma: allowlist secret
|
|
6
11
|
exports.AZURE_OPENAI_API_BASE = process.env.AZURE_OPENAI_API_BASE;
|
|
7
12
|
exports.AZURE_OPENAI_API_DEPLOYMENT_NAME = process.env.AZURE_OPENAI_API_DEPLOYMENT_NAME || 'gpt-41-mini_p1';
|
package/lib/cjs/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAC1B,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAC1B,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,yBAAyB,CAAA;AAE1D,gCAAgC;AACnB,QAAA,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAA,CAAC,2BAA2B;AACvE,QAAA,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,cAAc,CAAA;AACzD,QAAA,eAAe,GACzB,OAAO,CAAC,GAAG,CAAC,eAAsC,IAAI,OAAO,CAAA;AAEhE,6BAA6B;AAChB,QAAA,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAA,CAAC,2BAA2B;AACnF,QAAA,qBAAqB,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAA;AACzD,QAAA,gCAAgC,GAC3C,OAAO,CAAC,GAAG,CAAC,gCAAgC,IAAI,gBAAgB,CAAA;AACrD,QAAA,wBAAwB,GACnC,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,oBAAoB,CAAA;AAEjD,QAAA,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAA;AAE9C,QAAA,iBAAiB,GAAG,EAAE,CAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createInputGuardrail =
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
3
|
+
exports.createInputGuardrail = createInputGuardrail;
|
|
5
4
|
const agents_1 = require("@openai/agents");
|
|
6
5
|
const zod_1 = require("zod");
|
|
7
6
|
function createInputGuardrail(rules) {
|
|
@@ -13,9 +12,9 @@ function createInputGuardrail(rules) {
|
|
|
13
12
|
});
|
|
14
13
|
return {
|
|
15
14
|
name: 'InputGuardrail',
|
|
16
|
-
execute: ({ input, context }) =>
|
|
15
|
+
execute: async ({ input, context }) => {
|
|
17
16
|
const lastMessage = input[input.length - 1];
|
|
18
|
-
const result =
|
|
17
|
+
const result = await (0, agents_1.run)(agent, [lastMessage], { context });
|
|
19
18
|
const finalOutput = result.finalOutput;
|
|
20
19
|
if (finalOutput === undefined) {
|
|
21
20
|
throw new Error('Guardrail agent failed to produce output');
|
|
@@ -26,8 +25,7 @@ function createInputGuardrail(rules) {
|
|
|
26
25
|
outputInfo: triggeredGuardrails,
|
|
27
26
|
tripwireTriggered: triggered,
|
|
28
27
|
};
|
|
29
|
-
}
|
|
28
|
+
},
|
|
30
29
|
};
|
|
31
30
|
}
|
|
32
|
-
exports.createInputGuardrail = createInputGuardrail;
|
|
33
31
|
//# sourceMappingURL=input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/guardrails/input.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/guardrails/input.ts"],"names":[],"mappings":";;AAKA,oDAiCC;AAtCD,2CAA4E;AAC5E,6BAAuB;AAIvB,SAAgB,oBAAoB,CAAC,KAAsB;IACzD,MAAM,UAAU,GAAG,OAAC,CAAC,MAAM,CACzB,MAAM,CAAC,WAAW,CAChB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAC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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return chunks;
|
|
29
|
-
});
|
|
11
|
+
async retrieveSimilarChunks(query, sourceIds) {
|
|
12
|
+
const url = `${constants_1.HUBTYPE_API_URL}/external/v1/ai/knowledge_base/similar_chunks/`;
|
|
13
|
+
const headers = {
|
|
14
|
+
'Content-Type': 'application/json',
|
|
15
|
+
Authorization: `Bearer ${this.authToken}`,
|
|
16
|
+
};
|
|
17
|
+
const params = {
|
|
18
|
+
query,
|
|
19
|
+
source_ids: sourceIds,
|
|
20
|
+
num_chunks: 5,
|
|
21
|
+
};
|
|
22
|
+
const response = await axios_1.default.post(url, params, { headers });
|
|
23
|
+
const chunks = response.data.chunks.map((chunk) => ({
|
|
24
|
+
id: chunk.id,
|
|
25
|
+
text: chunk.text,
|
|
26
|
+
}));
|
|
27
|
+
return chunks;
|
|
30
28
|
}
|
|
31
|
-
getLocalMessages(maxMemoryLength) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return filteredMessages.slice(-maxMemoryLength);
|
|
46
|
-
});
|
|
29
|
+
async getLocalMessages(maxMemoryLength) {
|
|
30
|
+
const localBotonicState = typeof globalThis !== 'undefined' && globalThis.localStorage
|
|
31
|
+
? globalThis.localStorage.getItem('botonicState')
|
|
32
|
+
: null;
|
|
33
|
+
const botonicState = JSON.parse(localBotonicState || '{}');
|
|
34
|
+
const messages = botonicState.messages;
|
|
35
|
+
const filteredMessages = messages
|
|
36
|
+
.filter(message => message.data.text)
|
|
37
|
+
.map(message => ({
|
|
38
|
+
role: message.sentBy === 'user' ? 'user' : 'assistant',
|
|
39
|
+
content: message.data.text,
|
|
40
|
+
}))
|
|
41
|
+
.map(message => this.formatMessage(message));
|
|
42
|
+
return filteredMessages.slice(-maxMemoryLength);
|
|
47
43
|
}
|
|
48
|
-
getMessages(request, maxMemoryLength) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
});
|
|
44
|
+
async getMessages(request, maxMemoryLength) {
|
|
45
|
+
const url = `${constants_1.HUBTYPE_API_URL}/external/v1/ai/agent/message_history/`;
|
|
46
|
+
const headers = {
|
|
47
|
+
'Content-Type': 'application/json',
|
|
48
|
+
Authorization: `Bearer ${this.authToken}`,
|
|
49
|
+
};
|
|
50
|
+
const params = {
|
|
51
|
+
last_message_id: request.input.message_id,
|
|
52
|
+
num_messages: maxMemoryLength,
|
|
53
|
+
};
|
|
54
|
+
try {
|
|
55
|
+
const response = await axios_1.default.get(url, {
|
|
56
|
+
headers,
|
|
57
|
+
params,
|
|
58
|
+
});
|
|
59
|
+
const messages = response.data.messages;
|
|
60
|
+
return messages.map(message => this.formatMessage(message));
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
console.error(error);
|
|
64
|
+
throw new Error('Failed to get messages from Hubtype');
|
|
65
|
+
}
|
|
72
66
|
}
|
|
73
|
-
getMessagesV2(request, options = {}) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
67
|
+
async getMessagesV2(request, options = {}) {
|
|
68
|
+
const url = `${constants_1.HUBTYPE_API_URL}/external/v2/ai/agent/message_history/`;
|
|
69
|
+
const headers = {
|
|
70
|
+
'Content-Type': 'application/json',
|
|
71
|
+
Authorization: `Bearer ${this.authToken}`,
|
|
72
|
+
};
|
|
73
|
+
const params = {
|
|
74
|
+
last_message_id: request.input.message_id,
|
|
75
|
+
...(options.maxMessages !== undefined && {
|
|
76
|
+
max_messages: options.maxMessages,
|
|
77
|
+
}),
|
|
78
|
+
...(options.includeToolCalls !== undefined && {
|
|
79
|
+
include_tool_calls: options.includeToolCalls,
|
|
80
|
+
}),
|
|
81
|
+
...(options.maxFullToolResults !== undefined && {
|
|
82
|
+
max_full_tool_results: options.maxFullToolResults,
|
|
83
|
+
}),
|
|
84
|
+
...(options.debugMode !== undefined && {
|
|
85
|
+
debug_mode: options.debugMode,
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
88
|
+
try {
|
|
89
|
+
const response = await axios_1.default.get(url, {
|
|
90
|
+
headers,
|
|
91
|
+
params,
|
|
92
|
+
});
|
|
93
|
+
const { messages, conversation_id, truncated } = response.data;
|
|
94
|
+
const formattedMessages = messages
|
|
95
|
+
.map(message => this.formatMessageV2(message))
|
|
96
|
+
.filter((message) => message !== null);
|
|
97
|
+
return {
|
|
98
|
+
messages: formattedMessages,
|
|
99
|
+
conversationId: conversation_id,
|
|
100
|
+
truncated,
|
|
82
101
|
};
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
if (options.maxFullToolResults !== undefined) {
|
|
90
|
-
params.max_full_tool_results = options.maxFullToolResults;
|
|
91
|
-
}
|
|
92
|
-
if (options.debugMode !== undefined) {
|
|
93
|
-
params.debug_mode = options.debugMode;
|
|
94
|
-
}
|
|
95
|
-
try {
|
|
96
|
-
const response = yield axios_1.default.get(url, {
|
|
97
|
-
headers,
|
|
98
|
-
params,
|
|
99
|
-
});
|
|
100
|
-
const { messages, conversation_id, truncated } = response.data;
|
|
101
|
-
const formattedMessages = messages
|
|
102
|
-
.map(message => this.formatMessageV2(message))
|
|
103
|
-
.filter((message) => message !== null);
|
|
104
|
-
return {
|
|
105
|
-
messages: formattedMessages,
|
|
106
|
-
conversationId: conversation_id,
|
|
107
|
-
truncated,
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
catch (error) {
|
|
111
|
-
console.error(error);
|
|
112
|
-
throw new Error('Failed to get messages from Hubtype V2 API');
|
|
113
|
-
}
|
|
114
|
-
});
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
console.error(error);
|
|
105
|
+
throw new Error('Failed to get messages from Hubtype V2 API');
|
|
106
|
+
}
|
|
115
107
|
}
|
|
116
108
|
formatMessageV2(message) {
|
|
117
|
-
var _a, _b, _c, _d, _e;
|
|
118
109
|
switch (message.role) {
|
|
119
110
|
case 'user':
|
|
120
111
|
return {
|
|
121
112
|
role: 'user',
|
|
122
|
-
content:
|
|
113
|
+
content: message.content ?? '',
|
|
123
114
|
};
|
|
124
115
|
case 'assistant': {
|
|
125
116
|
const assistantMessage = message;
|
|
@@ -130,7 +121,7 @@ class HubtypeApiClient {
|
|
|
130
121
|
assistantMessage.tool_calls.length > 0) {
|
|
131
122
|
return {
|
|
132
123
|
role: 'assistant',
|
|
133
|
-
content:
|
|
124
|
+
content: assistantMessage.content ?? '',
|
|
134
125
|
tool_calls: assistantMessage.tool_calls.map(tc => ({
|
|
135
126
|
id: tc.id,
|
|
136
127
|
type: tc.type,
|
|
@@ -147,7 +138,7 @@ class HubtypeApiClient {
|
|
|
147
138
|
content: [
|
|
148
139
|
{
|
|
149
140
|
type: 'output_text',
|
|
150
|
-
text:
|
|
141
|
+
text: assistantMessage.content ?? '',
|
|
151
142
|
},
|
|
152
143
|
],
|
|
153
144
|
status: 'completed',
|
|
@@ -161,13 +152,13 @@ class HubtypeApiClient {
|
|
|
161
152
|
return {
|
|
162
153
|
role: 'tool',
|
|
163
154
|
tool_call_id: toolMessage.tool_call_id,
|
|
164
|
-
content:
|
|
155
|
+
content: toolMessage.content ?? '',
|
|
165
156
|
};
|
|
166
157
|
}
|
|
167
158
|
case 'system':
|
|
168
159
|
return {
|
|
169
160
|
role: 'system',
|
|
170
|
-
content:
|
|
161
|
+
content: message.content ?? '',
|
|
171
162
|
};
|
|
172
163
|
default:
|
|
173
164
|
throw new Error(`Invalid message role: ${message.role}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hubtype-api-client.js","sourceRoot":"","sources":["../../src/hubtype-api-client.ts"],"names":[],"mappings":";;;;AAEA,0DAAyB;AAEzB,2CAA6C;
|
|
1
|
+
{"version":3,"file":"hubtype-api-client.js","sourceRoot":"","sources":["../../src/hubtype-api-client.ts"],"names":[],"mappings":";;;;AAEA,0DAAyB;AAEzB,2CAA6C;AAgF7C,MAAa,gBAAgB;IAG3B,YAAY,SAAiB;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;IAED,KAAK,CAAC,qBAAqB,CACzB,KAAa,EACb,SAAmB;QAEnB,MAAM,GAAG,GAAG,GAAG,2BAAe,gDAAgD,CAAA;QAC9E,MAAM,OAAO,GAAG;YACd,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,IAAI,CAAC,SAAS,EAAE;SAC1C,CAAA;QACD,MAAM,MAAM,GAAG;YACb,KAAK;YACL,UAAU,EAAE,SAAS;YACrB,UAAU,EAAE,CAAC;SACd,CAAA;QACD,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;QAC3D,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAY,EAAE,EAAE,CAAC,CAAC;YACzD,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,IAAI,EAAE,KAAK,CAAC,IAAI;SACjB,CAAC,CAAC,CAAA;QACH,OAAO,MAAM,CAAA;IACf,CAAC;IAED,KAAK,CAAC,gBAAgB,CACpB,eAAuB;QAEvB,MAAM,iB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