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
    }
  }
}

Readme

Keywords

none

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