@agentica/rpc 0.10.3 → 0.11.0

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/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  RPC module of Agentica for WebSocket Communication
10
10
 
11
- Agentica is the simplest Agentiic AI library specialized in **LLM Function Calling**, and `@agentica/rpc` is an RPC (Remote Procedure Call) wrapper module. If you combine the RPC wrapper module with [`TGrid`](https://github.com/samchon/tgrid), you can develop the WebSocket AI Chatbot.
11
+ Agentica is the simplest Agentic AI library specialized in **LLM Function Calling**, and `@agentica/rpc` is an RPC (Remote Procedure Call) wrapper module. If you combine the RPC wrapper module with [`TGrid`](https://github.com/samchon/tgrid), you can develop the WebSocket AI Chatbot.
12
12
 
13
13
  ```typescript
14
14
  import { IAgenticaRpcListener, IAgenticaRpcService } from "@agentica/rpc";
@@ -75,6 +75,6 @@ export declare namespace AgenticaRpcService {
75
75
  /**
76
76
  * Listener to be binded on the agent.
77
77
  */
78
- listener: IAgenticaRpcListener<Model>;
78
+ listener: IAgenticaRpcListener;
79
79
  }
80
80
  }
@@ -63,15 +63,17 @@ class AgenticaRpcService {
63
63
  this.props = props;
64
64
  const { agent, listener } = props;
65
65
  // ESSENTIAL LISTENERS
66
- agent.on("text", (evt) => listener.text(primitive(evt)));
67
- agent.on("describe", (evt) => listener.describe(primitive(evt)));
66
+ agent.on("text", (evt) => __awaiter(this, void 0, void 0, function* () { return listener.text(Object.assign(primitive(evt), { text: yield evt.join() })); }));
67
+ agent.on("describe", (evt) => __awaiter(this, void 0, void 0, function* () {
68
+ return listener.describe(Object.assign(primitive(evt), { text: yield evt.join() }));
69
+ }));
68
70
  // OPTIONAL LISTENERS
69
71
  agent.on("initialize", (evt) => listener.initialize(primitive(evt)));
70
72
  agent.on("select", (evt) => listener.select(primitive(evt)));
71
73
  agent.on("cancel", (evt) => listener.cancel(primitive(evt)));
72
74
  agent.on("call", (evt) => __awaiter(this, void 0, void 0, function* () {
73
75
  const args = yield listener.call(primitive(evt));
74
- if (!!args)
76
+ if (args)
75
77
  evt.arguments = args;
76
78
  }));
77
79
  agent.on("execute", (evt) => listener.execute(primitive(evt)));
@@ -1 +1 @@
1
- {"version":3,"file":"AgenticaRpcService.js","sourceRoot":"","sources":["../src/AgenticaRpcService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAa,kBAAkB;IAG7B;;;;OAIG;IACH,YAAoC,KAAuC;QAAvC,UAAK,GAAL,KAAK,CAAkC;QACzE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;QAElC,sBAAsB;QACtB,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACzD,KAAK,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAEjE,qBAAqB;QACrB,KAAK,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAW,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACtE,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9D,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9D,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAO,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Ae;;YACrC,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAC7C,CAAC;KAAA;IAED;;OAEG;IACU,cAAc;;YAGzB,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,EAEM,CAAC;QAC/C,CAAC;KAAA;CACF;AAnDD,gDAmDC;AAkBD;;GAEG;AACH,MAAM,SAAS,GAAG,CAAI,GAAM,EAAgB,EAAE,CAC5C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAiB,CAAC"}
@@ -1,5 +1,4 @@
1
- import { IAgenticaEvent } from "@agentica/core";
2
- import { ILlmSchema } from "@samchon/openapi";
1
+ import { IAgenticaEventJson } from "@agentica/core";
3
2
  import { Primitive } from "typia";
4
3
  /**
5
4
  * RPC interface of AI agent listener.
@@ -8,7 +7,7 @@ import { Primitive } from "typia";
8
7
  * provided from the client to server through the RPC (Remote Procedure Call)
9
8
  * paradigm in the websocket protocol.
10
9
  *
11
- * It has defined the event listener functions of {@link IAgenticaEvent}
10
+ * It has defined the event listener functions of {@link AgenticaEvent}
12
11
  * types. If you skip some event typed functions' implementations,
13
12
  * the skipped event would be ignored.
14
13
  *
@@ -43,7 +42,7 @@ import { Primitive } from "typia";
43
42
  *
44
43
  * @author Samchon
45
44
  */
46
- export interface IAgenticaRpcListener<Model extends ILlmSchema.Model> {
45
+ export interface IAgenticaRpcListener {
47
46
  /**
48
47
  * Describe the function executions' results.
49
48
  *
@@ -52,13 +51,17 @@ export interface IAgenticaRpcListener<Model extends ILlmSchema.Model> {
52
51
  *
53
52
  * @param evt Event of a description of function execution results
54
53
  */
55
- describe(evt: Primitive<IAgenticaEvent.IDescribe<Model>>): Promise<void>;
54
+ describe(evt: Primitive<IAgenticaEventJson.IDescribe> & {
55
+ text: string;
56
+ }): Promise<void>;
56
57
  /**
57
58
  * Text conversation message.
58
59
  *
59
60
  * @param evt Event of a text conversation message
60
61
  */
61
- text(evt: IAgenticaEvent.IText): Promise<void>;
62
+ text(evt: Primitive<IAgenticaEventJson.IText> & {
63
+ text: string;
64
+ }): Promise<void>;
62
65
  /**
63
66
  * Initialize the AI agent.
64
67
  *
@@ -67,7 +70,7 @@ export interface IAgenticaRpcListener<Model extends ILlmSchema.Model> {
67
70
  *
68
71
  * @param evt Event of initialization
69
72
  */
70
- initialize?(evt: IAgenticaEvent.IInitialize): Promise<void>;
73
+ initialize?(evt: IAgenticaEventJson.IInitialize): Promise<void>;
71
74
  /**
72
75
  * Select a function to call.
73
76
  *
@@ -75,7 +78,7 @@ export interface IAgenticaRpcListener<Model extends ILlmSchema.Model> {
75
78
  *
76
79
  * @param evt Event of selecting a function to call
77
80
  */
78
- select?(evt: Primitive<IAgenticaEvent.ISelect<Model>>): Promise<void>;
81
+ select?(evt: Primitive<IAgenticaEventJson.ISelect>): Promise<void>;
79
82
  /**
80
83
  * Cancel a function to call.
81
84
  *
@@ -83,14 +86,14 @@ export interface IAgenticaRpcListener<Model extends ILlmSchema.Model> {
83
86
  *
84
87
  * @param evt Event of canceling a function to call
85
88
  */
86
- cancel?(evt: Primitive<IAgenticaEvent.ICancel<Model>>): Promise<void>;
89
+ cancel?(evt: Primitive<IAgenticaEventJson.ICancel>): Promise<void>;
87
90
  /**
88
91
  * Call a function.
89
92
  *
90
93
  * Informs a function calling from the AI agent server to client.
91
94
  *
92
95
  * This event comes before the function execution, so that if you return
93
- * a different value from the original {@link IAgenticaEvent.ICall.arguments},
96
+ * a different value from the original {@link IAgenticaEventJson.ICall.arguments},
94
97
  * you can modify the arguments of the function calling.
95
98
  *
96
99
  * Otherwise you do not return anything (`undefined`) or `null` value, the
@@ -101,7 +104,7 @@ export interface IAgenticaRpcListener<Model extends ILlmSchema.Model> {
101
104
  * @param evt Event of a function calling
102
105
  * @return New arguments if you want to modify, otherwise null or undefined
103
106
  */
104
- call?(evt: Primitive<IAgenticaEvent.ICall<Model>>): Promise<object | null | undefined>;
107
+ call?(evt: Primitive<IAgenticaEventJson.ICall>): Promise<object | null | undefined>;
105
108
  /**
106
109
  * Executition of a function.
107
110
  *
@@ -109,5 +112,5 @@ export interface IAgenticaRpcListener<Model extends ILlmSchema.Model> {
109
112
  *
110
113
  * @param evt Event of a function execution
111
114
  */
112
- execute?(evt: IAgenticaEvent.IExecute<Model>): Promise<void>;
115
+ execute?(evt: IAgenticaEventJson.IExecute): Promise<void>;
113
116
  }
package/lib/index.mjs CHANGED
@@ -2,14 +2,18 @@ class AgenticaRpcService {
2
2
  constructor(props) {
3
3
  this.props = props;
4
4
  const {agent, listener} = props;
5
- agent.on("text", (evt => listener.text(primitive(evt))));
6
- agent.on("describe", (evt => listener.describe(primitive(evt))));
5
+ agent.on("text", (async evt => listener.text(Object.assign(primitive(evt), {
6
+ text: await evt.join()
7
+ }))));
8
+ agent.on("describe", (async evt => listener.describe(Object.assign(primitive(evt), {
9
+ text: await evt.join()
10
+ }))));
7
11
  agent.on("initialize", (evt => listener.initialize(primitive(evt))));
8
12
  agent.on("select", (evt => listener.select(primitive(evt))));
9
13
  agent.on("cancel", (evt => listener.cancel(primitive(evt))));
10
14
  agent.on("call", (async evt => {
11
15
  const args = await listener.call(primitive(evt));
12
- if (!!args) evt.arguments = args;
16
+ if (args) evt.arguments = args;
13
17
  }));
14
18
  agent.on("execute", (evt => listener.execute(primitive(evt))));
15
19
  }
package/lib/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../src/AgenticaRpcService.ts"],"sourcesContent":[null],"names":["AgenticaRpcService","constructor","props","this","agent","listener","on","evt","text","primitive","describe","initialize","select","cancel","async","args","call","arguments","execute","conversate","content","getControllers","obj","JSON","parse","stringify"],"mappings":"MAkDaA;IAQX,WAAAC,CAAoCC;QAAAC,KAAKD,QAALA;QAClC,OAAME,OAAOC,YAAeH;QAG5BE,MAAME,GAAG,SAASC,OAAQF,SAASG,KAAKC,UAAUF;QAClDH,MAAME,GAAG,aAAaC,OAAQF,SAASK,SAASD,UAAUF;QAG1DH,MAAME,GAAG,eAAeC,OAAQF,SAASM,WAAYF,UAAUF;QAC/DH,MAAME,GAAG,WAAWC,OAAQF,SAASO,OAAQH,UAAUF;QACvDH,MAAME,GAAG,WAAWC,OAAQF,SAASQ,OAAQJ,UAAUF;QACvDH,MAAME,GAAG,SAAQQ,MAAOP;YACtB,MAAMQ,aAAwCV,SAASW,KACrDP,UAAUF;YAEZ,MAAMQ,MAAMR,IAAIU,YAAYF;AAAI;QAElCX,MAAME,GAAG,YAAYC,OAAQF,SAASa,QAAST,UAAUF;;IAMpD,gBAAMY,CAAWC;cAChBjB,KAAKD,MAAME,MAAMe,WAAWC;;IAM7B,oBAAMC;QAGX,OAAOlB,KAAKD,MAAME,MAAMiB;;;;AAyB5B,MAAMZ,YAAgBa,OACpBC,KAAKC,MAAMD,KAAKE,UAAUH;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../src/AgenticaRpcService.ts"],"sourcesContent":[null],"names":["AgenticaRpcService","constructor","props","this","agent","listener","on","async","evt","text","Object","assign","primitive","join","describe","initialize","select","cancel","args","call","arguments","execute","conversate","content","getControllers","obj","JSON","parse","stringify"],"mappings":"MAkDaA;IAQX,WAAAC,CAAoCC;QAAAC,KAAKD,QAALA;QAClC,OAAME,OAAOC,YAAeH;QAG5BE,MAAME,GAAG,SAAQC,MAAOC,OACtBH,SAASI,KAAKC,OAAOC,OAAOC,UAAUJ,MAAM;YAAEC,YAAYD,IAAIK;;QAEhET,MAAME,GAAG,aAAYC,MAAOC,OAC1BH,SAASS,SACPJ,OAAOC,OAAOC,UAAUJ,MAAM;YAAEC,YAAYD,IAAIK;;QAKpDT,MAAME,GAAG,eAAeE,OAAQH,SAASU,WAAYH,UAAUJ;QAC/DJ,MAAME,GAAG,WAAWE,OAAQH,SAASW,OAAQJ,UAAUJ;QACvDJ,MAAME,GAAG,WAAWE,OAAQH,SAASY,OAAQL,UAAUJ;QACvDJ,MAAME,GAAG,SAAQC,MAAOC;YACtB,MAAMU,aAAwCb,SAASc,KACrDP,UAAUJ;YAEZ,IAAIU,MAAMV,IAAIY,YAAYF;AAAI;QAEhCd,MAAME,GAAG,YAAYE,OAAQH,SAASgB,QAAST,UAAUJ;;IAMpD,gBAAMc,CAAWC;cAChBpB,KAAKD,MAAME,MAAMkB,WAAWC;;IAM7B,oBAAMC;QAGX,OAAOrB,KAAKD,MAAME,MAAMoB;;;;AAyB5B,MAAMZ,YAAgBa,OACpBC,KAAKC,MAAMD,KAAKE,UAAUH;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentica/rpc",
3
- "version": "0.10.3",
3
+ "version": "0.11.0",
4
4
  "main": "lib/index.js",
5
5
  "description": "Agentic AI Library specialized in LLM Function Calling",
6
6
  "scripts": {
@@ -37,9 +37,8 @@
37
37
  "src"
38
38
  ],
39
39
  "dependencies": {
40
- "@agentica/core": "^0.10.3",
40
+ "@agentica/core": "^0.11.0",
41
41
  "@samchon/openapi": "^3.0.0",
42
- "@samchon/shopping-api": "^0.15.0",
43
42
  "chalk": "4.1.2",
44
43
  "openai": "^4.80.0",
45
44
  "tstl": "^3.0.0",
@@ -48,6 +47,7 @@
48
47
  "devDependencies": {
49
48
  "@rollup/plugin-terser": "^0.4.4",
50
49
  "@rollup/plugin-typescript": "^12.1.2",
50
+ "@samchon/shopping-api": "^0.16.0",
51
51
  "@types/node": "^22.13.4",
52
52
  "rimraf": "^6.0.1",
53
53
  "rollup": "^4.34.8",
@@ -60,8 +60,14 @@ export class AgenticaRpcService<Model extends ILlmSchema.Model>
60
60
  const { agent, listener } = props;
61
61
 
62
62
  // ESSENTIAL LISTENERS
63
- agent.on("text", (evt) => listener.text(primitive(evt)));
64
- agent.on("describe", (evt) => listener.describe(primitive(evt)));
63
+ agent.on("text", async (evt) =>
64
+ listener.text(Object.assign(primitive(evt), { text: await evt.join() })),
65
+ );
66
+ agent.on("describe", async (evt) =>
67
+ listener.describe(
68
+ Object.assign(primitive(evt), { text: await evt.join() }),
69
+ ),
70
+ );
65
71
 
66
72
  // OPTIONAL LISTENERS
67
73
  agent.on("initialize", (evt) => listener.initialize!(primitive(evt)));
@@ -71,7 +77,7 @@ export class AgenticaRpcService<Model extends ILlmSchema.Model>
71
77
  const args: object | null | undefined = await listener.call!(
72
78
  primitive(evt),
73
79
  );
74
- if (!!args) evt.arguments = args;
80
+ if (args) evt.arguments = args;
75
81
  });
76
82
  agent.on("execute", (evt) => listener.execute!(primitive(evt as any)));
77
83
  }
@@ -107,7 +113,7 @@ export namespace AgenticaRpcService {
107
113
  /**
108
114
  * Listener to be binded on the agent.
109
115
  */
110
- listener: IAgenticaRpcListener<Model>;
116
+ listener: IAgenticaRpcListener;
111
117
  }
112
118
  }
113
119
 
@@ -1,5 +1,4 @@
1
- import { IAgenticaEvent } from "@agentica/core";
2
- import { ILlmSchema } from "@samchon/openapi";
1
+ import { IAgenticaEventJson } from "@agentica/core";
3
2
  import { Primitive } from "typia";
4
3
 
5
4
  /**
@@ -9,7 +8,7 @@ import { Primitive } from "typia";
9
8
  * provided from the client to server through the RPC (Remote Procedure Call)
10
9
  * paradigm in the websocket protocol.
11
10
  *
12
- * It has defined the event listener functions of {@link IAgenticaEvent}
11
+ * It has defined the event listener functions of {@link AgenticaEvent}
13
12
  * types. If you skip some event typed functions' implementations,
14
13
  * the skipped event would be ignored.
15
14
  *
@@ -44,7 +43,7 @@ import { Primitive } from "typia";
44
43
  *
45
44
  * @author Samchon
46
45
  */
47
- export interface IAgenticaRpcListener<Model extends ILlmSchema.Model> {
46
+ export interface IAgenticaRpcListener {
48
47
  /**
49
48
  * Describe the function executions' results.
50
49
  *
@@ -53,14 +52,18 @@ export interface IAgenticaRpcListener<Model extends ILlmSchema.Model> {
53
52
  *
54
53
  * @param evt Event of a description of function execution results
55
54
  */
56
- describe(evt: Primitive<IAgenticaEvent.IDescribe<Model>>): Promise<void>;
55
+ describe(
56
+ evt: Primitive<IAgenticaEventJson.IDescribe> & { text: string },
57
+ ): Promise<void>;
57
58
 
58
59
  /**
59
60
  * Text conversation message.
60
61
  *
61
62
  * @param evt Event of a text conversation message
62
63
  */
63
- text(evt: IAgenticaEvent.IText): Promise<void>;
64
+ text(
65
+ evt: Primitive<IAgenticaEventJson.IText> & { text: string },
66
+ ): Promise<void>;
64
67
 
65
68
  /**
66
69
  * Initialize the AI agent.
@@ -70,7 +73,7 @@ export interface IAgenticaRpcListener<Model extends ILlmSchema.Model> {
70
73
  *
71
74
  * @param evt Event of initialization
72
75
  */
73
- initialize?(evt: IAgenticaEvent.IInitialize): Promise<void>;
76
+ initialize?(evt: IAgenticaEventJson.IInitialize): Promise<void>;
74
77
 
75
78
  /**
76
79
  * Select a function to call.
@@ -79,7 +82,7 @@ export interface IAgenticaRpcListener<Model extends ILlmSchema.Model> {
79
82
  *
80
83
  * @param evt Event of selecting a function to call
81
84
  */
82
- select?(evt: Primitive<IAgenticaEvent.ISelect<Model>>): Promise<void>;
85
+ select?(evt: Primitive<IAgenticaEventJson.ISelect>): Promise<void>;
83
86
 
84
87
  /**
85
88
  * Cancel a function to call.
@@ -88,7 +91,7 @@ export interface IAgenticaRpcListener<Model extends ILlmSchema.Model> {
88
91
  *
89
92
  * @param evt Event of canceling a function to call
90
93
  */
91
- cancel?(evt: Primitive<IAgenticaEvent.ICancel<Model>>): Promise<void>;
94
+ cancel?(evt: Primitive<IAgenticaEventJson.ICancel>): Promise<void>;
92
95
 
93
96
  /**
94
97
  * Call a function.
@@ -96,7 +99,7 @@ export interface IAgenticaRpcListener<Model extends ILlmSchema.Model> {
96
99
  * Informs a function calling from the AI agent server to client.
97
100
  *
98
101
  * This event comes before the function execution, so that if you return
99
- * a different value from the original {@link IAgenticaEvent.ICall.arguments},
102
+ * a different value from the original {@link IAgenticaEventJson.ICall.arguments},
100
103
  * you can modify the arguments of the function calling.
101
104
  *
102
105
  * Otherwise you do not return anything (`undefined`) or `null` value, the
@@ -108,7 +111,7 @@ export interface IAgenticaRpcListener<Model extends ILlmSchema.Model> {
108
111
  * @return New arguments if you want to modify, otherwise null or undefined
109
112
  */
110
113
  call?(
111
- evt: Primitive<IAgenticaEvent.ICall<Model>>,
114
+ evt: Primitive<IAgenticaEventJson.ICall>,
112
115
  ): Promise<object | null | undefined>;
113
116
 
114
117
  /**
@@ -118,5 +121,5 @@ export interface IAgenticaRpcListener<Model extends ILlmSchema.Model> {
118
121
  *
119
122
  * @param evt Event of a function execution
120
123
  */
121
- execute?(evt: IAgenticaEvent.IExecute<Model>): Promise<void>;
124
+ execute?(evt: IAgenticaEventJson.IExecute): Promise<void>;
122
125
  }