@agentica/core 0.8.3 → 0.9.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.
Files changed (91) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +419 -404
  3. package/lib/Agentica.d.ts +10 -9
  4. package/lib/Agentica.js.map +1 -1
  5. package/lib/chatgpt/ChatGptAgent.d.ts +2 -1
  6. package/lib/chatgpt/ChatGptAgent.js.map +1 -1
  7. package/lib/chatgpt/ChatGptCallFunctionAgent.d.ts +2 -1
  8. package/lib/chatgpt/ChatGptCallFunctionAgent.js +3 -1
  9. package/lib/chatgpt/ChatGptCallFunctionAgent.js.map +1 -1
  10. package/lib/chatgpt/ChatGptCancelFunctionAgent.d.ts +3 -2
  11. package/lib/chatgpt/ChatGptCancelFunctionAgent.js +55 -2
  12. package/lib/chatgpt/ChatGptCancelFunctionAgent.js.map +1 -1
  13. package/lib/chatgpt/ChatGptDescribeFunctionAgent.d.ts +2 -1
  14. package/lib/chatgpt/ChatGptDescribeFunctionAgent.js.map +1 -1
  15. package/lib/chatgpt/ChatGptHistoryDecoder.d.ts +2 -1
  16. package/lib/chatgpt/ChatGptHistoryDecoder.js.map +1 -1
  17. package/lib/chatgpt/ChatGptInitializeFunctionAgent.d.ts +2 -1
  18. package/lib/chatgpt/ChatGptInitializeFunctionAgent.js +63 -1
  19. package/lib/chatgpt/ChatGptInitializeFunctionAgent.js.map +1 -1
  20. package/lib/chatgpt/ChatGptSelectFunctionAgent.d.ts +2 -1
  21. package/lib/chatgpt/ChatGptSelectFunctionAgent.js +55 -2
  22. package/lib/chatgpt/ChatGptSelectFunctionAgent.js.map +1 -1
  23. package/lib/functional/createHttpLlmApplication.js +826 -798
  24. package/lib/functional/createHttpLlmApplication.js.map +1 -1
  25. package/lib/index.mjs +987 -804
  26. package/lib/index.mjs.map +1 -1
  27. package/lib/internal/AgenticaDefaultPrompt.d.ts +2 -1
  28. package/lib/internal/AgenticaDefaultPrompt.js.map +1 -1
  29. package/lib/internal/AgenticaOperationComposer.d.ts +5 -4
  30. package/lib/internal/AgenticaOperationComposer.js +1 -1
  31. package/lib/internal/AgenticaOperationComposer.js.map +1 -1
  32. package/lib/internal/AgenticaPromptFactory.d.ts +3 -2
  33. package/lib/internal/AgenticaPromptFactory.js.map +1 -1
  34. package/lib/internal/AgenticaPromptTransformer.d.ts +5 -4
  35. package/lib/internal/AgenticaPromptTransformer.js.map +1 -1
  36. package/lib/structures/IAgenticaConfig.d.ts +4 -3
  37. package/lib/structures/IAgenticaContext.d.ts +7 -6
  38. package/lib/structures/IAgenticaController.d.ts +8 -8
  39. package/lib/structures/IAgenticaEvent.d.ts +19 -18
  40. package/lib/structures/IAgenticaExecutor.d.ts +7 -6
  41. package/lib/structures/IAgenticaOperation.d.ts +4 -4
  42. package/lib/structures/IAgenticaOperationCollection.d.ts +6 -5
  43. package/lib/structures/IAgenticaOperationSelection.d.ts +4 -4
  44. package/lib/structures/IAgenticaPrompt.d.ts +11 -11
  45. package/lib/structures/IAgenticaProps.d.ts +9 -4
  46. package/lib/structures/IAgenticaProvider.d.ts +22 -27
  47. package/lib/structures/IAgenticaSystemPrompt.d.ts +8 -7
  48. package/package.json +6 -9
  49. package/prompts/cancel.md +4 -4
  50. package/prompts/common.md +2 -2
  51. package/prompts/describe.md +6 -6
  52. package/prompts/execute.md +6 -6
  53. package/prompts/initialize.md +2 -2
  54. package/prompts/select.md +6 -6
  55. package/src/Agentica.ts +323 -318
  56. package/src/chatgpt/ChatGptAgent.ts +75 -71
  57. package/src/chatgpt/ChatGptCallFunctionAgent.ts +448 -445
  58. package/src/chatgpt/ChatGptCancelFunctionAgent.ts +287 -283
  59. package/src/chatgpt/ChatGptDescribeFunctionAgent.ts +52 -51
  60. package/src/chatgpt/ChatGptHistoryDecoder.ts +88 -87
  61. package/src/chatgpt/ChatGptInitializeFunctionAgent.ts +88 -88
  62. package/src/chatgpt/ChatGptSelectFunctionAgent.ts +319 -318
  63. package/src/functional/createHttpLlmApplication.ts +63 -63
  64. package/src/index.ts +19 -19
  65. package/src/internal/AgenticaConstant.ts +4 -4
  66. package/src/internal/AgenticaDefaultPrompt.ts +43 -39
  67. package/src/internal/AgenticaOperationComposer.ts +87 -82
  68. package/src/internal/AgenticaPromptFactory.ts +32 -30
  69. package/src/internal/AgenticaPromptTransformer.ts +86 -83
  70. package/src/internal/AgenticaTokenUsageAggregator.ts +115 -115
  71. package/src/internal/MathUtil.ts +3 -3
  72. package/src/internal/Singleton.ts +22 -22
  73. package/src/internal/__map_take.ts +15 -15
  74. package/src/structures/IAgenticaConfig.ts +123 -121
  75. package/src/structures/IAgenticaContext.ts +129 -128
  76. package/src/structures/IAgenticaController.ts +132 -130
  77. package/src/structures/IAgenticaEvent.ts +229 -224
  78. package/src/structures/IAgenticaExecutor.ts +156 -152
  79. package/src/structures/IAgenticaOperation.ts +64 -64
  80. package/src/structures/IAgenticaOperationCollection.ts +52 -50
  81. package/src/structures/IAgenticaOperationSelection.ts +69 -69
  82. package/src/structures/IAgenticaPrompt.ts +178 -173
  83. package/src/structures/IAgenticaProps.ts +70 -64
  84. package/src/structures/IAgenticaProvider.ts +39 -45
  85. package/src/structures/IAgenticaSystemPrompt.ts +124 -122
  86. package/src/structures/IAgenticaTokenUsage.ts +107 -107
  87. package/src/structures/internal/__IChatCancelFunctionsApplication.ts +23 -23
  88. package/src/structures/internal/__IChatFunctionReference.ts +21 -21
  89. package/src/structures/internal/__IChatInitialApplication.ts +15 -15
  90. package/src/structures/internal/__IChatSelectFunctionsApplication.ts +24 -24
  91. package/src/typings/AgenticaSource.ts +6 -6
