@graphai/openai_agent
v0.1.2
Published
OpenAI agents for GraphAI.
Downloads
546
Readme
@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
}
}
}