npm

@graphai/openai_agent
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

@graphai/openai_agent for GraphAI

OpenAI agents for GraphAI.

Install

yarn add @graphai/openai_agent

Usage

import { GraphAI } from "graphai";
import { openAIAgent, openAIImageAgent } from "@graphai/openai_agent";

const agents = { openAIAgent, openAIImageAgent };

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

Agents description

  • openAIAgent - OpenAI Agent
  • openAIImageAgent - OpenAI Image Agent

Input/Output/Params Schema & samples

Environment Variables

  • openAIAgent
    • OPENAI_API_KEY
  • openAIImageAgent
    • OPENAI_API_KEY

GraphData Example

graphDataOpenAIMath

{
  "version": 0.5,
  "nodes": {
    "inputData": {
      "value": "hello, let me know the answer 1 + 1"
    },
    "llm": {
      "agent": "openAIAgent",
      "inputs": {
        "prompt": ":inputData"
      }
    }
  }
}

graphDataOpenAIPaint

{
  "version": 0.5,
  "nodes": {
    "inputData": {
      "value": "dragon flying in the sky"
    },
    "llm": {
      "agent": "openAIImageAgent",
      "inputs": {
        "prompt": ":inputData"
      },
      "params": {
        "system": "Generate user-specified image",
        "model": "dall-e-3"
      },
      "isResult": true
    }
  }
}

graphDataOpenAIImageDescription

{
  "version": 0.5,
  "nodes": {
    "inputData": {
      "value": "what is this"
    },
    "llm": {
      "agent": "openAIAgent",
      "inputs": {
        "prompt": ":inputData"
      },
      "params": {
        "model": "gpt-4o-mini",
        "system": "Describe the given image",
        "images": [
          "https://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/Kumamoto_Castle_Keep_Tower_20221022-3.jpg/1920px-Kumamoto_Castle_Keep_Tower_20221022-3.jpg"
        ]
      },
      "isResult": true
    }
  }
}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.255latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.255
0.1.16
0.1.01
0.0.103
0.0.95
0.0.80
0.0.70
0.0.61
0.0.50
0.0.40
0.0.30
0.0.20
0.0.10

Package Sidebar

Install

npm i @graphai/openai_agent

Weekly Downloads

71

Version

0.1.2

License

MIT

Unpacked Size

17 kB

Total Files

8

Last publish

Collaborators

  • snakajima
  • isamu