@receptron/graphai_express 0.0.5 → 0.0.6
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 +6 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,19 +12,21 @@ yarn add @receptron/graphai_express
|
|
|
12
12
|
```TypeScript
|
|
13
13
|
|
|
14
14
|
import express from "express";
|
|
15
|
+
import * as agents from "graphai/lib/experimental_agents";
|
|
15
16
|
import { agentDispatcher, streamAgentDispatcher, agentsList, agentDoc } from "@receptron/graphai_express";
|
|
16
17
|
|
|
18
|
+
const agentDictionary: AgentFunctionInfoDictionary = agents;
|
|
17
19
|
const hostName = "https://example.net";
|
|
18
20
|
const apiPrefix = "/api/agents";
|
|
19
21
|
|
|
20
|
-
app.get(apiPrefix + "/:agentId", agentDoc(hostName, apiPrefix)); // each API(agent) document
|
|
21
|
-
app.get(apiPrefix + "/", agentsList(hostName, apiPrefix)); // API(agent) list
|
|
22
|
+
app.get(apiPrefix + "/:agentId", agentDoc(agentDictionary, hostName, apiPrefix)); // each API(agent) document
|
|
23
|
+
app.get(apiPrefix + "/", agentsList(agentDictionary, hostName, apiPrefix)); // API(agent) list
|
|
22
24
|
|
|
23
25
|
// non stream
|
|
24
|
-
app.post(apiPrefix + "/:agentId", agentDispatcher()); // dispatch agents
|
|
26
|
+
app.post(apiPrefix + "/:agentId", agentDispatcher(agentDictionary)); // dispatch agents
|
|
25
27
|
|
|
26
28
|
// stream
|
|
27
|
-
app.post(apiPrefix + "/stream/:agentId", streamAgentDispatcher());
|
|
29
|
+
app.post(apiPrefix + "/stream/:agentId", streamAgentDispatcher(agentDictionary));
|
|
28
30
|
|
|
29
31
|
```
|
|
30
32
|
|