2.0.0 • Published 5 months ago
@receptron/graphai_express v2.0.0
GraphAI express middleware.
Install
yarn add @receptron/graphai_expressUsage
import express from "express";
import * as agents from "@graphai/agents";
import { agentDispatcher, nonStreamAgentDispatcher, streamAgentDispatcher, agentsList, agentDoc, graphRunner} from "@receptron/graphai_express";
import { AgentFunctionInfoDictionary } from "graphai";
const agentDictionary: AgentFunctionInfoDictionary = agents;
const hostName = "https://example.net";
const apiAgentPrefix = "/api/agents";
const apiGraphPrefix = "/api/graph";
app.get(apiAgentPrefix + "/:agentId", agentDoc(agentDictionary, hostName, apiAgentPrefix)); // each API(agent) document
app.get(apiAgentPrefix + "/", agentsList(agentDictionary, hostName, apiAgentPrefix)); // API(agent) list
// non stream and stream agent server
app.post(apiAgentPrefix + "/:agentId", agentDispatcher(agentDictionary));
// non stream agent server
app.post(apiAgentPrefix + "/nonstream/:agentId", nonStreamAgentDispatcher(agentDictionary));
// stream agent server
app.post(apiAgentPrefix + "/stream/:agentId", streamAgentDispatcher(agentDictionary));
// non stream and stream agent server
app.post(apiGraphPrefix + "/", graphRunner(agentDictionary));
// OpenAI completions Compatible API
app.post("/api/chat/completions", completionRunner(agentDictionary, model2graphData, [], onLogCallback));Run Test server
yarn run serverTest from curl
curl -X POST -H "Content-Type: application/json" -d '{"params": {"message" : "hello"}}' http://localhost:8085/api/agents/echoAgentfrom GraphAI Client
npx ts-node test/stream_graph.tsfor this middleware development
git clone https://github.com/receptron/graphai_utils
cd packages/express
yarn install
yarn run server # then run test express server
yarn run test_stream1.0.2
7 months ago
1.0.1
8 months ago
1.0.0
8 months ago
1.0.3
6 months ago
2.0.0
5 months ago
0.1.0
11 months ago
0.1.2
11 months ago
0.2.0
9 months ago
0.1.1
11 months ago
0.0.33
1 year ago
0.0.32
1 year ago
0.0.20
1 year ago
0.0.21
1 year ago
0.0.22
1 year ago
0.0.23
1 year ago
0.0.24
1 year ago
0.0.25
1 year ago
0.0.15
1 year ago
0.0.16
1 year ago
0.0.17
1 year ago
0.0.18
1 year ago
0.0.19
1 year ago
0.0.30
1 year ago
0.0.31
1 year ago
0.0.10
1 year ago
0.0.11
1 year ago
0.0.12
1 year ago
0.0.13
1 year ago
0.0.14
1 year ago
0.0.26
1 year ago
0.0.9
1 year ago
0.0.27
1 year ago
0.0.8
1 year ago
0.0.28
1 year ago
0.0.29
1 year ago
0.0.5
1 year ago
0.0.4
1 year ago
0.0.7
1 year ago
0.0.6
1 year ago
0.0.3
1 year ago
0.0.2
1 year ago
0.0.1
1 year ago