graphai 0.0.10 → 0.0.11

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 (61) hide show
  1. package/README.md +58 -0
  2. package/lib/experimental_agents/data_agent.d.ts +3 -0
  3. package/lib/experimental_agents/data_agent.js +25 -0
  4. package/lib/experimental_agents/index.d.ts +3 -0
  5. package/lib/experimental_agents/index.js +3 -0
  6. package/lib/experimental_agents/nested_agent.d.ts +6 -0
  7. package/lib/experimental_agents/nested_agent.js +22 -0
  8. package/lib/experimental_agents/slashgpt_agent.js +8 -6
  9. package/lib/experimental_agents/sleeper_agent.d.ts +10 -0
  10. package/lib/experimental_agents/sleeper_agent.js +28 -0
  11. package/lib/experimental_agents/string_agent.js +9 -5
  12. package/lib/graphai.d.ts +6 -1
  13. package/lib/graphai.js +3 -0
  14. package/lib/utils/utils.d.ts +1 -0
  15. package/lib/utils/utils.js +7 -0
  16. package/package.json +13 -3
  17. package/.eslintrc.js +0 -30
  18. package/.github/workflows/node.js.yml +0 -28
  19. package/.prettierrc +0 -3
  20. package/samples/agents/arxiv_agent.ts +0 -45
  21. package/samples/agents/parroting_agent.ts +0 -5
  22. package/samples/agents/slashgpt_agent.ts +0 -19
  23. package/samples/express.ts +0 -47
  24. package/samples/graphs/arxiv.yml +0 -25
  25. package/samples/graphs/slash_gpt.yml +0 -28
  26. package/samples/home.json +0 -112
  27. package/samples/home.ts +0 -51
  28. package/samples/interaction.ts +0 -42
  29. package/samples/runner.ts +0 -15
  30. package/samples/sample_co2.ts +0 -80
  31. package/samples/sample_gpt.ts +0 -8
  32. package/samples/sample_paper_ai.ts +0 -10
  33. package/src/experimental_agents/index.ts +0 -2
  34. package/src/experimental_agents/slashgpt_agent.ts +0 -30
  35. package/src/experimental_agents/string_agent.ts +0 -10
  36. package/src/graphai.ts +0 -417
  37. package/src/graphai_cli.ts +0 -37
  38. package/src/index.ts +0 -3
  39. package/tests/agents/agents.ts +0 -23
  40. package/tests/agents/test_string_agent.ts +0 -28
  41. package/tests/graphai/test_dispatch.ts +0 -41
  42. package/tests/graphai/test_fork.ts +0 -106
  43. package/tests/graphai/test_http_client.ts +0 -40
  44. package/tests/graphai/test_multiple_functions.ts +0 -46
  45. package/tests/graphai/test_sample_flow.ts +0 -71
  46. package/tests/graphs/test_base.yml +0 -19
  47. package/tests/graphs/test_cli.yaml +0 -4
  48. package/tests/graphs/test_dispatch.yml +0 -29
  49. package/tests/graphs/test_error.yml +0 -22
  50. package/tests/graphs/test_multiple_functions_1.yml +0 -30
  51. package/tests/graphs/test_retry.yml +0 -23
  52. package/tests/graphs/test_source.yml +0 -18
  53. package/tests/graphs/test_source2.yml +0 -19
  54. package/tests/graphs/test_timeout.yml +0 -22
  55. package/tests/http-server/README.md +0 -10
  56. package/tests/http-server/docs/llm.json +0 -4
  57. package/tests/http-server/docs/llm2.json +0 -4
  58. package/tests/utils/file_utils.ts +0 -33
  59. package/tests/utils/runner.ts +0 -40
  60. package/tests/utils/utils.ts +0 -3
  61. package/tsconfig.json +0 -113
package/README.md CHANGED
@@ -52,6 +52,64 @@ GraphAI is designed to simplify this process by decoupling the complexity of mul
52
52
 
53
53
  Furthermore, GraphAI's robust mechanisms for error handling, retry strategies, timeouts, and logging empower developers to concentrate on refining the application logic.
54
54
 
