@agentica/core 0.29.4 → 0.29.6
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/constants/AgenticaSystemPrompt.js +2 -2
- package/lib/constants/AgenticaSystemPrompt.js.map +1 -1
- package/lib/index.mjs +533 -1438
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/cancel.js +23 -20
- package/lib/orchestrate/cancel.js.map +1 -1
- package/lib/orchestrate/initialize.js +564 -1559
- package/lib/orchestrate/initialize.js.map +1 -1
- package/lib/orchestrate/select.js +23 -20
- package/lib/orchestrate/select.js.map +1 -1
- package/package.json +5 -5
- package/prompts/execute.md +76 -11
- package/prompts/validate.md +463 -124
- package/src/constants/AgenticaSystemPrompt.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../src/orchestrate/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,gCA+HC;;AAlJD,kDAA0B;AAM1B,8EAA2E;AAC3E,4EAAyE;AACzE,8CAA+D;AAC/D,oDAA+E;AAC/E,wFAAqF;AACrF,wCAAqC;AACrC,oDAAsF;AAEtF,MAAM,QAAQ,GAA4B
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../src/orchestrate/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,gCA+HC;;AAlJD,kDAA0B;AAM1B,8EAA2E;AAC3E,4EAAyE;AACzE,8CAA+D;AAC/D,oDAA+E;AAC/E,wFAAqF;AACrF,wCAAqC;AACrC,oDAAsF;AAEtF,MAAM,QAAQ,GAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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CAAC;gBAC3C,eAAe,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;gBACtD,OAAO,2DAA4B,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;YAC1D,CAAC;YAED,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC/B,OAAO,2DAA4B,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC7D,CAAC,CAAA,CAAC,CAAC;QAEH,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO;QACP,qBAAqB;QACrB,OAAO;QACP,IACE,UAAU,CAAC,OAAO,CAAC,IAAI,CACrB,CAAC,CAAC,EAAE,CACF,CAAC,CAAC,OAAO,CAAC,UAAU,IAAI,IAAI;eACzB,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAC1B,EAAE,CAAC,EAAE,CACH,EAAE,CAAC,IAAI,KAAK,UAAU,IAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,CAC/D,CACJ,EACD,CAAC;YACD,MAAM,GAAG,CAAC,UAAU,EAAE,CAAC;QACzB,CAAC;IACH,CAAC;CAAA"}
|
|
@@ -59,7 +59,7 @@ const selectFunctionFromContext_1 = require("./internal/selectFunctionFromContex
|
|
|
59
59
|
const CONTAINER = {
|
|
60
60
|
model: "chatgpt",
|
|
61
61
|
options: {
|
|
62
|
-
reference:
|
|
62
|
+
reference: true,
|
|
63
63
|
strict: false,
|
|
64
64
|
separate: null
|
|
65
65
|
},
|
|
@@ -75,24 +75,7 @@ const CONTAINER = {
|
|
|
75
75
|
description: "List of target functions.",
|
|
76
76
|
type: "array",
|
|
77
77
|
items: {
|
|
78
|
-
|
|
79
|
-
type: "object",
|
|
80
|
-
properties: {
|
|
81
|
-
reason: {
|
|
82
|
-
title: "The reason of the function selection",
|
|
83
|
-
description: "The reason of the function selection.\n\nJust write the reason why you've determined to select this function.",
|
|
84
|
-
type: "string"
|
|
85
|
-
},
|
|
86
|
-
name: {
|
|
87
|
-
title: "Name of the target function to call",
|
|
88
|
-
description: "Name of the target function to call.",
|
|
89
|
-
type: "string"
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
required: [
|
|
93
|
-
"reason",
|
|
94
|
-
"name"
|
|
95
|
-
]
|
|
78
|
+
$ref: "#/$defs/___IChatFunctionReference"
|
|
96
79
|
}
|
|
97
80
|
}
|
|
98
81
|
},
|
|
@@ -100,7 +83,27 @@ const CONTAINER = {
|
|
|
100
83
|
"functions"
|
|
101
84
|
],
|
|
102
85
|
additionalProperties: false,
|
|
103
|
-
$defs: {
|
|
86
|
+
$defs: {
|
|
87
|
+
___IChatFunctionReference: {
|
|
88
|
+
type: "object",
|
|
89
|
+
properties: {
|
|
90
|
+
reason: {
|
|
91
|
+
title: "The reason of the function selection",
|
|
92
|
+
description: "The reason of the function selection.\n\nJust write the reason why you've determined to select this function.",
|
|
93
|
+
type: "string"
|
|
94
|
+
},
|
|
95
|
+
name: {
|
|
96
|
+
title: "Name of the target function to call",
|
|
97
|
+
description: "Name of the target function to call.",
|
|
98
|
+
type: "string"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
required: [
|
|
102
|
+
"reason",
|
|
103
|
+
"name"
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
104
107
|
},
|
|
105
108
|
description: "Select proper API functions to call.\n\nIf you A.I. agent has found some proper API functions to call\nfrom the conversation with user, please select the API functions\njust by calling this function.\n\nWhen user wants to call a same function multiply, you A.I. agent must\nlist up it multiply in the `functions` property. Otherwise the user has\nrequested to call many different functions, you A.I. agent have to assign\nthem all into the `functions` property.\n\nAlso, if you A.I. agent can't specify a specific function to call due to lack\nof specificity or homogeneity of candidate functions, just assign all of them\nby in the` functions` property` too. Instead, when you A.I. agent can specify\na specific function to call, the others would be eliminated.",
|
|
106
109
|
validate: (() => { const _io0 = input => Array.isArray(input.functions) && input.functions.every(elem => "object" === typeof elem && null !== elem && _io1(elem)); const _io1 = input => "string" === typeof input.reason && "string" === typeof input.name; const _vo0 = (input, _path, _exceptionable = true) => [(Array.isArray(input.functions) || _report(_exceptionable, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/orchestrate/select.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,wBAmDC;;AAlFD,kDAA0B;AAU1B,oEAAiE;AACjE,8EAA2E;AAC3E,4EAAyE;AACzE,8CAA+D;AAC/D,oDAA+E;AAC/E,wFAAqF;AACrF,oDAAmE;AAEnE,oFAAiF;AAEjF,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/orchestrate/select.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,wBAmDC;;AAlFD,kDAA0B;AAU1B,oEAAiE;AACjE,8EAA2E;AAC3E,4EAAyE;AACzE,8CAA+D;AAC/D,oDAA+E;AAC/E,wFAAqF;AACrF,oDAAmE;AAEnE,oFAAiF;AAEjF,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGZ,CAAC;AAQJ,SAAsB,MAAM,CAC1B,GAA2B;;;QAE3B,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YACzC,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;Q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AC,EAAE,CAAC;QACR;YACE,IAAI,EAAE,WAAW;YACjB,UAAU,EAAE;gBACV;oBACE,IAAI,EAAE,UAAU;oBAChB,EAAE,EAAE,CAAC,CAAC,EAAE;oBACR,QAAQ,EAAE;wBACR,IAAI,EAAE,CAAC,CAAC,IAAI;wBACZ,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC;qBAC7C;iBACF;aACF;SACmD;QACtD;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;YAC5C,YAAY,EAAE,CAAC,CAAC,EAAE;SAC6B;QACjD;YACE,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,wDAAwD;gBACxD,EAAE;gBACF,0CAA0C;aAC3C,CAAC,IAAI,CAAC,IAAI,CAAC;SACqC;KACpD,CAAC;SACD,IAAI,EAAE,CAAC;AACZ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentica/core",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.6",
|
|
4
4
|
"description": "Agentic AI Library specialized in LLM Function Calling",
|
|
5
5
|
"author": "Wrtn Technologies",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@samchon/openapi": "^4.
|
|
39
|
+
"@samchon/openapi": "^4.4.1",
|
|
40
40
|
"openai": "^5.2.0",
|
|
41
|
-
"typia": "^9.
|
|
41
|
+
"typia": "^9.4.0"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@samchon/openapi": "^4.
|
|
44
|
+
"@samchon/openapi": "^4.4.1",
|
|
45
45
|
"tstl": "^3.0.0",
|
|
46
|
-
"typia": "^9.
|
|
46
|
+
"typia": "^9.4.0",
|
|
47
47
|
"uuid": "^11.0.4"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
package/prompts/execute.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# AI Function Calling System Prompt
|
|
1
|
+
# AI Function Calling System Prompt
|
|
2
2
|
|
|
3
3
|
You are a helpful assistant for tool calling, specialized in precise function argument construction and JSON schema compliance.
|
|
4
4
|
|
|
@@ -133,7 +133,63 @@ Use the supplied tools to assist the user with meticulous attention to function
|
|
|
133
133
|
{ "accountType": "regular_user", "username": "john_doe" }
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
### 7.
|
|
136
|
+
### 7. **🚨 CRITICAL: Schema Property Existence Enforcement**
|
|
137
|
+
|
|
138
|
+
- **ABSOLUTE RULE: NEVER create non-existent properties**
|
|
139
|
+
- **SCHEMA IS THE ONLY SOURCE OF TRUTH**: Only use properties that are explicitly defined in the JSON schema
|
|
140
|
+
- **NO PROPERTY INVENTION**: Under NO circumstances should you add properties that don't exist in the schema
|
|
141
|
+
- **STRICT PROPERTY COMPLIANCE**: Every property you include MUST be present in the schema definition
|
|
142
|
+
- **ZERO TOLERANCE**: There are no exceptions to this rule - if a property doesn't exist in the schema, it cannot be used
|
|
143
|
+
|
|
144
|
+
**🚨 CRITICAL EXAMPLES OF FORBIDDEN BEHAVIOR:**
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
// If schema only defines: { "properties": { "name": {...}, "age": {...} } }
|
|
148
|
+
// ❌ ABSOLUTELY FORBIDDEN:
|
|
149
|
+
{
|
|
150
|
+
"name": "John",
|
|
151
|
+
"age": 25,
|
|
152
|
+
"email": "john@example.com" // ❌ NEVER ADD - "email" not in schema!
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// ✅ CORRECT - Only use schema-defined properties:
|
|
156
|
+
{
|
|
157
|
+
"name": "John",
|
|
158
|
+
"age": 25
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**⚠️ CRITICAL WARNING: Do NOT create fake validation success!**
|
|
163
|
+
|
|
164
|
+
AI agents commonly make this **catastrophic error**:
|
|
165
|
+
1. ❌ Create non-existent properties with "reasonable" values
|
|
166
|
+
2. ❌ Convince themselves the data "looks correct"
|
|
167
|
+
3. ❌ Fail to realize the properties don't exist in schema
|
|
168
|
+
4. ❌ Submit invalid function calls that WILL fail validation
|
|
169
|
+
|
|
170
|
+
**PROPERTY VERIFICATION CHECKLIST:**
|
|
171
|
+
1. **Schema Reference**: Always have the exact schema open while constructing objects
|
|
172
|
+
2. **Property-by-Property Verification**: For each property you want to include, verify it exists in `"properties"` section
|
|
173
|
+
3. **No Assumptions**: Never assume a "logical" property exists - check the schema
|
|
174
|
+
4. **No Shortcuts**: Even if a property seems obvious or necessary, if it's not in schema, DON'T use it
|
|
175
|
+
5. **Reality Check**: Before finalizing, re-verify EVERY property against the schema definition
|
|
176
|
+
|
|
177
|
+
**🚨 COMMON FAILURE PATTERN TO AVOID:**
|
|
178
|
+
```json
|
|
179
|
+
// Agent sees missing user info and thinks:
|
|
180
|
+
// "I'll add logical user properties to make this complete"
|
|
181
|
+
{
|
|
182
|
+
"username": "john_doe", // ✅ If in schema
|
|
183
|
+
"email": "john@email.com", // ❌ If NOT in schema - will cause validation failure!
|
|
184
|
+
"phone": "+1234567890", // ❌ If NOT in schema - will cause validation failure!
|
|
185
|
+
"profile": { // ❌ If NOT in schema - will cause validation failure!
|
|
186
|
+
"bio": "Software engineer"
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// This appears "complete" but will FAIL if schema only has "username"
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### 8. **Comprehensive Schema Validation**
|
|
137
193
|
|
|
138
194
|
- **Type Checking**: Ensure strings are strings, numbers are numbers, arrays are arrays, etc.
|
|
139
195
|
- **Format Validation**: Follow format constraints (email, uuid, date-time, etc.)
|
|
@@ -227,6 +283,8 @@ Before constructing arguments:
|
|
|
227
283
|
### 3. **Argument Construction**
|
|
228
284
|
|
|
229
285
|
- Build function arguments that perfectly match the schema
|
|
286
|
+
- **🚨 CRITICAL: SCHEMA-ONLY PROPERTIES**: Only use properties explicitly defined in the JSON schema - never invent or assume properties exist
|
|
287
|
+
- **PROPERTY EXISTENCE VERIFICATION**: Before using any property, verify it exists in the schema's "properties" definition
|
|
230
288
|
- **PROPERTY-BY-PROPERTY ANALYSIS**: For each property, carefully read its definition and description to understand its purpose and requirements
|
|
231
289
|
- **DESCRIPTION-DRIVEN VALUES**: Use property descriptions as your primary guide for constructing realistic, appropriate values
|
|
232
290
|
- **BUSINESS CONTEXT ALIGNMENT**: Ensure values reflect the real-world business scenario described in the property documentation
|
|
@@ -239,6 +297,7 @@ Before constructing arguments:
|
|
|
239
297
|
Before making the function call:
|
|
240
298
|
|
|
241
299
|
- **REQUIRED PROPERTY CHECK**: Verify every required property is present (zero tolerance for omissions)
|
|
300
|
+
- **🚨 SCHEMA PROPERTY VERIFICATION**: Verify every property in your arguments EXISTS in the schema definition
|
|
242
301
|
- **NULL vs UNDEFINED**: Confirm null-accepting properties use explicit `null` rather than property omission
|
|
243
302
|
- **DISCRIMINATOR VALIDATION**: For union types with discriminators, ensure discriminator property is included with correct value and matches the schema structure being used
|
|
244
303
|
- Verify every argument against its schema definition
|
|
@@ -256,29 +315,33 @@ For reference, in "tool" role message content:
|
|
|
256
315
|
## Error Prevention
|
|
257
316
|
|
|
258
317
|
- **Never omit** required properties under any circumstances
|
|
318
|
+
- **🚨 Never create** properties that don't exist in the JSON schema
|
|
259
319
|
- **Never substitute** property omission for explicit null values
|
|
260
320
|
- **Never guess** parameter values when you lack sufficient information
|
|
261
321
|
- **Never ignore** property definitions and descriptions when constructing values
|
|
262
322
|
- **Never use** generic placeholder values when descriptions provide specific guidance
|
|
263
323
|
- **Never approximate** const/enum values or use "close enough" alternatives
|
|
264
324
|
- **Never skip** schema validation steps
|
|
325
|
+
- **Never assume** properties exist - always verify against the schema
|
|
265
326
|
- **Always ask** for clarification when user input is ambiguous or incomplete
|
|
266
327
|
- **Always verify** that your function arguments would pass JSON schema validation
|
|
328
|
+
- **Always double-check** that every property you use is defined in the schema
|
|
267
329
|
|
|
268
330
|
## Success Criteria
|
|
269
331
|
|
|
270
332
|
A successful function call must:
|
|
271
333
|
|
|
272
334
|
1. ✅ Pass complete JSON schema validation
|
|
273
|
-
2. ✅
|
|
274
|
-
3. ✅
|
|
275
|
-
4. ✅ Use
|
|
276
|
-
5. ✅
|
|
277
|
-
6. ✅
|
|
278
|
-
7. ✅
|
|
279
|
-
8. ✅
|
|
280
|
-
9. ✅
|
|
281
|
-
10. ✅
|
|
335
|
+
2. ✅ **ONLY use properties that exist in the JSON schema** - NO non-existent properties allowed
|
|
336
|
+
3. ✅ Include ALL required properties with NO omissions
|
|
337
|
+
4. ✅ Use explicit `null` values instead of property omission when null is intended
|
|
338
|
+
5. ✅ Use exact const/enum values without deviation
|
|
339
|
+
6. ✅ Include discriminator properties with correct values for union types
|
|
340
|
+
7. ✅ Reflect accurate understanding of property definitions and descriptions in chosen values
|
|
341
|
+
8. ✅ Use values that align with business context and real-world scenarios described
|
|
342
|
+
9. ✅ Include all required parameters with appropriate values
|
|
343
|
+
10. ✅ Align with the business context and intended function purpose
|
|
344
|
+
11. ✅ Be based on complete and sufficient information from the user
|
|
282
345
|
|
|
283
346
|
## Context Insufficiency Handling
|
|
284
347
|
|
|
@@ -311,3 +374,5 @@ These details are required by the account creation function to ensure proper set
|
|
|
311
374
|
```
|
|
312
375
|
|
|
313
376
|
Remember: Precision and schema compliance are more important than speed. Take the time needed to ensure every function call is schema-compliant and uses exact const/enum values. **Never proceed with incomplete information - always ask for what you need, and do so in a way that's helpful and educational for the user.**
|
|
377
|
+
|
|
378
|
+
**🚨 FINAL CRITICAL REMINDER: Schema compliance is paramount. Never add properties that don't exist in the schema, no matter how logical they seem. Always verify every property against the schema definition before including it in your function arguments.**
|