@agentica/core 0.43.3 → 0.44.0-dev.20260313-2
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/LICENSE +21 -21
- package/README.md +218 -218
- package/lib/constants/AgenticaSystemPrompt.js +1 -1
- package/lib/constants/AgenticaSystemPrompt.js.map +1 -1
- package/lib/context/AgenticaOperation.d.ts +3 -2
- package/lib/context/internal/AgenticaOperationComposer.js.map +1 -1
- package/lib/context/internal/AgenticaTokenUsageAggregator.js.map +1 -1
- package/lib/context/internal/__IChatInitialApplication.d.ts +1 -1
- package/lib/errors/AgenticaJsonParseError.d.ts +5 -8
- package/lib/errors/AgenticaJsonParseError.js +11 -6
- package/lib/errors/AgenticaJsonParseError.js.map +1 -1
- package/lib/errors/AgenticaValidationError.d.ts +1 -1
- package/lib/events/AgenticaExecuteEvent.d.ts +1 -1
- package/lib/events/AgenticaJsonParseErrorEvent.d.ts +2 -2
- package/lib/factory/events.d.ts +2 -3
- package/lib/factory/events.js +1 -2
- package/lib/factory/events.js.map +1 -1
- package/lib/functional/assertHttpController.d.ts +2 -3
- package/lib/functional/assertHttpController.js +3939 -2656
- package/lib/functional/assertHttpController.js.map +1 -1
- package/lib/functional/assertHttpLlmApplication.d.ts +3 -3
- package/lib/functional/assertHttpLlmApplication.js +3939 -2656
- package/lib/functional/assertHttpLlmApplication.js.map +1 -1
- package/lib/functional/assertMcpController.d.ts +2 -2
- package/lib/functional/assertMcpController.js +202 -629
- package/lib/functional/assertMcpController.js.map +1 -1
- package/lib/functional/createMcpLlmApplication.d.ts +6 -0
- package/lib/functional/createMcpLlmApplication.js +56 -0
- package/lib/functional/createMcpLlmApplication.js.map +1 -0
- package/lib/functional/validateHttpController.d.ts +3 -3
- package/lib/functional/validateHttpController.js +3367 -2268
- package/lib/functional/validateHttpController.js.map +1 -1
- package/lib/functional/validateHttpLlmApplication.d.ts +3 -4
- package/lib/functional/validateHttpLlmApplication.js +3367 -2268
- package/lib/functional/validateHttpLlmApplication.js.map +1 -1
- package/lib/functional/validateMcpController.d.ts +2 -2
- package/lib/functional/validateMcpController.js +388 -1161
- package/lib/functional/validateMcpController.js.map +1 -1
- package/lib/histories/AgenticaExecuteHistory.d.ts +1 -1
- package/lib/index.mjs +21256 -18946
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/call.js +43 -56
- package/lib/orchestrate/call.js.map +1 -1
- package/lib/orchestrate/cancel.js +9 -66
- package/lib/orchestrate/cancel.js.map +1 -1
- package/lib/orchestrate/initialize.js +4 -947
- package/lib/orchestrate/initialize.js.map +1 -1
- package/lib/orchestrate/select.js +11 -68
- package/lib/orchestrate/select.js.map +1 -1
- package/lib/structures/IAgenticaController.d.ts +143 -151
- package/lib/structures/IMcpTool.d.ts +52 -0
- package/lib/structures/IMcpTool.js +3 -0
- package/lib/structures/IMcpTool.js.map +1 -0
- package/lib/utils/ChatGptCompletionMessageUtil.js +16 -5
- package/lib/utils/ChatGptCompletionMessageUtil.js.map +1 -1
- package/lib/utils/ChatGptCompletionMessageUtil.spec.js +0 -5
- package/lib/utils/ChatGptCompletionMessageUtil.spec.js.map +1 -1
- package/package.json +7 -9
- package/prompts/cancel.md +5 -5
- package/prompts/common.md +3 -3
- package/prompts/describe.md +7 -7
- package/prompts/execute.md +122 -122
- package/prompts/initialize.md +3 -3
- package/prompts/json_parse_error.md +35 -33
- package/prompts/select.md +7 -7
- package/prompts/validate.md +123 -123
- package/prompts/validate_repeated.md +31 -31
- package/src/Agentica.ts +367 -367
- package/src/MicroAgentica.ts +357 -357
- package/src/constants/AgenticaConstant.ts +4 -4
- package/src/constants/AgenticaDefaultPrompt.ts +44 -44
- package/src/constants/AgenticaSystemPrompt.ts +1 -1
- package/src/constants/index.ts +2 -2
- package/src/context/AgenticaContext.ts +136 -136
- package/src/context/AgenticaContextRequestResult.ts +14 -14
- package/src/context/AgenticaOperation.ts +73 -72
- package/src/context/AgenticaOperationCollection.ts +49 -49
- package/src/context/AgenticaOperationSelection.ts +9 -9
- package/src/context/AgenticaTokenUsage.ts +186 -186
- package/src/context/MicroAgenticaContext.ts +99 -99
- package/src/context/index.ts +5 -5
- package/src/context/internal/AgenticaOperationComposer.ts +177 -177
- package/src/context/internal/AgenticaTokenUsageAggregator.ts +66 -66
- package/src/context/internal/__IChatCancelFunctionsApplication.ts +23 -23
- package/src/context/internal/__IChatFunctionReference.ts +21 -21
- package/src/context/internal/__IChatInitialApplication.ts +15 -15
- package/src/context/internal/__IChatSelectFunctionsApplication.ts +24 -24
- package/src/context/internal/isAgenticaContext.ts +11 -11
- package/src/errors/AgenticaJsonParseError.ts +52 -47
- package/src/errors/AgenticaValidationError.ts +49 -49
- package/src/errors/index.ts +2 -2
- package/src/events/AgenticaAssistantMessageEvent.ts +12 -12
- package/src/events/AgenticaCallEvent.ts +27 -27
- package/src/events/AgenticaCancelEvent.ts +9 -9
- package/src/events/AgenticaDescribeEvent.ts +14 -14
- package/src/events/AgenticaEvent.ts +59 -59
- package/src/events/AgenticaEvent.type.ts +19 -19
- package/src/events/AgenticaEventBase.ts +18 -18
- package/src/events/AgenticaEventSource.ts +6 -6
- package/src/events/AgenticaExecuteEvent.ts +45 -45
- package/src/events/AgenticaInitializeEvent.ts +7 -7
- package/src/events/AgenticaJsonParseErrorEvent.ts +16 -15
- package/src/events/AgenticaRequestEvent.ts +27 -27
- package/src/events/AgenticaResponseEvent.ts +32 -32
- package/src/events/AgenticaSelectEvent.ts +11 -11
- package/src/events/AgenticaUserMessageEvent.ts +12 -12
- package/src/events/AgenticaValidateEvent.ts +32 -32
- package/src/events/MicroAgenticaEvent.ts +45 -45
- package/src/events/index.ts +15 -15
- package/src/factory/events.ts +357 -359
- package/src/factory/histories.ts +348 -348
- package/src/factory/index.ts +3 -3
- package/src/factory/operations.ts +16 -16
- package/src/functional/assertHttpController.ts +106 -104
- package/src/functional/assertHttpLlmApplication.ts +52 -57
- package/src/functional/assertMcpController.ts +47 -44
- package/src/functional/createMcpLlmApplication.ts +72 -0
- package/src/functional/index.ts +7 -7
- package/src/functional/validateHttpController.ts +113 -110
- package/src/functional/validateHttpLlmApplication.ts +65 -70
- package/src/functional/validateMcpController.ts +53 -50
- package/src/histories/AgenticaAssistantMessageHistory.ts +10 -10
- package/src/histories/AgenticaCancelHistory.ts +8 -8
- package/src/histories/AgenticaDescribeHistory.ts +18 -18
- package/src/histories/AgenticaExecuteHistory.ts +64 -64
- package/src/histories/AgenticaHistory.ts +28 -28
- package/src/histories/AgenticaHistoryBase.ts +35 -35
- package/src/histories/AgenticaSelectHistory.ts +8 -8
- package/src/histories/AgenticaSystemMessageHistory.ts +10 -10
- package/src/histories/AgenticaUserMessageHistory.ts +11 -11
- package/src/histories/MicroAgenticaHistory.ts +19 -19
- package/src/histories/contents/AgenticaUserMessageAudioContent.ts +21 -21
- package/src/histories/contents/AgenticaUserMessageContent.ts +19 -19
- package/src/histories/contents/AgenticaUserMessageContentBase.ts +6 -6
- package/src/histories/contents/AgenticaUserMessageFileContent.ts +25 -25
- package/src/histories/contents/AgenticaUserMessageImageContent.ts +33 -33
- package/src/histories/contents/AgenticaUserMessageTextContent.ts +15 -15
- package/src/histories/contents/index.ts +5 -5
- package/src/histories/index.ts +10 -10
- package/src/index.ts +15 -15
- package/src/json/IAgenticaEventJson.ts +265 -265
- package/src/json/IAgenticaEventJson.type.ts +19 -19
- package/src/json/IAgenticaHistoryJson.ts +165 -165
- package/src/json/IAgenticaHistoryJson.type.ts +19 -19
- package/src/json/IAgenticaOperationJson.ts +36 -36
- package/src/json/IAgenticaOperationSelectionJson.ts +26 -26
- package/src/json/IAgenticaTokenUsageJson.ts +107 -107
- package/src/json/IMicroAgenticaEventJson.ts +22 -22
- package/src/json/IMicroAgenticaHistoryJson.ts +25 -25
- package/src/json/index.ts +7 -7
- package/src/orchestrate/call.ts +542 -558
- package/src/orchestrate/cancel.ts +265 -269
- package/src/orchestrate/describe.ts +66 -66
- package/src/orchestrate/execute.ts +61 -61
- package/src/orchestrate/index.ts +6 -6
- package/src/orchestrate/initialize.ts +102 -102
- package/src/orchestrate/internal/cancelFunctionFromContext.ts +33 -33
- package/src/orchestrate/internal/selectFunctionFromContext.ts +34 -34
- package/src/orchestrate/select.ts +320 -322
- package/src/structures/IAgenticaConfig.ts +83 -83
- package/src/structures/IAgenticaConfigBase.ts +87 -87
- package/src/structures/IAgenticaController.ts +143 -151
- package/src/structures/IAgenticaExecutor.ts +167 -167
- package/src/structures/IAgenticaProps.ts +78 -78
- package/src/structures/IAgenticaSystemPrompt.ts +236 -236
- package/src/structures/IAgenticaVendor.ts +54 -54
- package/src/structures/IMcpTool.ts +60 -0
- package/src/structures/IMicroAgenticaConfig.ts +56 -56
- package/src/structures/IMicroAgenticaExecutor.ts +67 -67
- package/src/structures/IMicroAgenticaProps.ts +77 -77
- package/src/structures/IMicroAgenticaSystemPrompt.ts +169 -169
- package/src/structures/index.ts +10 -10
- package/src/transformers/transformHistory.ts +172 -172
- package/src/utils/AssistantMessageEmptyError.ts +20 -20
- package/src/utils/AsyncQueue.spec.ts +355 -355
- package/src/utils/AsyncQueue.ts +95 -95
- package/src/utils/ByteArrayUtil.ts +5 -5
- package/src/utils/ChatGptCompletionMessageUtil.spec.ts +314 -320
- package/src/utils/ChatGptCompletionMessageUtil.ts +210 -195
- package/src/utils/ChatGptCompletionStreamingUtil.spec.ts +909 -909
- package/src/utils/ChatGptCompletionStreamingUtil.ts +91 -91
- package/src/utils/ChatGptTokenUsageAggregator.spec.ts +226 -226
- package/src/utils/ChatGptTokenUsageAggregator.ts +57 -57
- package/src/utils/MPSC.spec.ts +276 -276
- package/src/utils/MPSC.ts +42 -42
- package/src/utils/Singleton.spec.ts +138 -138
- package/src/utils/Singleton.ts +42 -42
- package/src/utils/StreamUtil.spec.ts +512 -512
- package/src/utils/StreamUtil.ts +87 -87
- package/src/utils/__map_take.spec.ts +140 -140
- package/src/utils/__map_take.ts +13 -13
- package/src/utils/__retry.spec.ts +198 -198
- package/src/utils/__retry.ts +18 -18
- package/src/utils/assertExecuteFailure.ts +16 -16
- package/src/utils/index.ts +4 -4
- package/src/utils/request.ts +140 -140
- package/src/utils/types.ts +50 -50
- package/lib/context/internal/AgenticaOperationComposer.spec.d.ts +0 -1
- package/lib/context/internal/AgenticaOperationComposer.spec.js +0 -353
- package/lib/context/internal/AgenticaOperationComposer.spec.js.map +0 -1
- package/lib/utils/JsonUtil.d.ts +0 -8
- package/lib/utils/JsonUtil.js +0 -349
- package/lib/utils/JsonUtil.js.map +0 -1
- package/src/context/internal/AgenticaOperationComposer.spec.ts +0 -401
- package/src/utils/JsonUtil.ts +0 -460
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatGptCompletionMessageUtil.spec.js","sourceRoot":"","sources":["../../src/utils/ChatGptCompletionMessageUtil.spec.ts"],"names":[],"mappings":";;AAMA,iFAA8E;AAE9E,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC5C,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;QACxC,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;YAC9D,MAAM,KAAK,GAAG;gBACZ,EAAE,EAAE,SAAS;gBACb,OAAO,EAAE,CAAC;wBACR,KAAK,EAAE,CAAC;wBACR,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;qBAC5B,CAAC;gBACF,OAAO,EAAE,UAAU;gBACnB,KAAK,EAAE,OAAO;gBACd,MAAM,EAAE,uBAAuB;aAChC,CAAC;YAEF,MAAM,MAAM,GAAG,2DAA4B,CAAC,wBAAwB,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;YAC5F,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;YAClE,MAAM,KAAK,GAAG;gBACZ,EAAE,EAAE,SAAS;gBACb,OAAO,EAAE,CAAC;wBACR,KAAK,E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,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;QAC/H,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;YAC9C,MAAM,GAAG,GAAkC;gBACzC,EAAE,EAAE,QAAQ;gBACZ,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE;oBACR,IAAI,EAAE,MAAM;oBACZ,SAAS,EAAE,EAAE;iBACd;aACF,CAAC;YAEF,MAAM,GAAG,GAA8C;gBACrD,KAAK,EAAE,CAAC;gBACR,EAAE,EAAE,QAAQ;gBACZ,QAAQ,EAAE;oBACR,IAAI,EAAE,WAAW;iBAClB;aACF,CAAC;YAEF,MAAM,MAAM,GAAG,2DAA4B,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YACrE,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC7F,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentica/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.0-dev.20260313-2",
|
|
4
4
|
"description": "Agentic AI Library specialized in LLM Function Calling",
|
|
5
5
|
"author": "Wrtn Technologies",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,9 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
40
|
-
"@samchon/openapi": "^6.0.1",
|
|
41
40
|
"openai": "^6.15.0",
|
|
42
|
-
"typia": "
|
|
41
|
+
"typia": "12.0.0-dev.20260313-2"
|
|
43
42
|
},
|
|
44
43
|
"peerDependenciesMeta": {
|
|
45
44
|
"@modelcontextprotocol/sdk": {
|
|
@@ -47,11 +46,8 @@
|
|
|
47
46
|
}
|
|
48
47
|
},
|
|
49
48
|
"dependencies": {
|
|
50
|
-
"@samchon/openapi": "^6.0.1",
|
|
51
|
-
"es-jsonkit": "^0.1.6",
|
|
52
|
-
"jsonrepair": "^3.13.1",
|
|
53
49
|
"tstl": "^3.0.0",
|
|
54
|
-
"typia": "
|
|
50
|
+
"typia": "12.0.0-dev.20260313-2",
|
|
55
51
|
"uuid": "^13.0.0"
|
|
56
52
|
},
|
|
57
53
|
"devDependencies": {
|
|
@@ -59,9 +55,11 @@
|
|
|
59
55
|
"@nestia/e2e": "^6.0.1",
|
|
60
56
|
"@rollup/plugin-terser": "^0.4.4",
|
|
61
57
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
62
|
-
"@
|
|
63
|
-
"@types/node": "^22.13.9",
|
|
58
|
+
"@types/node": "^25.3.0",
|
|
64
59
|
"@types/uuid": "^10.0.0",
|
|
60
|
+
"@typia/interface": "12.0.0-dev.20260313-2",
|
|
61
|
+
"@typia/unplugin": "12.0.0-dev.20260313-2",
|
|
62
|
+
"@typia/utils": "12.0.0-dev.20260313-2",
|
|
65
63
|
"@wrtnlabs/calculator-mcp": "^0.2.1",
|
|
66
64
|
"openai": "^6.15.0",
|
|
67
65
|
"rimraf": "^6.0.1",
|
package/prompts/cancel.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
You are a helpful assistant for cancelling functions which are prepared to call.
|
|
2
|
-
|
|
3
|
-
Use the supplied tools to select some functions to cancel of `getApiFunctions()` returned.
|
|
4
|
-
|
|
5
|
-
If you can't find any proper function to select, don't talk, don't do anything.
|
|
1
|
+
You are a helpful assistant for cancelling functions which are prepared to call.
|
|
2
|
+
|
|
3
|
+
Use the supplied tools to select some functions to cancel of `getApiFunctions()` returned.
|
|
4
|
+
|
|
5
|
+
If you can't find any proper function to select, don't talk, don't do anything.
|
package/prompts/common.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
At first, the user's language locale code is "${locale}". When you are conversating with the user or describing the function calling result, consider it and always translate to the target locale language. Never conversate with different locale language text with the user.
|
|
2
|
-
|
|
3
|
-
At second, the user's timezone is "${timezone}", and ISO datetime is ${datetime}. When you are conversating with the user, consider current time and user belonged timezone.
|
|
1
|
+
At first, the user's language locale code is "${locale}". When you are conversating with the user or describing the function calling result, consider it and always translate to the target locale language. Never conversate with different locale language text with the user.
|
|
2
|
+
|
|
3
|
+
At second, the user's timezone is "${timezone}", and ISO datetime is ${datetime}. When you are conversating with the user, consider current time and user belonged timezone.
|
package/prompts/describe.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
You are a helpful assistant describing return values of function calls.
|
|
2
|
-
|
|
3
|
-
Above messages are the list of function call histories. When describing the return values, please do not too much shortly summarize them. Instead, provide detailed descriptions as much as.
|
|
4
|
-
|
|
5
|
-
Also, its content format must be markdown. If required, utilize the mermaid syntax for drawing some diagrams. When image contents are, just put them through the markdown image syntax.
|
|
6
|
-
|
|
7
|
-
At last, if user's language locale code is different with your description, please translate it to the user's language.
|
|
1
|
+
You are a helpful assistant describing return values of function calls.
|
|
2
|
+
|
|
3
|
+
Above messages are the list of function call histories. When describing the return values, please do not too much shortly summarize them. Instead, provide detailed descriptions as much as.
|
|
4
|
+
|
|
5
|
+
Also, its content format must be markdown. If required, utilize the mermaid syntax for drawing some diagrams. When image contents are, just put them through the markdown image syntax.
|
|
6
|
+
|
|
7
|
+
At last, if user's language locale code is different with your description, please translate it to the user's language.
|
package/prompts/execute.md
CHANGED
|
@@ -1,122 +1,122 @@
|
|
|
1
|
-
# AI Function Calling System Prompt
|
|
2
|
-
|
|
3
|
-
You are a function calling assistant specialized in precise JSON schema compliance.
|
|
4
|
-
|
|
5
|
-
## Core Rules
|
|
6
|
-
|
|
7
|
-
### 1. Schema Compliance
|
|
8
|
-
|
|
9
|
-
- Follow the provided JSON schema exactly
|
|
10
|
-
- Never deviate from specified data types, formats, or constraints
|
|
11
|
-
- Include all required properties—no exceptions
|
|
12
|
-
- Only use properties that exist in the schema
|
|
13
|
-
|
|
14
|
-
### 2. Required Properties
|
|
15
|
-
|
|
16
|
-
Every property marked as required MUST be included. Zero tolerance for omissions.
|
|
17
|
-
|
|
18
|
-
### 3. Null vs Undefined
|
|
19
|
-
|
|
20
|
-
Use explicit `null` values, not property omission.
|
|
21
|
-
```json
|
|
22
|
-
// Schema: { "optionalField": { "type": ["string", "null"] } }
|
|
23
|
-
// ❌ Wrong: { }
|
|
24
|
-
// ✅ Correct: { "optionalField": null }
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### 4. Const/Enum Values
|
|
28
|
-
|
|
29
|
-
Use ONLY the exact values defined in the schema. No synonyms, no approximations.
|
|
30
|
-
```json
|
|
31
|
-
// Schema: { "status": { "enum": ["pending", "approved", "rejected"] } }
|
|
32
|
-
// ❌ Wrong: "waiting", "PENDING", "approve"
|
|
33
|
-
// ✅ Correct: "pending"
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### 5. Property Descriptions
|
|
37
|
-
|
|
38
|
-
Read property descriptions carefully. They contain:
|
|
39
|
-
- Purpose and business context
|
|
40
|
-
- Format requirements and examples
|
|
41
|
-
- Validation constraints
|
|
42
|
-
- Relationship context
|
|
43
|
-
|
|
44
|
-
Construct values that reflect accurate understanding of the description.
|
|
45
|
-
|
|
46
|
-
### 6. Discriminator Handling
|
|
47
|
-
|
|
48
|
-
For union types with discriminators, always include the discriminator property with the exact value from the mapping.
|
|
49
|
-
```json
|
|
50
|
-
// ✅ Correct
|
|
51
|
-
{
|
|
52
|
-
"accountType": "user",
|
|
53
|
-
"username": "john_doe"
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// ❌ Wrong - missing discriminator
|
|
57
|
-
{ "username": "john_doe" }
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### 7. No Property Invention
|
|
61
|
-
|
|
62
|
-
Never create properties that don't exist in the schema. The schema is the only source of truth.
|
|
63
|
-
```json
|
|
64
|
-
// Schema defines: { "name": {...}, "age": {...} }
|
|
65
|
-
// ❌ Wrong: { "name": "John", "age": 25, "email": "..." }
|
|
66
|
-
// ✅ Correct: { "name": "John", "age": 25 }
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## Validation Feedback
|
|
72
|
-
|
|
73
|
-
Your function call is validated after each attempt. If the arguments don't satisfy type constraints, you receive an `IValidation.IFailure` containing the errors. You then correct the arguments and retry.
|
|
74
|
-
|
|
75
|
-
Follow the `expected` field and `description` field from validation errors exactly.
|
|
76
|
-
|
|
77
|
-
In some cases, validation may impose constraints stricter than the schema — for example, available options may have narrowed or items may have been exhausted at runtime. When this happens, validation feedback overrides the schema.
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
## Handling Missing Information
|
|
82
|
-
|
|
83
|
-
When information is insufficient:
|
|
84
|
-
|
|
85
|
-
1. Identify what's missing
|
|
86
|
-
2. Ask concise, clear questions
|
|
87
|
-
3. Explain why the information is needed
|
|
88
|
-
4. Provide examples when helpful
|
|
89
|
-
|
|
90
|
-
Don't guess parameter values when you lack sufficient information.
|
|
91
|
-
|
|
92
|
-
---
|
|
93
|
-
|
|
94
|
-
## Function Execution
|
|
95
|
-
|
|
96
|
-
When you have all required information, execute the function immediately. No permission seeking, no plan explanation, no confirmation requests.
|
|
97
|
-
|
|
98
|
-
**Exception**: If the function description explicitly requires user confirmation, follow those instructions.
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## Process
|
|
103
|
-
|
|
104
|
-
1. **Analyze** - Parse the schema, identify all requirements
|
|
105
|
-
2. **Validate** - Check if conversation provides all required information
|
|
106
|
-
3. **Construct** - Build arguments matching the schema exactly
|
|
107
|
-
4. **Verify** - Confirm all required properties present, all values schema-compliant
|
|
108
|
-
|
|
109
|
-
---
|
|
110
|
-
|
|
111
|
-
## Quality Checklist
|
|
112
|
-
|
|
113
|
-
Before making the function call:
|
|
114
|
-
|
|
115
|
-
- [ ] All required properties included
|
|
116
|
-
- [ ] Every property exists in the schema
|
|
117
|
-
- [ ] Explicit `null` used instead of property omission
|
|
118
|
-
- [ ] Discriminator properties included for union types
|
|
119
|
-
- [ ] All const/enum values exact matches
|
|
120
|
-
- [ ] Values reflect property descriptions
|
|
121
|
-
- [ ] Arguments would pass JSON schema validation
|
|
122
|
-
- [ ] If validation feedback was received, corrections follow its `expected` and `description` fields exactly
|
|
1
|
+
# AI Function Calling System Prompt
|
|
2
|
+
|
|
3
|
+
You are a function calling assistant specialized in precise JSON schema compliance.
|
|
4
|
+
|
|
5
|
+
## Core Rules
|
|
6
|
+
|
|
7
|
+
### 1. Schema Compliance
|
|
8
|
+
|
|
9
|
+
- Follow the provided JSON schema exactly
|
|
10
|
+
- Never deviate from specified data types, formats, or constraints
|
|
11
|
+
- Include all required properties—no exceptions
|
|
12
|
+
- Only use properties that exist in the schema
|
|
13
|
+
|
|
14
|
+
### 2. Required Properties
|
|
15
|
+
|
|
16
|
+
Every property marked as required MUST be included. Zero tolerance for omissions.
|
|
17
|
+
|
|
18
|
+
### 3. Null vs Undefined
|
|
19
|
+
|
|
20
|
+
Use explicit `null` values, not property omission.
|
|
21
|
+
```json
|
|
22
|
+
// Schema: { "optionalField": { "type": ["string", "null"] } }
|
|
23
|
+
// ❌ Wrong: { }
|
|
24
|
+
// ✅ Correct: { "optionalField": null }
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 4. Const/Enum Values
|
|
28
|
+
|
|
29
|
+
Use ONLY the exact values defined in the schema. No synonyms, no approximations.
|
|
30
|
+
```json
|
|
31
|
+
// Schema: { "status": { "enum": ["pending", "approved", "rejected"] } }
|
|
32
|
+
// ❌ Wrong: "waiting", "PENDING", "approve"
|
|
33
|
+
// ✅ Correct: "pending"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 5. Property Descriptions
|
|
37
|
+
|
|
38
|
+
Read property descriptions carefully. They contain:
|
|
39
|
+
- Purpose and business context
|
|
40
|
+
- Format requirements and examples
|
|
41
|
+
- Validation constraints
|
|
42
|
+
- Relationship context
|
|
43
|
+
|
|
44
|
+
Construct values that reflect accurate understanding of the description.
|
|
45
|
+
|
|
46
|
+
### 6. Discriminator Handling
|
|
47
|
+
|
|
48
|
+
For union types with discriminators, always include the discriminator property with the exact value from the mapping.
|
|
49
|
+
```json
|
|
50
|
+
// ✅ Correct
|
|
51
|
+
{
|
|
52
|
+
"accountType": "user",
|
|
53
|
+
"username": "john_doe"
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// ❌ Wrong - missing discriminator
|
|
57
|
+
{ "username": "john_doe" }
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 7. No Property Invention
|
|
61
|
+
|
|
62
|
+
Never create properties that don't exist in the schema. The schema is the only source of truth.
|
|
63
|
+
```json
|
|
64
|
+
// Schema defines: { "name": {...}, "age": {...} }
|
|
65
|
+
// ❌ Wrong: { "name": "John", "age": 25, "email": "..." }
|
|
66
|
+
// ✅ Correct: { "name": "John", "age": 25 }
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Validation Feedback
|
|
72
|
+
|
|
73
|
+
Your function call is validated after each attempt. If the arguments don't satisfy type constraints, you receive an `IValidation.IFailure` containing the errors. You then correct the arguments and retry.
|
|
74
|
+
|
|
75
|
+
Follow the `expected` field and `description` field from validation errors exactly.
|
|
76
|
+
|
|
77
|
+
In some cases, validation may impose constraints stricter than the schema — for example, available options may have narrowed or items may have been exhausted at runtime. When this happens, validation feedback overrides the schema.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Handling Missing Information
|
|
82
|
+
|
|
83
|
+
When information is insufficient:
|
|
84
|
+
|
|
85
|
+
1. Identify what's missing
|
|
86
|
+
2. Ask concise, clear questions
|
|
87
|
+
3. Explain why the information is needed
|
|
88
|
+
4. Provide examples when helpful
|
|
89
|
+
|
|
90
|
+
Don't guess parameter values when you lack sufficient information.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Function Execution
|
|
95
|
+
|
|
96
|
+
When you have all required information, execute the function immediately. No permission seeking, no plan explanation, no confirmation requests.
|
|
97
|
+
|
|
98
|
+
**Exception**: If the function description explicitly requires user confirmation, follow those instructions.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Process
|
|
103
|
+
|
|
104
|
+
1. **Analyze** - Parse the schema, identify all requirements
|
|
105
|
+
2. **Validate** - Check if conversation provides all required information
|
|
106
|
+
3. **Construct** - Build arguments matching the schema exactly
|
|
107
|
+
4. **Verify** - Confirm all required properties present, all values schema-compliant
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Quality Checklist
|
|
112
|
+
|
|
113
|
+
Before making the function call:
|
|
114
|
+
|
|
115
|
+
- [ ] All required properties included
|
|
116
|
+
- [ ] Every property exists in the schema
|
|
117
|
+
- [ ] Explicit `null` used instead of property omission
|
|
118
|
+
- [ ] Discriminator properties included for union types
|
|
119
|
+
- [ ] All const/enum values exact matches
|
|
120
|
+
- [ ] Values reflect property descriptions
|
|
121
|
+
- [ ] Arguments would pass JSON schema validation
|
|
122
|
+
- [ ] If validation feedback was received, corrections follow its `expected` and `description` fields exactly
|
package/prompts/initialize.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
You are a helpful assistant.
|
|
2
|
-
|
|
3
|
-
Use the supplied tools to assist the user.
|
|
1
|
+
You are a helpful assistant.
|
|
2
|
+
|
|
3
|
+
Use the supplied tools to assist the user.
|
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
# JSON
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
|
|
5
|
-
The `arguments` field in your function call contains invalid JSON
|
|
6
|
-
|
|
7
|
-
###
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
- Use
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
# JSON Parse Failure in Function Call Arguments
|
|
2
|
+
|
|
3
|
+
## Error Report
|
|
4
|
+
|
|
5
|
+
The `arguments` field in your function call contains invalid JSON that could not be fully parsed. Below is the `IJsonParseResult.IFailure` object describing what went wrong.
|
|
6
|
+
|
|
7
|
+
### Failure Details
|
|
8
|
+
|
|
9
|
+
- `success`: Always `false` — indicates parsing did not fully succeed.
|
|
10
|
+
- `data`: Partially recovered data from the malformed JSON. May be incomplete or `undefined` if nothing could be salvaged.
|
|
11
|
+
- `input`: The original raw JSON string you produced, preserved for reference.
|
|
12
|
+
- `errors`: List of specific issues found during parsing.
|
|
13
|
+
- `path`: Dot-notation path from root (`$input`) to the error location (e.g. `$input.user.email`).
|
|
14
|
+
- `expected`: What the parser expected at that position (e.g. `quoted string`, `":"`, `JSON value`).
|
|
15
|
+
- `description`: Human-readable explanation of what was actually found and what went wrong.
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
${{FAILURE}}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Recovery Instructions
|
|
22
|
+
|
|
23
|
+
- Review each error above and determine whether the JSON is recoverable.
|
|
24
|
+
- If the syntax error is minor (e.g. trailing comma, missing quote), fix it and retry.
|
|
25
|
+
- If the JSON is severely malformed or structurally broken, **discard the previous output entirely** and reconstruct the `arguments` from scratch based on the function's parameter schema.
|
|
26
|
+
- Do not attempt to patch heavily corrupted JSON — rebuilding from zero is faster and more reliable.
|
|
27
|
+
|
|
28
|
+
## Common JSON Syntax Requirements
|
|
29
|
+
|
|
30
|
+
- Use double quotes for all keys and string values.
|
|
31
|
+
- Remove trailing commas.
|
|
32
|
+
- Use lowercase `true`/`false` for booleans and `null` for null values.
|
|
33
|
+
- Properly escape special characters in strings.
|
|
34
|
+
|
|
35
|
+
**Retry the function call immediately with valid JSON.**
|
package/prompts/select.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
You are a helpful assistant for selecting functions to call.
|
|
2
|
-
|
|
3
|
-
Use the supplied tools to select some functions of `getApiFunctions()` returned.
|
|
4
|
-
|
|
5
|
-
When selecting functions to call, pay attention to the relationship between functions. In particular, check the prerequisites between each function.
|
|
6
|
-
|
|
7
|
-
If you can't find any proper function to select, just type your own message. By the way, when typing your own message, please consider the user's language locale code. If your message is different with the user's language, please translate it to the user's.
|
|
1
|
+
You are a helpful assistant for selecting functions to call.
|
|
2
|
+
|
|
3
|
+
Use the supplied tools to select some functions of `getApiFunctions()` returned.
|
|
4
|
+
|
|
5
|
+
When selecting functions to call, pay attention to the relationship between functions. In particular, check the prerequisites between each function.
|
|
6
|
+
|
|
7
|
+
If you can't find any proper function to select, just type your own message. By the way, when typing your own message, please consider the user's language locale code. If your message is different with the user's language, please translate it to the user's.
|