@agentica/core 0.8.3-dev.20250227 → 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 (71) hide show
  1. package/README.md +25 -10
  2. package/lib/Agentica.d.ts +10 -9
  3. package/lib/Agentica.js.map +1 -1
  4. package/lib/chatgpt/ChatGptAgent.d.ts +2 -1
  5. package/lib/chatgpt/ChatGptAgent.js.map +1 -1
  6. package/lib/chatgpt/ChatGptCallFunctionAgent.d.ts +2 -1
  7. package/lib/chatgpt/ChatGptCallFunctionAgent.js +3 -1
  8. package/lib/chatgpt/ChatGptCallFunctionAgent.js.map +1 -1
  9. package/lib/chatgpt/ChatGptCancelFunctionAgent.d.ts +3 -2
  10. package/lib/chatgpt/ChatGptCancelFunctionAgent.js +55 -2
  11. package/lib/chatgpt/ChatGptCancelFunctionAgent.js.map +1 -1
  12. package/lib/chatgpt/ChatGptDescribeFunctionAgent.d.ts +2 -1
  13. package/lib/chatgpt/ChatGptDescribeFunctionAgent.js.map +1 -1
  14. package/lib/chatgpt/ChatGptHistoryDecoder.d.ts +2 -1
  15. package/lib/chatgpt/ChatGptHistoryDecoder.js.map +1 -1
  16. package/lib/chatgpt/ChatGptInitializeFunctionAgent.d.ts +2 -1
  17. package/lib/chatgpt/ChatGptInitializeFunctionAgent.js +63 -1
  18. package/lib/chatgpt/ChatGptInitializeFunctionAgent.js.map +1 -1
  19. package/lib/chatgpt/ChatGptSelectFunctionAgent.d.ts +2 -1
  20. package/lib/chatgpt/ChatGptSelectFunctionAgent.js +55 -2
  21. package/lib/chatgpt/ChatGptSelectFunctionAgent.js.map +1 -1
  22. package/lib/functional/createHttpLlmApplication.js +826 -798
  23. package/lib/functional/createHttpLlmApplication.js.map +1 -1
  24. package/lib/index.mjs +987 -804
  25. package/lib/index.mjs.map +1 -1
  26. package/lib/internal/AgenticaDefaultPrompt.d.ts +2 -1
  27. package/lib/internal/AgenticaDefaultPrompt.js.map +1 -1
  28. package/lib/internal/AgenticaOperationComposer.d.ts +5 -4
  29. package/lib/internal/AgenticaOperationComposer.js +1 -1
  30. package/lib/internal/AgenticaOperationComposer.js.map +1 -1
  31. package/lib/internal/AgenticaPromptFactory.d.ts +3 -2
  32. package/lib/internal/AgenticaPromptFactory.js.map +1 -1
  33. package/lib/internal/AgenticaPromptTransformer.d.ts +5 -4
  34. package/lib/internal/AgenticaPromptTransformer.js.map +1 -1
  35. package/lib/structures/IAgenticaConfig.d.ts +4 -3
  36. package/lib/structures/IAgenticaContext.d.ts +7 -6
  37. package/lib/structures/IAgenticaController.d.ts +8 -8
  38. package/lib/structures/IAgenticaEvent.d.ts +19 -18
  39. package/lib/structures/IAgenticaExecutor.d.ts +7 -6
  40. package/lib/structures/IAgenticaOperation.d.ts +4 -4
  41. package/lib/structures/IAgenticaOperationCollection.d.ts +6 -5
  42. package/lib/structures/IAgenticaOperationSelection.d.ts +4 -4
  43. package/lib/structures/IAgenticaPrompt.d.ts +11 -11
  44. package/lib/structures/IAgenticaProps.d.ts +9 -4
  45. package/lib/structures/IAgenticaProvider.d.ts +22 -27
  46. package/lib/structures/IAgenticaSystemPrompt.d.ts +8 -7
  47. package/package.json +6 -9
  48. package/src/Agentica.ts +24 -19
  49. package/src/chatgpt/ChatGptAgent.ts +9 -5
  50. package/src/chatgpt/ChatGptCallFunctionAgent.ts +25 -22
  51. package/src/chatgpt/ChatGptCancelFunctionAgent.ts +26 -22
  52. package/src/chatgpt/ChatGptDescribeFunctionAgent.ts +7 -6
  53. package/src/chatgpt/ChatGptHistoryDecoder.ts +3 -2
  54. package/src/chatgpt/ChatGptInitializeFunctionAgent.ts +5 -5
  55. package/src/chatgpt/ChatGptSelectFunctionAgent.ts +33 -32
  56. package/src/internal/AgenticaDefaultPrompt.ts +5 -1
  57. package/src/internal/AgenticaOperationComposer.ts +20 -15
  58. package/src/internal/AgenticaPromptFactory.ts +10 -8
  59. package/src/internal/AgenticaPromptTransformer.ts +19 -16
  60. package/src/structures/IAgenticaConfig.ts +6 -4
  61. package/src/structures/IAgenticaContext.ts +7 -6
  62. package/src/structures/IAgenticaController.ts +12 -10
  63. package/src/structures/IAgenticaEvent.ts +28 -23
  64. package/src/structures/IAgenticaExecutor.ts +12 -8
  65. package/src/structures/IAgenticaOperation.ts +10 -10
  66. package/src/structures/IAgenticaOperationCollection.ts +7 -5
  67. package/src/structures/IAgenticaOperationSelection.ts +10 -10
  68. package/src/structures/IAgenticaPrompt.ts +24 -19
  69. package/src/structures/IAgenticaProps.ts +10 -4
  70. package/src/structures/IAgenticaProvider.ts +22 -28
  71. package/src/structures/IAgenticaSystemPrompt.ts +9 -7