55
+ ## Quick Install
56
+
57
+ ```
58
+ pip install graphai
59
+ ```
60
+
61
+ or
62
+
63
+ ```
64
+ yarn add graphai
65
+ ```
66
+
67
+ ## Collaboration
68
+
69
+ Step 1. Install git, node and yarn
70
+
71
+ Step 2. Clone the project and install necessary node modules
72
+
73
+ ```
74
+ git clone git@github.com:snakajima/graphai.git
75
+ cd graphai
76
+ yarn install
77
+ ```
78
+
79
+ Step 3. Set the environment variable OPENAI_API_KEY to your own key (=sk-...)
80
+
81
+ You need to set ANTHROPIC_API_KEY as well, if you want to use Claude.
82
+
83
+ Step 4. Run the test script
84
+
85
+ Start web server for http agent
86
+
87
+ ```
88
+ cd tests/http-server/docs/
89
+ npx http-server
90
+ ```
91
+
92
+ then run the test
93
+
94
+ ```
95
+ npm run test
96
+ ```
97
+
98
+ Step 5. Run one of sample scripts
99
+
100
+ ```
101
+ npm run sample ./samples/home.ts
102
+ ```
103
+
104
+ Step 6. Write some code and send pull requests
105
+
106
+ Key principles:
107
+
108
+ 1. Keep the core (Node and GraphAI classes) small and simple.
109
+ 2. Enhance the platform by adding 'agents' (plug ins).
110
+ 3. Simple but effective test scripts make it easy to maintain.
111
+ 4. Run "npm run format" before submitting pull requests.
112
+
55
113
  ## Data Flow Graph
56
114
 
57
115
  A Data Flow Graph (DFG) is a JavaScript object, which defines the flow of data. It is typically described in YAML file and loaded at runtime.
@@ -0,0 +1,3 @@
1
+ import { AgentFunction } from "../graphai";
2
+ export declare const dataObjectMergeTemplateAgent: AgentFunction;
3
+ export declare const dataSumTemplateAgent: AgentFunction<Record<string, any>, number, number>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.dataSumTemplateAgent = exports.dataObjectMergeTemplateAgent = void 0;
7
+ const deepmerge_1 = __importDefault(require("deepmerge"));
8
+ const dataObjectMergeTemplateAgent = async ({ nodeId, params, inputs, verbose }) => {
9
+ if (verbose) {
10
+ console.log("executing", nodeId, params);
11
+ }
12
+ return inputs.reduce((tmp, input) => {
13
+ return (0, deepmerge_1.default)(tmp, input);
14
+ }, {});
15
+ };
16
+ exports.dataObjectMergeTemplateAgent = dataObjectMergeTemplateAgent;
17
+ const dataSumTemplateAgent = async ({ nodeId, params, inputs, verbose }) => {
18
+ if (verbose) {
19
+ console.log("executing", nodeId, params);
20
+ }
21
+ return inputs.reduce((tmp, input) => {
22
+ return tmp + input;
23
+ }, 0);
24
+ };
25
+ exports.dataSumTemplateAgent = dataSumTemplateAgent;
@@ -1,2 +1,5 @@
1
1
  export * from "./string_agent";
2
2
  export * from "./slashgpt_agent";
3
+ export * from "./sleeper_agent";
4
+ export * from "./data_agent";
5
+ export * from "./nested_agent";
@@ -16,3 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./string_agent"), exports);
18
18
  __exportStar(require("./slashgpt_agent"), exports);
19
+ __exportStar(require("./sleeper_agent"), exports);
20
+ __exportStar(require("./data_agent"), exports);
21
+ __exportStar(require("./nested_agent"), exports);
@@ -0,0 +1,6 @@
1
+ import { GraphData, AgentFunction } from "../graphai";
2
+ export declare const nestedAgent: AgentFunction<{
3
+ graph: GraphData;
4
+ nodeId: string;
5
+ inputNodes?: Array<string>;
6
+ }>;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nestedAgent = void 0;
4
+ const graphai_1 = require("../graphai");
5
+ const nestedAgent = async ({ params, inputs, agents }) => {
6
+ const graph = new graphai_1.GraphAI(params.graph, agents);
7
+ try {
8
+ // Inject inputs to specified source nodes
9
+ (params.inputNodes ?? []).forEach((nodeId, index) => {
10
+ graph.injectResult(nodeId, inputs[index]);
11
+ });
12
+ const results = await graph.run();
13
+ return results[params.nodeId];
14
+ }
15
+ catch (error) {
16
+ if (error instanceof Error) {
17
+ console.log("Error:", error.message);
18
+ }
19
+ throw error;
20
+ }
21
+ };
22
+ exports.nestedAgent = nestedAgent;
@@ -7,17 +7,19 @@ exports.slashGPTAgent = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const slashgpt_1 = require("slashgpt");
9
9
  const config = new slashgpt_1.ChatConfig(path_1.default.resolve(__dirname));
