@botonic/plugin-ai-agents 0.43.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.js +0 -1
- package/lib/cjs/agent-builder.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 +94 -97
- package/lib/cjs/hubtype-api-client.js.map +1 -1
- package/lib/cjs/index.js +63 -70
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/openai.js +3 -4
- package/lib/cjs/openai.js.map +1 -1
- package/lib/cjs/runner.js +39 -41
- package/lib/cjs/runner.js.map +1 -1
- package/lib/cjs/tools/retrieve-knowledge.js +4 -5
- package/lib/cjs/tools/retrieve-knowledge.js.map +1 -1
- package/lib/esm/agent-builder.js +19 -16
- package/lib/esm/agent-builder.js.map +1 -1
- package/lib/esm/constants.js +13 -10
- 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 +102 -101
- package/lib/esm/hubtype-api-client.js.map +1 -1
- package/lib/esm/index.js +76 -80
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/openai.js +24 -20
- package/lib/esm/openai.js.map +1 -1
- package/lib/esm/runner.js +47 -45
- 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.js +14 -12
- package/lib/esm/tools/retrieve-knowledge.js.map +1 -1
- package/lib/esm/types.js +2 -1
- package/package.json +5 -5
- package/src/agent-builder.ts +0 -1
- package/src/index.ts +1 -2
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.retrieveKnowledge = void 0;
|
|
4
|
+
const agents_1 = require("@openai/agents");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const hubtype_api_client_1 = require("../hubtype-api-client");
|
|
7
|
+
exports.retrieveKnowledge = (0, agents_1.tool)({
|
|
6
8
|
name: 'retrieve_knowledge',
|
|
7
9
|
description: 'Consult the knowledge base for information before answering. Use this tool to make sure the information you provide is faithful.',
|
|
8
|
-
parameters: z.object({
|
|
9
|
-
query: z.string().describe('The query to search the knowledge base for'),
|
|
10
|
+
parameters: zod_1.z.object({
|
|
11
|
+
query: zod_1.z.string().describe('The query to search the knowledge base for'),
|
|
10
12
|
}),
|
|
11
|
-
execute: (input, runContext) =>
|
|
12
|
-
const context = runContext
|
|
13
|
+
execute: async (input, runContext) => {
|
|
14
|
+
const context = runContext?.context;
|
|
13
15
|
const query = input.query;
|
|
14
16
|
if (!context) {
|
|
15
17
|
throw new Error('Context is required');
|
|
16
18
|
}
|
|
17
19
|
const sourceIds = context.sourceIds;
|
|
18
|
-
const client = new HubtypeApiClient(context.authToken);
|
|
19
|
-
const chunks =
|
|
20
|
+
const client = new hubtype_api_client_1.HubtypeApiClient(context.authToken);
|
|
21
|
+
const chunks = await client.retrieveSimilarChunks(query, sourceIds);
|
|
20
22
|
const chunkTexts = chunks.map(chunk => chunk.text);
|
|
21
23
|
context.knowledgeUsed = {
|
|
22
24
|
query,
|
|
@@ -25,6 +27,6 @@ export const retrieveKnowledge = tool({
|
|
|
25
27
|
chunkTexts,
|
|
26
28
|
};
|
|
27
29
|
return chunkTexts;
|
|
28
|
-
}
|
|
30
|
+
},
|
|
29
31
|
});
|
|
30
32
|
//# sourceMappingURL=retrieve-knowledge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retrieve-knowledge.js","sourceRoot":"","sources":["../../../src/tools/retrieve-knowledge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"retrieve-knowledge.js","sourceRoot":"","sources":["../../../src/tools/retrieve-knowledge.ts"],"names":[],"mappings":";;;AAAA,2CAAiD;AACjD,6BAAuB;AAEvB,8DAAwD;AAG3C,QAAA,iBAAiB,GAAG,IAAA,aAAI,EAAC;IACpC,IAAI,EAAE,oBAAoB;IAC1B,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,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;QACnC,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,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,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;YACxC,UAAU;SACX,CAAA;QAED,OAAO,UAAU,CAAA;IACnB,CAAC;CACF,CAAC,CAAA"}
|
package/lib/esm/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botonic/plugin-ai-agents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.0-alpha.0",
|
|
4
4
|
"main": "./lib/cjs/index.js",
|
|
5
5
|
"module": "./lib/esm/index.js",
|
|
6
6
|
"description": "Use AI Agents to generate your contents",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"lint_core": "../../node_modules/.bin/eslint_d --cache --quiet 'src/**/*.ts*'"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@botonic/core": "^0.
|
|
17
|
-
"@openai/agents": "^0.
|
|
16
|
+
"@botonic/core": "^0.44.0-alpha.0",
|
|
17
|
+
"@openai/agents": "^0.3.9",
|
|
18
18
|
"axios": "^1.13.2",
|
|
19
|
-
"openai": "^
|
|
19
|
+
"openai": "^6.0.0",
|
|
20
20
|
"uuid": "^10.0.0",
|
|
21
21
|
"zod": "3.25.76"
|
|
22
22
|
},
|
|
@@ -45,4 +45,4 @@
|
|
|
45
45
|
"javascript"
|
|
46
46
|
],
|
|
47
47
|
"author": ""
|
|
48
|
-
}
|
|
48
|
+
}
|
package/src/agent-builder.ts
CHANGED
|
@@ -52,7 +52,6 @@ export class AIAgentBuilder<
|
|
|
52
52
|
build(): AIAgent<TPlugins, TExtraData> {
|
|
53
53
|
const modelSettings: ModelSettings = {} as ModelSettings
|
|
54
54
|
if (OPENAI_PROVIDER === 'openai') {
|
|
55
|
-
// @ts-expect-error - reasoning.effort is valid but we need to update openai and typescript dependencies
|
|
56
55
|
modelSettings.reasoning = { effort: 'none' }
|
|
57
56
|
modelSettings.text = { verbosity: 'medium' }
|
|
58
57
|
}
|
package/src/index.ts
CHANGED
|
@@ -20,8 +20,7 @@ import {
|
|
|
20
20
|
export default class BotonicPluginAiAgents<
|
|
21
21
|
TPlugins extends ResolvedPlugins = ResolvedPlugins,
|
|
22
22
|
TExtraData = any,
|
|
23
|
-
> implements Plugin
|
|
24
|
-
{
|
|
23
|
+
> implements Plugin {
|
|
25
24
|
private readonly authToken?: string
|
|
26
25
|
private readonly messageHistoryApiVersion: MessageHistoryApiVersion
|
|
27
26
|
private readonly memory: MemoryOptions
|