From cbdbe16bef1d3fe64ad4049d895c75e1bdfabb64 Mon Sep 17 00:00:00 2001 From: isamu Date: Sat, 11 May 2024 04:54:46 +0900 Subject: [PATCH 01/10] update interaction sample agent name --- samples/interaction.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/interaction.ts b/samples/interaction.ts index 5d9c70583..1d28d8203 100644 --- a/samples/interaction.ts +++ b/samples/interaction.ts @@ -15,7 +15,7 @@ const graph_data = { update: ":node3", }, node2: { - agent: "input", + agent: "interactiveInputTextAgent", }, node3: { inputs: [":node1", ":node2"], @@ -27,7 +27,7 @@ const graph_data = { export const main = async () => { graph_data.nodes.node1.value = { injected: "test" }; - const result = await graphDataTestRunner(__filename, graph_data, { merge: mergeNodeIdAgent, input: interactiveInputTextAgent }); + const result = await graphDataTestRunner(__filename, graph_data, { merge: mergeNodeIdAgent, interactiveInputTextAgent }); console.log(result); console.log("COMPLETE 1"); From 5735bd1b5f3989c6404df96fc27bca4cbdae943e Mon Sep 17 00:00:00 2001 From: isamu Date: Sat, 11 May 2024 05:00:17 +0900 Subject: [PATCH 02/10] move interaction sample --- samples/{sample_interaction.ts => interaction/select.ts} | 4 ++-- samples/{interaction.ts => interaction/text.ts} | 2 +- samples/sample_runner.ts | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) rename samples/{sample_interaction.ts => interaction/select.ts} (85%) rename samples/{interaction.ts => interaction/text.ts} (90%) diff --git a/samples/sample_interaction.ts b/samples/interaction/select.ts similarity index 85% rename from samples/sample_interaction.ts rename to samples/interaction/select.ts index fa11fb611..c544302f1 100644 --- a/samples/sample_interaction.ts +++ b/samples/interaction/select.ts @@ -2,7 +2,7 @@ import "dotenv/config"; import { countingAgent } from "@/experimental_agents"; import { graphDataTestRunner } from "~/utils/runner"; -import { interactiveInputSelectAgent } from "./agents/interactiveInputAgent"; +import { interactiveInputSelectAgent } from "../agents/interactiveInputAgent"; const graph_data = { version: 0.3, @@ -21,7 +21,7 @@ const graph_data = { }, }; -const main = async () => { +export const main = async () => { const result = await graphDataTestRunner(__filename, graph_data, { countingAgent, interactiveInputSelectAgent }); console.log(JSON.stringify(result, null, " ")); console.log("COMPLETE 1"); diff --git a/samples/interaction.ts b/samples/interaction/text.ts similarity index 90% rename from samples/interaction.ts rename to samples/interaction/text.ts index 1d28d8203..f3e6dab05 100644 --- a/samples/interaction.ts +++ b/samples/interaction/text.ts @@ -2,7 +2,7 @@ import "dotenv/config"; import { mergeNodeIdAgent } from "@/experimental_agents"; import { graphDataTestRunner } from "~/utils/runner"; -import { interactiveInputTextAgent } from "./agents/interactiveInputAgent"; +import { interactiveInputTextAgent } from "../agents/interactiveInputAgent"; const graph_data = { version: 0.3, diff --git a/samples/sample_runner.ts b/samples/sample_runner.ts index f5d2a6fa1..6b191b058 100644 --- a/samples/sample_runner.ts +++ b/samples/sample_runner.ts @@ -1,14 +1,16 @@ import "dotenv/config"; import { main as gpt } from "./sample_gpt"; -import { main as interaction } from "./interaction"; +import { main as interaction_text } from "./interaction/text"; +import { main as interaction_select } from "./interaction/select"; import { main as sample_co2 } from "./sample_co2"; import { main as sample_paper_ai } from "./sample_paper_ai"; import { main as home } from "./home"; const main = async () => { await gpt(); - await interaction(); + await interaction_text(); + await interaction_select(); await sample_co2(); await sample_paper_ai(); await home(); From 3f2341730c7a0be59a22c13e1d4269a35a3bc37d Mon Sep 17 00:00:00 2001 From: isamu Date: Sat, 11 May 2024 05:03:15 +0900 Subject: [PATCH 03/10] move gpt sample --- samples/{sample_gpt.ts => llm/slashgpt.ts} | 2 +- samples/sample_runner.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename samples/{sample_gpt.ts => llm/slashgpt.ts} (89%) diff --git a/samples/sample_gpt.ts b/samples/llm/slashgpt.ts similarity index 89% rename from samples/sample_gpt.ts rename to samples/llm/slashgpt.ts index 1fbd5b829..f790bb9ad 100644 --- a/samples/sample_gpt.ts +++ b/samples/llm/slashgpt.ts @@ -1,6 +1,6 @@ import "dotenv/config"; -import { fileTestRunner } from "./runner"; +import { fileTestRunner } from "../runner"; import { stringTemplateAgent, slashGPTAgent } from "@/experimental_agents"; diff --git a/samples/sample_runner.ts b/samples/sample_runner.ts index 6b191b058..9be5b1320 100644 --- a/samples/sample_runner.ts +++ b/samples/sample_runner.ts @@ -1,6 +1,6 @@ import "dotenv/config"; -import { main as gpt } from "./sample_gpt"; +import { main as slashgpt } from "./llm/slashgpt"; import { main as interaction_text } from "./interaction/text"; import { main as interaction_select } from "./interaction/select"; import { main as sample_co2 } from "./sample_co2"; @@ -8,7 +8,7 @@ import { main as sample_paper_ai } from "./sample_paper_ai"; import { main as home } from "./home"; const main = async () => { - await gpt(); + await slashgpt(); await interaction_text(); await interaction_select(); await sample_co2(); From f2f7be19dace8393178475028e33f6332a6102f2 Mon Sep 17 00:00:00 2001 From: isamu Date: Sat, 11 May 2024 05:04:32 +0900 Subject: [PATCH 04/10] move groq --- samples/{sample_groq.ts => llm/groq.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename samples/{sample_groq.ts => llm/groq.ts} (100%) diff --git a/samples/sample_groq.ts b/samples/llm/groq.ts similarity index 100% rename from samples/sample_groq.ts rename to samples/llm/groq.ts From c047203d20a004199d1414efcc8b3523b599205b Mon Sep 17 00:00:00 2001 From: isamu Date: Sat, 11 May 2024 05:11:02 +0900 Subject: [PATCH 05/10] update inputs --- samples/agents/slashgpt_agent.ts | 1 + samples/graphs/slash_gpt.yml | 2 +- samples/sample_co2.ts | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/samples/agents/slashgpt_agent.ts b/samples/agents/slashgpt_agent.ts index 4205a9bcf..061e98bb2 100644 --- a/samples/agents/slashgpt_agent.ts +++ b/samples/agents/slashgpt_agent.ts @@ -5,6 +5,7 @@ export const slashGPTFuncitons2TextAgent: AgentFunction<{ function_data_key: str params, inputs, }) => { + console.log(inputs); const message = inputs[0].find((m) => m.role === "function_result"); if (!message) { return; diff --git a/samples/graphs/slash_gpt.yml b/samples/graphs/slash_gpt.yml index d49a7dd45..dc624b7fc 100644 --- a/samples/graphs/slash_gpt.yml +++ b/samples/graphs/slash_gpt.yml @@ -14,7 +14,7 @@ nodes: ${0} node3: agent: slashgpt - inputs: [node2] + inputs: [:node2] node4: agent: stringTemplate inputs: [:node1.$last.content, :node3.$last.content] diff --git a/samples/sample_co2.ts b/samples/sample_co2.ts index 0a6330483..ccf28ba0c 100644 --- a/samples/sample_co2.ts +++ b/samples/sample_co2.ts @@ -58,12 +58,12 @@ const graph_data = { function_data_key: "methods", result_key: 0, }, - inputs: ["slashGPTAgent"], + inputs: [":slashGPTAgent"], agent: "slashGPTFuncitons2TextAgent", }, mapNode: { agent: "mapAgent", - inputs: ["function2prompt0"], + inputs: [":function2prompt0"], params: { injectionTo: ["memory"], }, @@ -80,7 +80,7 @@ const graph_data = { }, }, isResult: true, - inputs: ["memory"], + inputs: [":memory"], }, }, }, From 930e2e24118467e8446e01d5f9e0e95772f77b60 Mon Sep 17 00:00:00 2001 From: isamu Date: Sat, 11 May 2024 05:13:21 +0900 Subject: [PATCH 06/10] move chat --- samples/{sample_chat.ts => interaction/chat.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename samples/{sample_chat.ts => interaction/chat.ts} (100%) diff --git a/samples/sample_chat.ts b/samples/interaction/chat.ts similarity index 100% rename from samples/sample_chat.ts rename to samples/interaction/chat.ts From 3082b46a57505c21bfc4be42ef803e787a65eea3 Mon Sep 17 00:00:00 2001 From: isamu Date: Sat, 11 May 2024 05:15:46 +0900 Subject: [PATCH 07/10] move to tools --- samples/sample_runner.ts | 2 +- samples/{ => tools}/home.ts | 0 samples/{ => tools}/home_functions.ts | 0 samples/{ => tools}/sample_co2.ts | 2 +- 4 files changed, 2 insertions(+), 2 deletions(-) rename samples/{ => tools}/home.ts (100%) rename samples/{ => tools}/home_functions.ts (100%) rename samples/{ => tools}/sample_co2.ts (97%) diff --git a/samples/sample_runner.ts b/samples/sample_runner.ts index 9be5b1320..ea94a697e 100644 --- a/samples/sample_runner.ts +++ b/samples/sample_runner.ts @@ -3,7 +3,7 @@ import "dotenv/config"; import { main as slashgpt } from "./llm/slashgpt"; import { main as interaction_text } from "./interaction/text"; import { main as interaction_select } from "./interaction/select"; -import { main as sample_co2 } from "./sample_co2"; +import { main as sample_co2 } from "./tools/sample_co2"; import { main as sample_paper_ai } from "./sample_paper_ai"; import { main as home } from "./home"; diff --git a/samples/home.ts b/samples/tools/home.ts similarity index 100% rename from samples/home.ts rename to samples/tools/home.ts diff --git a/samples/home_functions.ts b/samples/tools/home_functions.ts similarity index 100% rename from samples/home_functions.ts rename to samples/tools/home_functions.ts diff --git a/samples/sample_co2.ts b/samples/tools/sample_co2.ts similarity index 97% rename from samples/sample_co2.ts rename to samples/tools/sample_co2.ts index ccf28ba0c..56f7cb6ce 100644 --- a/samples/sample_co2.ts +++ b/samples/tools/sample_co2.ts @@ -1,6 +1,6 @@ import "dotenv/config"; -import { slashGPTFuncitons2TextAgent } from "./agents/slashgpt_agent"; +import { slashGPTFuncitons2TextAgent } from "../agents/slashgpt_agent"; import { slashGPTAgent } from "@/experimental_agents"; import { graphDataTestRunner } from "~/utils/runner"; From 076161fe0e4a4a4abcdcad6da6a2361c3e61a5c0 Mon Sep 17 00:00:00 2001 From: isamu Date: Sat, 11 May 2024 05:18:17 +0900 Subject: [PATCH 08/10] update ci express server path --- .github/workflows/node.js.yml | 2 +- samples/{express.ts => express/server.ts} | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) rename samples/{express.ts => express/server.ts} (77%) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 08caa0d6e..b9de6412f 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -24,7 +24,7 @@ jobs: node-version: ${{ matrix.node-version }} cache: 'npm' - run: yarn install - - run: npx ts-node -r tsconfig-paths/register samples/express.ts & + - run: npx ts-node -r tsconfig-paths/register samples/express/server.ts & - run: cd tests/http-server/docs/ && npx http-server & - run: yarn test - run: yarn http_test diff --git a/samples/express.ts b/samples/express/server.ts similarity index 77% rename from samples/express.ts rename to samples/express/server.ts index 38088ff54..51f523f9d 100644 --- a/samples/express.ts +++ b/samples/express/server.ts @@ -1,9 +1,9 @@ // npx ts-node samples/express.ts // sample client: samples/curl.sh -import { hello } from "./express/hello"; -import { graphAISample } from "./express/graph_sample"; -import { agentDispatcher } from "./express/agent_dispatcher"; +import { hello } from "./hello"; +import { graphAISample } from "./graph_sample"; +import { agentDispatcher } from "./agent_dispatcher"; import express from "express"; import cors from "cors"; From d3c41bc4248b00cf036a259162c44c302a754823 Mon Sep 17 00:00:00 2001 From: isamu Date: Sat, 11 May 2024 05:19:50 +0900 Subject: [PATCH 09/10] tools --- samples/{sample_tool.ts => tools/groq.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename samples/{sample_tool.ts => tools/groq.ts} (100%) diff --git a/samples/sample_tool.ts b/samples/tools/groq.ts similarity index 100% rename from samples/sample_tool.ts rename to samples/tools/groq.ts From 2e9d88885a79342a2311eda7957b685fbbec4fae Mon Sep 17 00:00:00 2001 From: isamu Date: Sat, 11 May 2024 05:25:34 +0900 Subject: [PATCH 10/10] move --- samples/{sample_wikipedia2.ts => embeddings/wikipedia.ts} | 0 samples/{sample_wikipedia.ts => interaction/wikipedia.ts} | 2 +- samples/{sample_paper_ai.ts => net/paper_ai.ts} | 4 ++-- samples/{sample_rss.ts => net/rss.ts} | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename samples/{sample_wikipedia2.ts => embeddings/wikipedia.ts} (100%) rename samples/{sample_wikipedia.ts => interaction/wikipedia.ts} (89%) rename samples/{sample_paper_ai.ts => net/paper_ai.ts} (74%) rename samples/{sample_rss.ts => net/rss.ts} (100%) diff --git a/samples/sample_wikipedia2.ts b/samples/embeddings/wikipedia.ts similarity index 100% rename from samples/sample_wikipedia2.ts rename to samples/embeddings/wikipedia.ts diff --git a/samples/sample_wikipedia.ts b/samples/interaction/wikipedia.ts similarity index 89% rename from samples/sample_wikipedia.ts rename to samples/interaction/wikipedia.ts index d95244123..f8b067c88 100644 --- a/samples/sample_wikipedia.ts +++ b/samples/interaction/wikipedia.ts @@ -1,7 +1,7 @@ import "dotenv/config"; import { graphDataTestRunner } from "~/utils/runner"; -import { interactiveInputTextAgent } from "./agents/interactiveInputAgent"; +import { interactiveInputTextAgent } from "../agents/interactiveInputAgent"; import { wikipediaAgent } from "@/experimental_agents"; const graph_data = { diff --git a/samples/sample_paper_ai.ts b/samples/net/paper_ai.ts similarity index 74% rename from samples/sample_paper_ai.ts rename to samples/net/paper_ai.ts index 379f8491a..94537e76d 100644 --- a/samples/sample_paper_ai.ts +++ b/samples/net/paper_ai.ts @@ -1,9 +1,9 @@ import "dotenv/config"; -import { fileTestRunner } from "./runner"; +import { fileTestRunner } from "../runner"; import { slashGPTAgent } from "@/experimental_agents"; -import { arxivAgent, arxiv2TextAgent } from "./agents/arxiv_agent"; +import { arxivAgent, arxiv2TextAgent } from "../agents/arxiv_agent"; export const main = async () => { const res = await fileTestRunner("/graphs/arxiv.yml", { arxivAgent: arxivAgent, arxiv2TextAgent, slashGPTAgent }); diff --git a/samples/sample_rss.ts b/samples/net/rss.ts similarity index 100% rename from samples/sample_rss.ts rename to samples/net/rss.ts