10
- const slashGPTAgent = async (context) => {
11
- console.log("executing", context.nodeId, context.params);
12
- const session = new slashgpt_1.ChatSession(config, context.params.manifest ?? {});
13
- const query = context.params?.query ? [context.params.query] : [];
14
- const contents = query.concat(context.inputs.map((input) => {
10
+ const slashGPTAgent = async ({ nodeId, params, inputs, verbose }) => {
11
+ if (verbose) {
12
+ console.log("executing", nodeId, params);
13
+ }
14
+ const session = new slashgpt_1.ChatSession(config, params.manifest ?? {});
15
+ const query = params?.query ? [params.query] : [];
16
+ const contents = query.concat(inputs.map((input) => {
15
17
  return input.content;
16
18
  }));
17
19
  session.append_user_question(contents.join("\n"));
18
20
  await session.call_loop(() => { });
19
21
  const message = (() => {
20
- if (context.params?.function_result) {
22
+ if (params?.function_result) {
21
23
  return session.history.messages().find((m) => m.role === "function_result");
22
24
  }
23
25
  return session.history.last_message();
@@ -0,0 +1,10 @@
1
+ import { AgentFunction } from "../graphai";
2
+ export declare const sleeperAgent: AgentFunction<{
3
+ duration: number;
4
+ result?: Record<string, any>;
5
+ }>;
6
+ export declare const sleeperAgentDebug: AgentFunction<{
7
+ duration: number;
8
+ result?: Record<string, any>;
9
+ fail?: boolean;
10
+ }>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.sleeperAgentDebug = exports.sleeperAgent = void 0;
7
+ const utils_1 = require("../utils/utils");
8
+ const deepmerge_1 = __importDefault(require("deepmerge"));
9
+ const sleeperAgent = async (context) => {
10
+ const { params, inputs } = context;
11
+ await (0, utils_1.sleep)(params.duration);
12
+ return inputs.reduce((result, input) => {
13
+ return (0, deepmerge_1.default)(result, input);
14
+ }, params.result ?? {});
15
+ };
16
+ exports.sleeperAgent = sleeperAgent;
17
+ const sleeperAgentDebug = async (context) => {
18
+ const { nodeId, params, inputs, retry } = context;
19
+ await (0, utils_1.sleep)(params.duration / (retry + 1));
20
+ if (params.fail && retry < 2) {
21
+ console.log("failed (intentional)", nodeId, retry);
22
+ throw new Error("Intentional Failure");
23
+ }
24
+ return inputs.reduce((result, input) => {
25
+ return (0, deepmerge_1.default)(result, input);
26
+ }, params.result ?? {});
27
+ };
28
+ exports.sleeperAgentDebug = sleeperAgentDebug;
@@ -1,11 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stringTemplateAgent = void 0;
4
- const stringTemplateAgent = async (context) => {
5
- console.log("executing", context.nodeId, context.params);
6
- const content = context.inputs.reduce((template, input, index) => {
7
- return template.replace("${" + index + "}", input[context.params.inputKey ?? "content"]);
8
- }, context.params.template);
4
+ // see example
5
+ // tests/agents/test_string_agent.ts
6
+ const stringTemplateAgent = async ({ nodeId, params, inputs, verbose }) => {
7
+ if (verbose) {
8
+ console.log("executing", nodeId, params);
9
+ }
10
+ const content = inputs.reduce((template, input, index) => {
11
+ return template.replace("${" + index + "}", input[params.inputKey ?? "content"]);
12
+ }, params.template);
9
13
  return { content };
10
14
  };
11
15
  exports.stringTemplateAgent = stringTemplateAgent;
package/lib/graphai.d.ts CHANGED
@@ -24,6 +24,7 @@ type NodeData = {
24
24
  export type GraphData = {
25
25
  nodes: Record<string, NodeData>;
26
26
  concurrency?: number;
27
+ verbose?: boolean;
27
28
  };
28
29
  export type TransactionLog = {
29
30
  nodeId: string;
@@ -43,6 +44,8 @@ export type AgentFunctionContext<ParamsType, ResultType, PreviousResultType> = {
43
44
  retry: number;
44
45
  params: NodeDataParams<ParamsType>;
45
46
  inputs: Array<PreviousResultType>;
47
+ verbose: boolean;
48
+ agents: CallbackDictonaryArgs;
46
49
  };
47
50
  export type AgentFunction<ParamsType = Record<string, any>, ResultType = Record<string, any>, PreviousResultType = Record<string, any>> = (context: AgentFunctionContext<ParamsType, ResultType, PreviousResultType>) => Promise<ResultData<ResultType>>;
48
51
  export type AgentFunctionDictonary = Record<string, AgentFunction<any, any, any>>;
@@ -75,6 +78,7 @@ declare class Node {
75
78
  execute(): Promise<void>;
76
79
  }
77
80
  type GraphNodes = Record<string, Node>;
81
+ export type CallbackDictonaryArgs = AgentFunctionDictonary | AgentFunction<any, any, any>;
78
82
  export declare class GraphAI {
79
83
  nodes: GraphNodes;
80
84
  callbackDictonary: AgentFunctionDictonary;
@@ -83,8 +87,9 @@ export declare class GraphAI {
83
87
  private nodeQueue;
84
88
  private onComplete;
85
89
  private concurrency;
90
+ verbose: boolean;
86
91
  private logs;
87
- constructor(data: GraphData, callbackDictonary: AgentFunctionDictonary | AgentFunction<any, any, any>);
92
+ constructor(data: GraphData, callbackDictonary: CallbackDictonaryArgs);
88
93
  getCallback(_agentId?: string): AgentFunction<any, any, any>;
89
94
  asString(): string;
90
95
  results(): ResultDataDictonary<Record<string, any>>;
package/lib/graphai.js CHANGED
@@ -117,6 +117,8 @@ class Node {
117
117
  params: this.params,
118
118
  inputs: results,
119
119
  forkIndex: this.forkIndex,
120
+ verbose: this.graph.verbose,
121
+ agents: this.graph.callbackDictonary,
120
122
  });
121
123
  if (this.transactionId !== transactionId) {
122
124
  console.log(`-- ${this.nodeId}: transactionId mismatch`);
@@ -167,6 +169,7 @@ class GraphAI {
167
169
  this.logs = [];
168
170
  this.callbackDictonary = typeof callbackDictonary === "function" ? { _default: callbackDictonary } : callbackDictonary;
169
171
  this.concurrency = data.concurrency ?? defaultConcurrency;
172
+ this.verbose = data.verbose === true;
170
173
  this.onComplete = () => {
171
174
  console.error("-- SOMETHING IS WRONG: onComplete is called without run()");
172
175
  };
@@ -0,0 +1 @@
1
+ export declare const sleep: (milliseconds: number) => Promise<unknown>;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sleep = void 0;
4
+ const sleep = async (milliseconds) => {
5
+ return await new Promise((resolve) => setTimeout(resolve, milliseconds));
6
+ };
7
+ exports.sleep = sleep;
package/package.json CHANGED
@@ -1,15 +1,21 @@
1
1
  {
2
2
  "name": "graphai",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "Asynchronous data flow execution engine to make it simple to build LLM apps.",
5
5
  "main": "lib/index.js",
6
- "bin": "lib/graphai_cli.js",
6
+ "bin": {
7
+ "graphai": "lib/graphai_cli.js"
8
+ },
9
+ "files": [
10
+ "./lib"
11
+ ],
7
12
  "scripts": {
8
13
  "build": "tsc && tsc-alias",
9
14
  "eslint": "eslint --fix --ext src/**/*.{ts} tests/**/*.ts",
10
15
  "format": "prettier --write '{src,tests,samples}/**/*.ts' .eslintrc.js",
11
16
  "test": "node --test -r tsconfig-paths/register --require ts-node/register ./tests/**/test_*.ts",
12
17
  "cli": "npx ts-node -r tsconfig-paths/register ./src/graphai_cli.ts",
18
+ "samples": "npx ts-node -r tsconfig-paths/register samples/sample_runner.ts",
13
19
  "sample": "npx ts-node -r tsconfig-paths/register"
14
20
  },
15
21
  "repository": {
@@ -23,11 +29,14 @@
23
29
  },
24
30
  "homepage": "https://github.com/snakajima/graphai#readme",
25
31
  "devDependencies": {
32
+ "@inquirer/prompts": "^5.0.0",
26
33
  "@types/express": "^4.17.21",
27
34
  "@types/node": "^20.8.7",
28
35
  "@typescript-eslint/eslint-plugin": "^6.8.0",
29
36
  "@typescript-eslint/parser": "^6.8.0",
30
37
  "arxiv-api-ts": "^1.0.3",
38
+ "deepmerge": "^4.3.1",
39
+ "dotenv": "^16.4.5",
31
40
  "eslint": "^7.32.0 || ^8.2.0",
32
41
  "eslint-plugin-import": "^2.25.2",
33
42
  "express": "^4.19.2",
@@ -37,7 +46,8 @@
37
46
  "ts-node": "^10.9.1",
38
47
  "tsc-alias": "^1.8.8",
39
48
  "tsconfig-paths": "^4.2.0",
40
- "typescript": "^5.2.2"
49
+ "typescript": "^5.2.2",
50
+ "wikipedia": "^2.1.2"
41
51
  },
42
52
  "dependencies": {
43
53
  "yaml": "^2.3.3"
package/.eslintrc.js DELETED
@@ -1,30 +0,0 @@
1
- module.exports = {
2
- env: {
3
- es2021: true,
4
- node: true,
5
- },
6
- extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
7
- overrides: [
8
- {
9
- env: {
10
- node: true,
11
- },
12
- files: [".eslintrc.{js,cjs}"],
13
- parserOptions: {
14
- sourceType: "script",
15
- },
16
- },
17
- ],
18
- parser: "@typescript-eslint/parser",
19
- parserOptions: {
20
- ecmaVersion: "latest",
21
- sourceType: "module",
22
- },
23
- plugins: ["@typescript-eslint"],
24
- rules: {
25
- indent: ["error", 2],
26
- "linebreak-style": ["error", "unix"],
27
- quotes: ["error", "double"],
28
- semi: ["error", "always"],
29
- },
30
- };
@@ -1,28 +0,0 @@
1
- # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2
- # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3
-
4
- name: Node.js CI
5
-
6
- on:
7
- pull_request
8
-
9
- jobs:
10
- build:
11
-
12
- runs-on: ubuntu-latest
13
-
14
- strategy:
15
- matrix:
16
- node-version: [18.x, 20.x]
17
- # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
18
-
19
- steps:
20
- - uses: actions/checkout@v4
21
- - name: Use Node.js ${{ matrix.node-version }}
22
- uses: actions/setup-node@v4
23
- with:
24
- node-version: ${{ matrix.node-version }}
25
- cache: 'npm'
26
- - run: yarn install
27
- - run: cd tests/http-server/docs/ && npx http-server &
28
- - run: yarn test
package/.prettierrc DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "printWidth": 160
3
- }
@@ -1,45 +0,0 @@
1
- import search from "arXiv-api-ts";
2
-
3
- import { AgentFunction } from "@/graphai";
4
-
5
- type arxivData = { id: string; title: string; summary: string };
6
-
7
- const search_arxiv_papers = async (keywords: string[], limit = 10) => {
8
- const includes = keywords.map((k) => {
9
- return { name: k };
10
- });
11
- const papers = await search({
12
- searchQueryParams: [
13
- {
14
- include: includes,
15
- },
16
- ],
17
- sortBy: "lastUpdatedDate",
18
- sortOrder: "descending",
19
- start: 0,
20
- maxResults: limit,
21
- });
22
- return papers.entries || [];
23
- };
24
-
25
- export const arxivAgent: AgentFunction<{ keywords: string[]; limit: number }, arxivData[]> = async (context) => {
26
- const { keywords, limit } = context.params;
27
- const arxivResult = await search_arxiv_papers(keywords, limit);
28
- // console.log("executing", arxivResult, context.params.keywords);
29
-
30
- const result = arxivResult.map((r: any) => {
31
- const { id, title, summary } = r;
32
- return { id, title, summary };
33
- });
34
- return result;
35
- };
36
-
37
- export const arxiv2TextAgent: AgentFunction<{}, Record<string, any>, string[]> = async (context) => {
38
- const result = (context.inputs[0] || [])
39
- .map((r: any) => {
40
- const { id, title, summary } = r;
41
- return ["id:", id, "title:", title, "summary:", summary].join("\n");
42
- })
43
- .join("\n\n\n");
44
- return { content: result };
45
- };
@@ -1,5 +0,0 @@
1
- import { AgentFunction } from "@/graphai";
2
-
3
- export const parrotingAgent: AgentFunction = async (context) => {
4
- return context.params;
5
- };
@@ -1,19 +0,0 @@
1
- import path from "path";
2
- import { AgentFunction } from "@/graphai";
3
- import { ChatSession, ChatConfig, ManifestData } from "slashgpt";
4
-
5
- const config = new ChatConfig(path.resolve(__dirname));
6
-
7
- export const slashGPTFuncitons2TextAgent: AgentFunction<
8
- { function_data_key: string; result_key: number },
9
- Record<string, string>,
10
- { function_data: { [key: string]: string[] } }
11
- > = async (context) => {
12
- const { params } = context;
13
- const result = (context?.inputs[0].function_data[params.function_data_key] || []).map((r: any) => {
14
- const { title, description } = r;
15
- return ["title:", title, "description:", description].join("\n");
16
- });
17
-
18
- return { content: result[context.forkIndex ?? 0] };
19
- };
@@ -1,47 +0,0 @@
1
- // npx ts-node samples/express.ts
2
- import { GraphAI, AgentFunction } from "@/graphai";
3
-
4
- import express from "express";
5
-
6
- const app = express();
7
-
8
- const graphAISample = async (req: express.Request, res: express.Response) => {
9
- const graph_data = {
10
- nodes: {
11
- node1: {
12
- params: {},
13
- },
14
- },
15
- concurrency: 8,
16
- };
17
- const testFunction: AgentFunction<Record<string, string>> = async (context) => {
18
- console.log("hello");
19
- return {};
20
- };
21
- const graph = new GraphAI(graph_data, testFunction);
22
- const response = await graph.run();
23
- res.json({ result: response });
24
- res.end();
25
- };
26
-
27
- const hello = async (req: express.Request, res: express.Response) => {
28
- const { params, query } = req;
29
- res.json({
30
- result: [
31
- {
32
- message: "hello",
33
- params,
34
- query,
35
- },
36
- ],
37
- });
38
- res.end();
39
- };
40
-
41
- app.use(express.json());
42
- app.get("/", hello);
43
- app.get("/mock", graphAISample);
44
-
45
- const server = app.listen(8080, () => {
46
- console.log("Running Server");
47
- });
@@ -1,25 +0,0 @@
1
- nodes:
2
- searchArxiv:
3
- params:
4
- keywords:
5
- - llm
6
- - gpt
7
- limit: 10
8
- agentId: arxivAgent
9
- arxiv2TextAgent:
10
- inputs: [searchArxiv]
11
- agentId: arxiv2TextAgent
12
- slashGPTAgent:
13
- inputs: [arxiv2TextAgent]
14
- agentId: slashGPTAgent
15
- params:
16
- query: |
17
- 与えられたそれぞれの論文の要点をまとめ、以下の項目で日本語で出力せよ。それぞれの項目は最大でも180文字以内に要約せよ。
18
- ```
19
- 論文名:タイトルの日本語訳
20
- キーワード:この論文のキーワード
21
- 課題:この論文が解決する課題
22
- 手法:この論文が提案する手法,
23
- 結果:提案手法によって得られた結果
24
- ```
25
-
@@ -1,28 +0,0 @@
1
- nodes:
2
- node1:
3
- agentId: slashgpt
4
- params:
5
- query: Come up with ten business ideas for AI startup
6
- node2:
7
- agentId: stringTemplate
8
- inputs: [node1]
9
- params:
10
- template: |
11
- Please evaluate following business ideas.
12
- ${0}
13
- node3:
14
- agentId: slashgpt
15
- inputs: [node2]
16
- node4:
17
- agentId: stringTemplate
18
- inputs: [node1, node3]
19
- params:
20
- template: |
21
- Please pick the winner of this business idea contest.
22
- [ideas]
23
- ${0}
24
- [evalutations]
25
- ${1}
26
- node5:
27
- agentId: slashgpt
28
- inputs: [node4]