0.1.0 • Published 8 months ago

@graphai/service_agents v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@graphai/service_agents for GraphAI

Service agents for GraphAI.

Install

yarn add @graphai/service_agents

Usage

import { GraphAI } from "graphai";
import { fetchAgent, wikipediaAgent } from "@graphai/service_agents";

const agents = { fetchAgent, wikipediaAgent };

const graph = new GraphAI(graph_data, agents);
const result = await graph.run();

Agents description

  • fetchAgent - Retrieves JSON data from the specified URL
  • wikipediaAgent - Retrieves data from wikipedia

Input/Output/Params Schema & samples

GraphData Example

graphDataFetch

{
  "version": 0.5,
  "nodes": {
    "url": {
      "value": "https://www.google.com/search?q=hello"
    },
    "fetch": {
      "agent": "fetchAgent",
      "params": {
        "type": "text"
      },
      "inputs": {
        "url": ":url"
      }
    },
    "success": {
      "agent": "copyAgent",
      "isResult": true,
      "unless": ":fetch.onError",
      "inputs": {
        "result": true
      }
    },
    "error": {
      "agent": "copyAgent",
      "isResult": true,
      "if": ":fetch.onError",
      "inputs": {
        "error": ":fetch.onError"
      }
    }
  }
}

graphDataPost

{
  "version": 0.5,
  "nodes": {
    "url": {
      "value": "https://www.google.com/search?q=hello"
    },
    "fetch": {
      "agent": "fetchAgent",
      "params": {
        "type": "text"
      },
      "inputs": {
        "url": ":url",
        "body": "Posting data"
      }
    },
    "success": {
      "agent": "copyAgent",
      "isResult": true,
      "unless": ":fetch.onError",
      "inputs": {
        "result": true
      }
    },
    "error": {
      "agent": "propertyFilterAgent",
      "params": {
        "include": [
          "message",
          "status"
        ]
      },
      "isResult": true,
      "if": ":fetch.onError",
      "inputs": {
        "item": ":fetch.onError"
      }
    }
  }
}
0.1.0

8 months ago

0.0.5

8 months ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago