@agentica/core 0.12.2-dev.20250314 → 0.12.4

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.
Files changed (78) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +461 -461
  3. package/lib/context/AgenticaTokenUsage.d.ts +6 -6
  4. package/package.json +1 -1
  5. package/prompts/cancel.md +4 -4
  6. package/prompts/common.md +2 -2
  7. package/prompts/describe.md +6 -6
  8. package/prompts/execute.md +6 -6
  9. package/prompts/initialize.md +2 -2
  10. package/prompts/select.md +6 -6
  11. package/src/Agentica.ts +359 -359
  12. package/src/chatgpt/ChatGptAgent.ts +76 -76
  13. package/src/chatgpt/ChatGptCallFunctionAgent.ts +466 -466
  14. package/src/chatgpt/ChatGptCancelFunctionAgent.ts +280 -280
  15. package/src/chatgpt/ChatGptCompletionMessageUtil.ts +166 -166
  16. package/src/chatgpt/ChatGptDescribeFunctionAgent.ts +122 -122
  17. package/src/chatgpt/ChatGptHistoryDecoder.ts +88 -88
  18. package/src/chatgpt/ChatGptInitializeFunctionAgent.ts +96 -96
  19. package/src/chatgpt/ChatGptSelectFunctionAgent.ts +311 -311
  20. package/src/chatgpt/ChatGptUsageAggregator.ts +62 -62
  21. package/src/context/AgenticaCancelPrompt.ts +32 -32
  22. package/src/context/AgenticaClassOperation.ts +23 -23
  23. package/src/context/AgenticaContext.ts +130 -130
  24. package/src/context/AgenticaHttpOperation.ts +27 -27
  25. package/src/context/AgenticaOperation.ts +66 -66
  26. package/src/context/AgenticaOperationBase.ts +57 -57
  27. package/src/context/AgenticaOperationCollection.ts +52 -52
  28. package/src/context/AgenticaOperationSelection.ts +27 -27
  29. package/src/context/AgenticaTokenUsage.ts +170 -170
  30. package/src/context/internal/AgenticaTokenUsageAggregator.ts +66 -66
  31. package/src/context/internal/__IChatCancelFunctionsApplication.ts +23 -23
  32. package/src/context/internal/__IChatFunctionReference.ts +21 -21
  33. package/src/context/internal/__IChatInitialApplication.ts +15 -15
  34. package/src/context/internal/__IChatSelectFunctionsApplication.ts +24 -24
  35. package/src/events/AgenticaCallEvent.ts +36 -36
  36. package/src/events/AgenticaCancelEvent.ts +28 -28
  37. package/src/events/AgenticaDescribeEvent.ts +66 -66
  38. package/src/events/AgenticaEvent.ts +36 -36
  39. package/src/events/AgenticaEventBase.ts +7 -7
  40. package/src/events/AgenticaEventSource.ts +6 -6
  41. package/src/events/AgenticaExecuteEvent.ts +50 -50
  42. package/src/events/AgenticaInitializeEvent.ts +14 -14
  43. package/src/events/AgenticaRequestEvent.ts +45 -45
  44. package/src/events/AgenticaResponseEvent.ts +48 -48
  45. package/src/events/AgenticaSelectEvent.ts +37 -37
  46. package/src/events/AgenticaTextEvent.ts +62 -62
  47. package/src/functional/assertHttpLlmApplication.ts +55 -55
  48. package/src/functional/validateHttpLlmApplication.ts +66 -66
  49. package/src/index.ts +44 -44
  50. package/src/internal/AgenticaConstant.ts +4 -4
  51. package/src/internal/AgenticaDefaultPrompt.ts +43 -43
  52. package/src/internal/AgenticaOperationComposer.ts +96 -96
  53. package/src/internal/ByteArrayUtil.ts +5 -5
  54. package/src/internal/MPSCUtil.ts +111 -111
  55. package/src/internal/MathUtil.ts +3 -3
  56. package/src/internal/Singleton.ts +22 -22
  57. package/src/internal/StreamUtil.ts +64 -64
  58. package/src/internal/__map_take.ts +15 -15
  59. package/src/json/IAgenticaEventJson.ts +178 -178
  60. package/src/json/IAgenticaOperationJson.ts +36 -36
  61. package/src/json/IAgenticaOperationSelectionJson.ts +19 -19
  62. package/src/json/IAgenticaPromptJson.ts +130 -130
  63. package/src/json/IAgenticaTokenUsageJson.ts +107 -107
  64. package/src/prompts/AgenticaCancelPrompt.ts +32 -32
  65. package/src/prompts/AgenticaDescribePrompt.ts +41 -41
  66. package/src/prompts/AgenticaExecutePrompt.ts +52 -52
  67. package/src/prompts/AgenticaPrompt.ts +14 -14
  68. package/src/prompts/AgenticaPromptBase.ts +27 -27
  69. package/src/prompts/AgenticaSelectPrompt.ts +32 -32
  70. package/src/prompts/AgenticaTextPrompt.ts +31 -31
  71. package/src/structures/IAgenticaConfig.ts +123 -123
  72. package/src/structures/IAgenticaController.ts +133 -133
  73. package/src/structures/IAgenticaExecutor.ts +157 -157
  74. package/src/structures/IAgenticaProps.ts +69 -69
  75. package/src/structures/IAgenticaSystemPrompt.ts +125 -125
  76. package/src/structures/IAgenticaVendor.ts +39 -39
  77. package/src/transformers/AgenticaEventTransformer.ts +165 -165
  78. package/src/transformers/AgenticaPromptTransformer.ts +134 -134