@@ -1,3 +1,4 @@
1
+ import { ILlmSchema } from "@samchon/openapi";
1
2
  import { Primitive } from "typia";
2
3
 
3
4
  import { IAgenticaConfig } from "./IAgenticaConfig";
@@ -26,7 +27,12 @@ import { IAgenticaProvider } from "./IAgenticaProvider";
26
27
  *
27
28
  * @author Samchon
28
29
  */
29
- export interface IAgenticaProps {
30
+ export interface IAgenticaProps<Model extends ILlmSchema.Model> {
31
+ /**
32
+ * LLM schema model.
33
+ */
34
+ model: Model;
35
+
30
36
  /**
31
37
  * LLM service provider.
32
38
  */
@@ -35,7 +41,7 @@ export interface IAgenticaProps {
35
41
  /**
36
42
  * Controllers serving functions to call.
37
43
  */
38
- controllers: IAgenticaController[];
44
+ controllers: IAgenticaController<Model>[];
39
45
 
40
46
  /**
41
47
  * Configuration of agent.
@@ -52,7 +58,7 @@ export interface IAgenticaProps {
52
58
  * - `systemPrompt`: default prompts written in markdown
53
59
  * - https://github.com/samchon/nestia/tree/master/packages/agent/prompts
54
60
  */
55
- config?: IAgenticaConfig;
61
+ config?: IAgenticaConfig<Model>;
56
62
 
57
63
  /**
58
64
  * Prompt histories.
@@ -60,5 +66,5 @@ export interface IAgenticaProps {
60
66
  * If you're starting the conversation from an existing session,
61
67
  * assign the previouis prompt histories to this property.
62
68
  */
63
- histories?: Primitive<IAgenticaPrompt>[];
69
+ histories?: Primitive<IAgenticaPrompt<Model>>[];
64
70
  }
@@ -6,40 +6,34 @@ import OpenAI from "openai";
6
6
  * `IAgenticaProvider` is a type represents an LLM
7
7
  * (Large Language Model) provider of the {@link Agentica}.
8
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.
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.
13
14
  *
14
- * If you want to use another LLM provider like Claude or Gemini,
15
- * please write an issue or contribute to `nestia` please.
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".
16
19
  *
17
20
  * @author Samchon
18
21
  */
19
- export type IAgenticaProvider = IAgenticaProvider.IChatGpt;
20
- export namespace IAgenticaProvider {
22
+ export interface IAgenticaProvider {
21
23
  /**
22
- * OpenAI provider.
24
+ * OpenAI API instance.
23
25
  */
24
- export interface IChatGpt {
25
- /**
26
- * Discriminator type.
27
- */
28
- type: "chatgpt";
26
+ api: OpenAI;
29
27
 
30
- /**
31
- * OpenAI API instance.
32
- */
33
- api: OpenAI;
34
-
35
- /**
36
- * Chat model to be used.
37
- */
38
- model: OpenAI.ChatModel;
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);
39
34
 
40
- /**
41
- * Options for the request.
42
- */
43
- options?: OpenAI.RequestOptions | undefined;
44
- }
35
+ /**
36
+ * Options for the request.
37
+ */
38
+ options?: OpenAI.RequestOptions | undefined;
45
39
  }
@@ -1,3 +1,5 @@
1
+ import { ILlmSchema } from "@samchon/openapi";
2
+
1
3
  import { IAgenticaConfig } from "./IAgenticaConfig";
2
4
  import { IAgenticaPrompt } from "./IAgenticaPrompt";
3
5
 
@@ -19,7 +21,7 @@ import { IAgenticaPrompt } from "./IAgenticaPrompt";
19
21
  *
20
22
  * @author Samchon
21
23
  */
22
- export interface IAgenticaSystemPrompt {
24
+ export interface IAgenticaSystemPrompt<Model extends ILlmSchema.Model> {
23
25
  /**
24
26
  * Common system prompt that would be used in every situation.
25
27
  *
@@ -27,7 +29,7 @@ export interface IAgenticaSystemPrompt {
27
29
  * @returns The common system prompt
28
30
  * @default https://github.com/samchon/nestia/blob/master/packages/agent/prompts/common.md
29
31
  */
30
- common?: (config?: IAgenticaConfig | undefined) => string;
32
+ common?: (config?: IAgenticaConfig<Model> | undefined) => string;
31
33
 
32
34
  /**
33
35
  * Initialize system prompt.
@@ -45,7 +47,7 @@ export interface IAgenticaSystemPrompt {
45
47
  * @returns initialize system prompt
46
48
  * @default https://github.com/samchon/nestia/blob/master/packages/agent/prompts/initialize.md
47
49
  */
48
- initialize?: (histories: IAgenticaPrompt[]) => string;
50
+ initialize?: (histories: IAgenticaPrompt<Model>[]) => string;
49
51
 
50
52
  /**
51
53
  * Select system prompt.
@@ -66,7 +68,7 @@ export interface IAgenticaSystemPrompt {
66
68
  * @returns select system promopt
67
69
  * @default https://github.com/samchon/nestia/blob/master/packages/agent/prompts/select.md
68
70
  */
69
- select?: (histories: IAgenticaPrompt[]) => string;
71
+ select?: (histories: IAgenticaPrompt<Model>[]) => string;
70
72
 
71
73
  /**
72
74
  * Cancel system prompt.
@@ -83,7 +85,7 @@ export interface IAgenticaSystemPrompt {
83
85
  * @returns cancel system prompt
84
86
  * @default https://github.com/samchon/nestia/blob/master/packages/agent/prompts/cancel.md
85
87
  */
86
- cancel?: (histories: IAgenticaPrompt[]) => string;
88
+ cancel?: (histories: IAgenticaPrompt<Model>[]) => string;
87
89
 
88
90
  /**
89
91
  * Execute system prompt.
@@ -101,7 +103,7 @@ export interface IAgenticaSystemPrompt {
101
103
  * @returns execute system prompt
102
104
  * https://github.com/samchon/nestia/blob/master/packages/agent/prompts/execute.md
103
105
  */
104
- execute?: (histories: IAgenticaPrompt[]) => string;
106
+ execute?: (histories: IAgenticaPrompt<Model>[]) => string;
105
107
 
106
108
  /**
107
109
  * Describe system prompt.
@@ -118,5 +120,5 @@ export interface IAgenticaSystemPrompt {
118
120
  * @returns describe system prompt
119
121
  * @default https://github.com/samchon/nestia/blob/master/packages/agent/prompts/describe.md
120
122
  */
121
- describe?: (histories: IAgenticaPrompt.IExecute[]) => string;
123
+ describe?: (histories: IAgenticaPrompt.IExecute<Model>[]) => string;
122
124
  }