@@ -1,45 +1,39 @@
1
- import OpenAI from "openai";
2
-
3
- /**
4
- * LLM Provider for Nestia Chat.
5
- *
6
- * `IAgenticaProvider` is a type represents an LLM
7
- * (Large Language Model) provider of the {@link Agentica}.
8
- *
9
- * Currently, {@link Agentica} is supporting only one provider OpenAI.
10
- * You can specify the provider by configuring the `type` property as
11
- * `"chatgpt"`. Also, you have to assign the OpenAI API client instance
12
- * to the `api` property, and specify the `model` to use.
13
- *
14
- * If you want to use another LLM provider like Claude or Gemini,
15
- * please write an issue or contribute to `nestia` please.
16
- *
17
- * @author Samchon
18
- */
19
- export type IAgenticaProvider = IAgenticaProvider.IChatGpt;
20
- export namespace IAgenticaProvider {
21
- /**
22
- * OpenAI provider.
23
- */
24
- export interface IChatGpt {
25
- /**
26
- * Discriminator type.
27
- */
28
- type: "chatgpt";
29
-
30
- /**
31
- * OpenAI API instance.
32
- */
33
- api: OpenAI;
34
-
35
- /**
36
- * Chat model to be used.
37
- */
38
- model: OpenAI.ChatModel;
39
-
40
- /**
41
- * Options for the request.
42
- */
43
- options?: OpenAI.RequestOptions | undefined;
44
- }
45
- }
1
+ import OpenAI from "openai";
2
+
3
+ /**
4
+ * LLM Provider for Nestia Chat.
5
+ *
6
+ * `IAgenticaProvider` is a type represents an LLM
7
+ * (Large Language Model) provider of the {@link Agentica}.
8
+ *
9
+ * Currently, {@link Agentica} supports OpenAI SDK. However, it does
10
+ * not mean that you can use only OpenAI's GPT model in the
11
+ * {@link Agentica}. The OpenAI SDK is just a connection tool to the
12
+ * LLM provider's API, and you can use other LLM providers by configuring
13
+ * its `baseURL` and API key.
14
+ *
15
+ * Therefore, if you want to use another LLM provider like Claude or
16
+ * Gemini, please configure the `baseURL` to the {@link api}, and
17
+ * set {@link IAgenticaController}'s schema model as "cluade" or
18
+ * "gemini".
19
+ *
20
+ * @author Samchon
21
+ */
22
+ export interface IAgenticaProvider {
23
+ /**
24
+ * OpenAI API instance.
25
+ */
26
+ api: OpenAI;
27
+
28
+ /**
29
+ * Chat model to be used.
30
+ *
31
+ * `({}) & string` means to support third party hosting cloud(eg. openRouter, aws)
32
+ */
33
+ model: OpenAI.ChatModel | ({} & string);
34
+
35
+ /**
36
+ * Options for the request.
37
+ */
38
+ options?: OpenAI.RequestOptions | undefined;
39
+ }
@@ -1,122 +1,124 @@
1
- import { IAgenticaConfig } from "./IAgenticaConfig";
2
- import { IAgenticaPrompt } from "./IAgenticaPrompt";
3
-
4
- /**
5
- * System prompt collection of the A.I. chatbot.
6
- *
7
- * `IAgenticaSystemPrompt` is a type represents a collection of system
8
- * prompts that would be used by the A.I. chatbot of {@link Agentica}.
9
- *
10
- * You can customize the system prompt by configuring the
11
- * {@link IAgenticaConfig.systemPrompt} property when creating a new
12
- * {@link Agentica} instance.
13
- *
14
- * If you don't configure any system prompts, the default system prompts
15
- * would be used which are written in the below directory as markdown
16
- * documents.
17
- *
18
- * - https://github.com/samchon/nestia/tree/master/packages/agent/prompts
19
- *
20
- * @author Samchon
21
- */
22
- export interface IAgenticaSystemPrompt {
23
- /**
24
- * Common system prompt that would be used in every situation.
25
- *
26
- * @param config Configuration of the agent
27
- * @returns The common system prompt
28
- * @default https://github.com/samchon/nestia/blob/master/packages/agent/prompts/common.md
29
- */
30
- common?: (config?: IAgenticaConfig | undefined) => string;
31
-
32
- /**
33
- * Initialize system prompt.
34
- *
35
- * When the A.I. chatbot has not informed any functions to the agent
36
- * yet because the user has not implied any function calling request yet,
37
- * {@link Agentica} says that it is a circumstance that nothing has
38
- * been initialized yet.
39
- *
40
- * In that case, the `initialize` system prompt would be used. You can
41
- * customize the `initialize` system prompt by assigning this function
42
- * with the given {@link IAgenticaPrompt histories} parameter.
43
- *
44
- * @param histories Histories of the previous prompts
45
- * @returns initialize system prompt
46
- * @default https://github.com/samchon/nestia/blob/master/packages/agent/prompts/initialize.md
47
- */
48
- initialize?: (histories: IAgenticaPrompt[]) => string;
49
-
50
- /**
51
- * Select system prompt.
52
- *
53
- * The {@link Agentica} has a process selecting some candidate
54
- * functions to call by asking to the A.I. agent with the previous
55
- * prompt histories.
56
- *
57
- * In that case, this `select` system prompt would be used. You can
58
- * customize it by assigning this function with the given
59
- * {@link IAgenticaPrompt histories} parameter.
60
- *
61
- * Note that, the `"select"` means only the function selection. It does
62
- * not contain the filling argument or executing the function. It
63
- * literally contains only the selection process.
64
- *
65
- * @param histories Histories of the previous prompts
66
- * @returns select system promopt
67
- * @default https://github.com/samchon/nestia/blob/master/packages/agent/prompts/select.md
68
- */
69
- select?: (histories: IAgenticaPrompt[]) => string;
70
-
71
- /**
72
- * Cancel system prompt.
73
- *
74
- * The {@link Agentica} has a process canceling some candidate
75
- * functions to call by asking to the A.I. agent with the previous
76
- * prompt histories.
77
- *
78
- * In that case, this `cancel` system prompt would be used. You can
79
- * customize it by assigning this function with the given
80
- * {@link IAgenticaPrompt histories} parameter.
81
- *
82
- * @param histories Histories of the previous prompts
83
- * @returns cancel system prompt
84
- * @default https://github.com/samchon/nestia/blob/master/packages/agent/prompts/cancel.md
85
- */
86
- cancel?: (histories: IAgenticaPrompt[]) => string;
87
-
88
- /**
89
- * Execute system prompt.
90
- *
91
- * The {@link Agentica} has a process filling the arguments of some
92
- * selected candidate functions by the LLM (Large Language Model)
93
- * function calling feature with the previous prompt histories, and
94
- * executing the arguments filled function with validation feedback.
95
- *
96
- * In that case, this `execute` system prompt would be used. You can
97
- * customize it by assigning this function with the given
98
- * {@link IAgenticaPrompt histories} parameter.
99
- *
100
- * @param histories Histories of the previous prompts
101
- * @returns execute system prompt
102
- * https://github.com/samchon/nestia/blob/master/packages/agent/prompts/execute.md
103
- */
104
- execute?: (histories: IAgenticaPrompt[]) => string;
105
-
106
- /**
107
- * Describe system prompt.
108
- *
109
- * The {@link Agentica} has a process describing the return values of
110
- * the executed functions by requesting to the A.I. agent with the
111
- * previous prompt histories.
112
- *
113
- * In that case, this `describe` system prompt would be used. You can
114
- * customize it by assigning this function with the given
115
- * {@link IAgenticaPrompt histories} parameter.
116
- *
117
- * @param histories Histories of the previous prompts
118
- * @returns describe system prompt
119
- * @default https://github.com/samchon/nestia/blob/master/packages/agent/prompts/describe.md
120
- */
121
- describe?: (histories: IAgenticaPrompt.IExecute[]) => string;
122
- }
1
+ import { ILlmSchema } from "@samchon/openapi";
2
+
3
+ import { IAgenticaConfig } from "./IAgenticaConfig";
4
+ import { IAgenticaPrompt } from "./IAgenticaPrompt";
5
+
6
+ /**
7
+ * System prompt collection of the A.I. chatbot.
8
+ *
9
+ * `IAgenticaSystemPrompt` is a type represents a collection of system
10
+ * prompts that would be used by the A.I. chatbot of {@link Agentica}.
11
+ *
12
+ * You can customize the system prompt by configuring the
13
+ * {@link IAgenticaConfig.systemPrompt} property when creating a new
14
+ * {@link Agentica} instance.
15
+ *
16
+ * If you don't configure any system prompts, the default system prompts
17
+ * would be used which are written in the below directory as markdown
18
+ * documents.
19
+ *
20
+ * - https://github.com/samchon/nestia/tree/master/packages/agent/prompts
21
+ *
22
+ * @author Samchon
23
+ */
24
+ export interface IAgenticaSystemPrompt<Model extends ILlmSchema.Model> {
25
+ /**
26
+ * Common system prompt that would be used in every situation.
27
+ *
28
+ * @param config Configuration of the agent
29
+ * @returns The common system prompt
30
+ * @default https://github.com/samchon/nestia/blob/master/packages/agent/prompts/common.md
31
+ */
32
+ common?: (config?: IAgenticaConfig<Model> | undefined) => string;
33
+
34
+ /**
35
+ * Initialize system prompt.
36
+ *
37
+ * When the A.I. chatbot has not informed any functions to the agent
38
+ * yet because the user has not implied any function calling request yet,
39
+ * {@link Agentica} says that it is a circumstance that nothing has
40
+ * been initialized yet.
41
+ *
42
+ * In that case, the `initialize` system prompt would be used. You can
43
+ * customize the `initialize` system prompt by assigning this function
44
+ * with the given {@link IAgenticaPrompt histories} parameter.
45
+ *
46
+ * @param histories Histories of the previous prompts
47
+ * @returns initialize system prompt
48
+ * @default https://github.com/samchon/nestia/blob/master/packages/agent/prompts/initialize.md
49
+ */
50
+ initialize?: (histories: IAgenticaPrompt<Model>[]) => string;
51
+
52
+ /**
53
+ * Select system prompt.
54
+ *
55
+ * The {@link Agentica} has a process selecting some candidate
56
+ * functions to call by asking to the A.I. agent with the previous
57
+ * prompt histories.
58
+ *
59
+ * In that case, this `select` system prompt would be used. You can
60
+ * customize it by assigning this function with the given
61
+ * {@link IAgenticaPrompt histories} parameter.
62
+ *
63
+ * Note that, the `"select"` means only the function selection. It does
64
+ * not contain the filling argument or executing the function. It
65
+ * literally contains only the selection process.
66
+ *
67
+ * @param histories Histories of the previous prompts
68
+ * @returns select system promopt
69
+ * @default https://github.com/samchon/nestia/blob/master/packages/agent/prompts/select.md
70
+ */
71
+ select?: (histories: IAgenticaPrompt<Model>[]) => string;
72
+
73
+ /**
74
+ * Cancel system prompt.
75
+ *
76
+ * The {@link Agentica} has a process canceling some candidate
77
+ * functions to call by asking to the A.I. agent with the previous
78
+ * prompt histories.
79
+ *
80
+ * In that case, this `cancel` system prompt would be used. You can
81
+ * customize it by assigning this function with the given
82
+ * {@link IAgenticaPrompt histories} parameter.
83
+ *
84
+ * @param histories Histories of the previous prompts
85
+ * @returns cancel system prompt
86
+ * @default https://github.com/samchon/nestia/blob/master/packages/agent/prompts/cancel.md
87
+ */
88
+ cancel?: (histories: IAgenticaPrompt<Model>[]) => string;
89
+
90
+ /**
91
+ * Execute system prompt.
92
+ *
93
+ * The {@link Agentica} has a process filling the arguments of some
94
+ * selected candidate functions by the LLM (Large Language Model)
95
+ * function calling feature with the previous prompt histories, and
96
+ * executing the arguments filled function with validation feedback.
97
+ *
98
+ * In that case, this `execute` system prompt would be used. You can
99
+ * customize it by assigning this function with the given
100
+ * {@link IAgenticaPrompt histories} parameter.
101
+ *
102
+ * @param histories Histories of the previous prompts
103
+ * @returns execute system prompt
104
+ * https://github.com/samchon/nestia/blob/master/packages/agent/prompts/execute.md
105
+ */
106
+ execute?: (histories: IAgenticaPrompt<Model>[]) => string;
107
+
108
+ /**
109
+ * Describe system prompt.
110
+ *
111
+ * The {@link Agentica} has a process describing the return values of
112
+ * the executed functions by requesting to the A.I. agent with the
113
+ * previous prompt histories.
114
+ *
115
+ * In that case, this `describe` system prompt would be used. You can
116
+ * customize it by assigning this function with the given
117
+ * {@link IAgenticaPrompt histories} parameter.
118
+ *
119
+ * @param histories Histories of the previous prompts
120
+ * @returns describe system prompt
121
+ * @default https://github.com/samchon/nestia/blob/master/packages/agent/prompts/describe.md
122
+ */
123
+ describe?: (histories: IAgenticaPrompt.IExecute<Model>[]) => string;
124
+ }
@@ -1,107 +1,107 @@
1
- /**
2
- * Token usage information from the A.I. chatbot.
3
- *
4
- * `IAgenticaTokenUsage` is a structure representing the token usage
5
- * information from the {@link Agentica} class. And you can get the
6
- * token usage information by calling the {@link Agentica.getTokenUsage}
7
- * method.
8
- *
9
- * For reference, `IAgenticaTokenUsage` provides only the token usage
10
- * information, and does not contain any price or cost information. It is
11
- * because the price or cost can be changed by below reasons.
12
- *
13
- * - Type of {@link IAgenticaProps.provider LLM provider}
14
- * - {@link IAgenticaProvider.model} in the LLM provider.
15
- * - Just by a policy change of the LLM provider company.
16
- *
17
- * @author Samchon
18
- */
19
- export interface IAgenticaTokenUsage {
20
- /**
21
- * Aggregated token usage.
22
- */
23
- aggregate: IAgenticaTokenUsage.IComponent;
24
-
25
- /**
26
- * Token uasge of initializer agent.
27
- */
28
- initialize: IAgenticaTokenUsage.IComponent;
29
-
30
- /**
31
- * Token usage of function selector agent.
32
- */
33
- select: IAgenticaTokenUsage.IComponent;
34
-
35
- /**
36
- * Token usage of function canceler agent.
37
- */
38
- cancel: IAgenticaTokenUsage.IComponent;
39
-
40
- /**
41
- * Token usage of function caller agent.
42
- */
43
- call: IAgenticaTokenUsage.IComponent;
44
-
45
- /**
46
- * Token usage of function calling describer agent.
47
- */
48
- describe: IAgenticaTokenUsage.IComponent;
49
- }
50
- export namespace IAgenticaTokenUsage {
51
- export interface IComponent {
52
- /**
53
- * Total token usage.
54
- */
55
- total: number;
56
-
57
- /**
58
- * Input token usage of detailed.
59
- */
60
- input: IInput;
61
-
62
- /**
63
- * Output token usage of detailed.
64
- */
65
- output: IOutput;
66
- }
67
-
68
- /**
69
- * Input token usage of detailed.
70
- */
71
- export interface IInput {
72
- /**
73
- * Total amount of input token uasge.
74
- */
75
- total: number;
76
-
77
- /**
78
- * Cached token usage.
79
- */
80
- cached: number;
81
- }
82
-
83
- /**
84
- * Output token usage of detailed.
85
- */
86
- export interface IOutput {
87
- /**
88
- * Total amount of output token usage.
89
- */
90
- total: number;
91
-
92
- /**
93
- * Reasoning token usage.
94
- */
95
- reasoning: number;
96
-
97
- /**
98
- * Prediction token usage.
99
- */
100
- accepted_prediction: number;
101
-
102
- /**
103
- * Rejected prediction token usage.
104
- */
105
- rejected_prediction: number;
106
- }
107
- }
1
+ /**
2
+ * Token usage information from the A.I. chatbot.
3
+ *
4
+ * `IAgenticaTokenUsage` is a structure representing the token usage
5
+ * information from the {@link Agentica} class. And you can get the
6
+ * token usage information by calling the {@link Agentica.getTokenUsage}
7
+ * method.
8
+ *
9
+ * For reference, `IAgenticaTokenUsage` provides only the token usage
10
+ * information, and does not contain any price or cost information. It is
11
+ * because the price or cost can be changed by below reasons.
12
+ *
13
+ * - Type of {@link IAgenticaProps.provider LLM provider}
14
+ * - {@link IAgenticaProvider.model} in the LLM provider.
15
+ * - Just by a policy change of the LLM provider company.
16
+ *
17
+ * @author Samchon
18
+ */
19
+ export interface IAgenticaTokenUsage {
20
+ /**
21
+ * Aggregated token usage.
22
+ */
23
+ aggregate: IAgenticaTokenUsage.IComponent;
24
+
25
+ /**
26
+ * Token uasge of initializer agent.
27
+ */
28
+ initialize: IAgenticaTokenUsage.IComponent;
29
+
30
+ /**
31
+ * Token usage of function selector agent.
32
+ */
33
+ select: IAgenticaTokenUsage.IComponent;
34
+
35
+ /**
36
+ * Token usage of function canceler agent.
37
+ */
38
+ cancel: IAgenticaTokenUsage.IComponent;
39
+
40
+ /**
41
+ * Token usage of function caller agent.
42
+ */
43
+ call: IAgenticaTokenUsage.IComponent;
44
+
45
+ /**
46
+ * Token usage of function calling describer agent.
47
+ */
48
+ describe: IAgenticaTokenUsage.IComponent;
49
+ }
50
+ export namespace IAgenticaTokenUsage {
51
+ export interface IComponent {
52
+ /**
53
+ * Total token usage.
54
+ */
55
+ total: number;
56
+
57
+ /**
58
+ * Input token usage of detailed.
59
+ */
60
+ input: IInput;
61
+
62
+ /**
63
+ * Output token usage of detailed.
64
+ */
65
+ output: IOutput;
66
+ }
67
+
68
+ /**
69
+ * Input token usage of detailed.
70
+ */
71
+ export interface IInput {
72
+ /**
73
+ * Total amount of input token uasge.
74
+ */
75
+ total: number;
76
+
77
+ /**
78
+ * Cached token usage.
79
+ */
80
+ cached: number;
81
+ }
82
+
83
+ /**
84
+ * Output token usage of detailed.
85
+ */
86
+ export interface IOutput {
87
+ /**
88
+ * Total amount of output token usage.
89
+ */
90
+ total: number;
91
+
92
+ /**
93
+ * Reasoning token usage.
94
+ */
95
+ reasoning: number;
96
+
97
+ /**
98
+ * Prediction token usage.
99
+ */
100
+ accepted_prediction: number;
101
+
102
+ /**
103
+ * Rejected prediction token usage.
104
+ */
105
+ rejected_prediction: number;
106
+ }
107
+ }
@@ -1,23 +1,23 @@
1
- import { __IChatFunctionReference } from "./__IChatFunctionReference";
2
-
3
- export interface __IChatCancelFunctionsApplication {
4
- /**
5
- * Cancel a function from the candidate list to call.
6
- *
7
- * If you A.I. agent has understood that the user wants to cancel
8
- * some candidate functions to call from the conversation, please cancel
9
- * them through this function.
10
- *
11
- * Also, when you A.I. find a function that has been selected by the candidate
12
- * pooling, cancel the function by calling this function. For reference, the
13
- * candidate pooling means that user wants only one function to call, but you A.I.
14
- * agent selects multiple candidate functions because the A.I. agent can't specify
15
- * only one thing due to lack of specificity or homogeneity of candidate functions.
16
- *
17
- * Additionally, if you A.I. agent wants to cancel same function multiply, you can
18
- * do it by assigning the same function name multiply in the `functions` property.
19
- *
20
- * @param props Properties of the function
21
- */
22
- cancelFunctions(props: __IChatFunctionReference.IProps): Promise<void>;
23
- }
1
+ import { __IChatFunctionReference } from "./__IChatFunctionReference";
2
+
3
+ export interface __IChatCancelFunctionsApplication {
4
+ /**
5
+ * Cancel a function from the candidate list to call.
6
+ *
7
+ * If you A.I. agent has understood that the user wants to cancel
8
+ * some candidate functions to call from the conversation, please cancel
9
+ * them through this function.
10
+ *
11
+ * Also, when you A.I. find a function that has been selected by the candidate
12
+ * pooling, cancel the function by calling this function. For reference, the
13
+ * candidate pooling means that user wants only one function to call, but you A.I.
14
+ * agent selects multiple candidate functions because the A.I. agent can't specify
15
+ * only one thing due to lack of specificity or homogeneity of candidate functions.
16
+ *
17
+ * Additionally, if you A.I. agent wants to cancel same function multiply, you can
18
+ * do it by assigning the same function name multiply in the `functions` property.
19
+ *
20
+ * @param props Properties of the function
21
+ */
22
+ cancelFunctions(props: __IChatFunctionReference.IProps): Promise<void>;
23
+ }
@@ -1,21 +1,21 @@
1
- export interface __IChatFunctionReference {
2
- /**
3
- * The reason of the function selection.
4
- *
5
- * Just write the reason why you've determined to select this function.
6
- */
7
- reason: string;
8
-
9
- /**
10
- * Name of the target function to call.
11
- */
12
- name: string;
13
- }
14
- export namespace __IChatFunctionReference {
15
- export interface IProps {
16
- /**
17
- * List of target functions.
18
- */
19
- functions: __IChatFunctionReference[];
20
- }
21
- }
1
+ export interface __IChatFunctionReference {
2
+ /**
3
+ * The reason of the function selection.
4
+ *
5
+ * Just write the reason why you've determined to select this function.
6
+ */
7
+ reason: string;
8
+
9
+ /**
10
+ * Name of the target function to call.
11
+ */
12
+ name: string;
13
+ }
14
+ export namespace __IChatFunctionReference {
15
+ export interface IProps {
16
+ /**
17
+ * List of target functions.
18
+ */
19
+ functions: __IChatFunctionReference[];
20
+ }
21
+ }