@@ -3,27 +3,27 @@ export declare class AgenticaTokenUsage implements IAgenticaTokenUsageJson {
3
3
  /**
4
4
  * Aggregated token usage.
5
5
  */
6
- readonly aggregate: IAgenticaTokenUsageJson.IComponent;
6
+ readonly aggregate: AgenticaTokenUsage.IComponent;
7
7
  /**
8
8
  * Token uasge of initializer agent.
9
9
  */
10
- readonly initialize: IAgenticaTokenUsageJson.IComponent;
10
+ readonly initialize: AgenticaTokenUsage.IComponent;
11
11
  /**
12
12
  * Token usage of function selector agent.
13
13
  */
14
- readonly select: IAgenticaTokenUsageJson.IComponent;
14
+ readonly select: AgenticaTokenUsage.IComponent;
15
15
  /**
16
16
  * Token usage of function canceler agent.
17
17
  */
18
- readonly cancel: IAgenticaTokenUsageJson.IComponent;
18
+ readonly cancel: AgenticaTokenUsage.IComponent;
19
19
  /**
20
20
  * Token usage of function caller agent.
21
21
  */
22
- readonly call: IAgenticaTokenUsageJson.IComponent;
22
+ readonly call: AgenticaTokenUsage.IComponent;
23
23
  /**
24
24
  * Token usage of function calling describer agent.
25
25
  */
26
- readonly describe: IAgenticaTokenUsageJson.IComponent;
26
+ readonly describe: AgenticaTokenUsage.IComponent;
27
27
  constructor(props?: IAgenticaTokenUsageJson);
28
28
  increment(y: IAgenticaTokenUsageJson): void;
29
29
  toJSON(): IAgenticaTokenUsageJson;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentica/core",
3
- "version": "0.12.2-dev.20250314",
3
+ "version": "0.12.4",
4
4
  "main": "lib/index.js",
5
5
  "description": "Agentic AI Library specialized in LLM Function Calling",
6
6
  "scripts": {
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
-
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
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
-
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
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,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
-
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
7
  At last, if user's language locale code is different with your description, please translate it to the user's language.
@@ -1,7 +1,7 @@
1
- You are a helpful assistant for tool calling.
2
-
3
- Use the supplied tools to assist the user.
4
-
5
- If previous messages are not enough to compose the arguments, you can ask the user to write more information. By the way, when asking the user to write more information, make the text concise and clear.
6
-
1
+ You are a helpful assistant for tool calling.
2
+
3
+ Use the supplied tools to assist the user.
4
+
5
+ If previous messages are not enough to compose the arguments, you can ask the user to write more information. By the way, when asking the user to write more information, make the text concise and clear.
6
+
7
7
  For reference, in the "tool" role message content, the `function` property means metadata of the API operation. In other words, it is the function schema describing its purpose, parameters and return value types. And then the `data` property is the return value from the target function calling.
@@ -1,3 +1,3 @@
1
- You are a helpful assistant.
2
-
1
+ You are a helpful assistant.
2
+
3
3
  Use the supplied tools to assist the user.
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
-
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
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.