@agentica/core 0.9.0 → 0.10.0-dev.20250302
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 +419 -419
- package/lib/Agentica.d.ts +4 -4
- package/lib/Agentica.js +7 -7
- package/lib/Agentica.js.map +1 -1
- package/lib/chatgpt/ChatGptCallFunctionAgent.js +14 -6
- package/lib/chatgpt/ChatGptCallFunctionAgent.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +10 -5
- package/lib/index.mjs.map +1 -1
- package/lib/structures/IAgenticaContext.d.ts +1 -1
- package/lib/structures/IAgenticaController.d.ts +4 -5
- package/lib/structures/IAgenticaEvent.d.ts +3 -3
- package/lib/structures/IAgenticaOperation.d.ts +2 -3
- package/lib/structures/IAgenticaOperationSelection.d.ts +2 -3
- package/lib/structures/IAgenticaPrompt.d.ts +2 -3
- package/lib/structures/IAgenticaProps.d.ts +4 -4
- package/lib/structures/IAgenticaTokenUsage.d.ts +3 -3
- package/lib/structures/{IAgenticaProvider.d.ts → IAgenticaVendor.d.ts} +6 -6
- package/lib/structures/{IAgenticaProvider.js → IAgenticaVendor.js} +1 -1
- package/lib/structures/IAgenticaVendor.js.map +1 -0
- package/package.json +1 -1
- package/prompts/cancel.md +4 -4
- package/prompts/common.md +2 -2
- package/prompts/describe.md +6 -6
- package/prompts/execute.md +6 -6
- package/prompts/initialize.md +2 -2
- package/prompts/select.md +6 -6
- package/src/Agentica.ts +323 -323
- package/src/chatgpt/ChatGptAgent.ts +75 -75
- package/src/chatgpt/ChatGptCallFunctionAgent.ts +464 -448
- package/src/chatgpt/ChatGptCancelFunctionAgent.ts +287 -287
- package/src/chatgpt/ChatGptDescribeFunctionAgent.ts +52 -52
- package/src/chatgpt/ChatGptHistoryDecoder.ts +88 -88
- package/src/chatgpt/ChatGptInitializeFunctionAgent.ts +88 -88
- package/src/chatgpt/ChatGptSelectFunctionAgent.ts +319 -319
- package/src/functional/createHttpLlmApplication.ts +63 -63
- package/src/index.ts +19 -19
- package/src/internal/AgenticaConstant.ts +4 -4
- package/src/internal/AgenticaDefaultPrompt.ts +43 -43
- package/src/internal/AgenticaOperationComposer.ts +87 -87
- package/src/internal/AgenticaPromptFactory.ts +32 -32
- package/src/internal/AgenticaPromptTransformer.ts +86 -86
- package/src/internal/AgenticaTokenUsageAggregator.ts +115 -115
- package/src/internal/MathUtil.ts +3 -3
- package/src/internal/Singleton.ts +22 -22
- package/src/internal/__map_take.ts +15 -15
- package/src/structures/IAgenticaConfig.ts +123 -123
- package/src/structures/IAgenticaContext.ts +129 -129
- package/src/structures/IAgenticaController.ts +133 -132
- package/src/structures/IAgenticaEvent.ts +229 -229
- package/src/structures/IAgenticaExecutor.ts +156 -156
- package/src/structures/IAgenticaOperation.ts +63 -64
- package/src/structures/IAgenticaOperationCollection.ts +52 -52
- package/src/structures/IAgenticaOperationSelection.ts +68 -69
- package/src/structures/IAgenticaPrompt.ts +182 -178
- package/src/structures/IAgenticaProps.ts +70 -70
- package/src/structures/IAgenticaSystemPrompt.ts +124 -124
- package/src/structures/IAgenticaTokenUsage.ts +107 -107
- package/src/structures/{IAgenticaProvider.ts → IAgenticaVendor.ts} +39 -39
- package/src/structures/internal/__IChatCancelFunctionsApplication.ts +23 -23
- package/src/structures/internal/__IChatFunctionReference.ts +21 -21
- package/src/structures/internal/__IChatInitialApplication.ts +15 -15
- package/src/structures/internal/__IChatSelectFunctionsApplication.ts +24 -24
- package/src/typings/AgenticaSource.ts +6 -6
- package/lib/structures/IAgenticaProvider.js.map +0 -1
|
@@ -3,7 +3,7 @@ import { Primitive } from "typia";
|
|
|
3
3
|
import { IAgenticaConfig } from "./IAgenticaConfig";
|
|
4
4
|
import { IAgenticaController } from "./IAgenticaController";
|
|
5
5
|
import { IAgenticaPrompt } from "./IAgenticaPrompt";
|
|
6
|
-
import {
|
|
6
|
+
import { IAgenticaVendor } from "./IAgenticaVendor";
|
|
7
7
|
/**
|
|
8
8
|
* Properties of the Nestia Agent.
|
|
9
9
|
*
|
|
@@ -12,7 +12,7 @@ import { IAgenticaProvider } from "./IAgenticaProvider";
|
|
|
12
12
|
* there're everything to prepare to create a Super A.I. chatbot
|
|
13
13
|
* performing the LLM (Large Language Model) function calling.
|
|
14
14
|
*
|
|
15
|
-
* At first, you have to specify the LLM service {@link
|
|
15
|
+
* At first, you have to specify the LLM service {@link vendor} like
|
|
16
16
|
* OpenAI with its API key and client API. And then, you have to define
|
|
17
17
|
* the {@link controllers} serving the functions to call. The controllers
|
|
18
18
|
* are separated by two protocols; HTTP API and TypeScript class. At last,
|
|
@@ -31,9 +31,9 @@ export interface IAgenticaProps<Model extends ILlmSchema.Model> {
|
|
|
31
31
|
*/
|
|
32
32
|
model: Model;
|
|
33
33
|
/**
|
|
34
|
-
* LLM service
|
|
34
|
+
* LLM service vendor.
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
vendor: IAgenticaVendor;
|
|
37
37
|
/**
|
|
38
38
|
* Controllers serving functions to call.
|
|
39
39
|
*/
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
* information, and does not contain any price or cost information. It is
|
|
11
11
|
* because the price or cost can be changed by below reasons.
|
|
12
12
|
*
|
|
13
|
-
* - Type of {@link IAgenticaProps.
|
|
14
|
-
* - {@link
|
|
15
|
-
* - Just by a policy change of the LLM
|
|
13
|
+
* - Type of {@link IAgenticaProps.vendor LLM vendor}
|
|
14
|
+
* - {@link IAgenticaVendor.model} in the LLM vendor.
|
|
15
|
+
* - Just by a policy change of the LLM vendor company.
|
|
16
16
|
*
|
|
17
17
|
* @author Samchon
|
|
18
18
|
*/
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import OpenAI from "openai";
|
|
2
2
|
/**
|
|
3
|
-
* LLM
|
|
3
|
+
* LLM service vendor for Nestia Chat.
|
|
4
4
|
*
|
|
5
|
-
* `
|
|
6
|
-
* (Large Language Model)
|
|
5
|
+
* `IAgenticaVendor` is a type represents an LLM
|
|
6
|
+
* (Large Language Model) vendor of the {@link Agentica}.
|
|
7
7
|
*
|
|
8
8
|
* Currently, {@link Agentica} supports OpenAI SDK. However, it does
|
|
9
9
|
* not mean that you can use only OpenAI's GPT model in the
|
|
10
10
|
* {@link Agentica}. The OpenAI SDK is just a connection tool to the
|
|
11
|
-
* LLM
|
|
11
|
+
* LLM vendor's API, and you can use other LLM vendors by configuring
|
|
12
12
|
* its `baseURL` and API key.
|
|
13
13
|
*
|
|
14
|
-
* Therefore, if you want to use another LLM
|
|
14
|
+
* Therefore, if you want to use another LLM vendor like Claude or
|
|
15
15
|
* Gemini, please configure the `baseURL` to the {@link api}, and
|
|
16
16
|
* set {@link IAgenticaController}'s schema model as "cluade" or
|
|
17
17
|
* "gemini".
|
|
18
18
|
*
|
|
19
19
|
* @author Samchon
|
|
20
20
|
*/
|
|
21
|
-
export interface
|
|
21
|
+
export interface IAgenticaVendor {
|
|
22
22
|
/**
|
|
23
23
|
* OpenAI API instance.
|
|
24
24
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAgenticaVendor.js","sourceRoot":"","sources":["../../src/structures/IAgenticaVendor.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
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.
|
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
|
-
|
|
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.
|
package/prompts/execute.md
CHANGED
|
@@ -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.
|
package/prompts/initialize.md
CHANGED
|
@@ -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.
|