@graphai/vanilla_node_agents
v2.0.4
Published
Vanilla node agents for GraphAI.
Downloads
1,788
Readme
@graphai/vanilla_node_agents for GraphAI
Vanilla node agents for GraphAI.
Install
yarn add @graphai/vanilla_node_agentsUsage
import { GraphAI } from "graphai";
import { fileReadAgent, fileWriteAgent, pathUtilsAgent } from "@graphai/vanilla_node_agents";
const agents = { fileReadAgent, fileWriteAgent, pathUtilsAgent };
const graph = new GraphAI(graph_data, agents);
const result = await graph.run();Agents description
- fileReadAgent - Read data from file system and returns data
- fileWriteAgent - Write data to file system
- pathUtilsAgent - Path utils
Input/Output/Params Schema & samples
Input/Params example
- fileReadAgent
- inputs
- file(string)
- Name of a single file to read
- array(array)
- List of multiple file names to read
- file(string)
- params
- baseDir(string)
- Base directory where the file(s) are located
- outputType(string)
- Desired output format. If omitted, returns raw Buffer
- baseDir(string)
- inputs
{
"inputs": {
"array": [
"test.txt"
]
},
"params": {
"baseDir": "/home/runner/work/graphai/graphai/agents/vanilla_node_agents/lib/node_file_agents/../../tests/files/"
}
}{
"inputs": {
"array": [
"test.txt"
]
},
"params": {
"baseDir": "/home/runner/work/graphai/graphai/agents/vanilla_node_agents/lib/node_file_agents/../../tests/files/",
"outputType": "base64"
}
}{
"inputs": {
"array": [
"test.txt"
]
},
"params": {
"baseDir": "/home/runner/work/graphai/graphai/agents/vanilla_node_agents/lib/node_file_agents/../../tests/files/",
"outputType": "text"
}
}// Reads a single file named 'test.txt' from the given base directory and returns its contents as a UTF-8 string.
{
"inputs": {
"file": "test.txt"
},
"params": {
"baseDir": "/home/runner/work/graphai/graphai/agents/vanilla_node_agents/lib/node_file_agents/../../tests/files/",
"outputType": "text"
}
}- fileWriteAgent
- inputs
- text(string)
- text data
- file(string)
- file name
- text(string)
- inputs
{
"inputs": {
"file": "write.txt",
"text": "hello"
},
"params": {
"baseDir": "/home/runner/work/graphai/graphai/agents/vanilla_node_agents/lib/node_file_agents/../../tests/files/"
}
}- pathUtilsAgent
- inputs
- dirs(array)
- directory names
- dirs(array)
- inputs
{
"inputs": {
"dirs": [
"/base/",
"tmp/",
"test.txt"
]
},
"params": {
"method": "resolve"
}
}{
"inputs": {
"dirs": [
"base/",
"tmp/",
"test.txt"
]
},
"params": {
"method": "join"
}
}{
"inputs": {
"path": "base///tmp//test.txt"
},
"params": {
"method": "normalize"
}
}