@receptron/graphai_express 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +5 -1
- package/lib/models.d.ts +3 -0
- package/lib/models.js +18 -0
- package/lib/type.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,6 +36,8 @@ app.post(apiAgentPrefix + "/stream/:agentId", streamAgentDispatcher(agentDiction
|
|
|
36
36
|
// non stream and stream agent server
|
|
37
37
|
app.post(apiGraphPrefix + "/", graphRunner(agentDictionary));
|
|
38
38
|
|
|
39
|
+
// OpenAI completions Compatible API
|
|
40
|
+
app.post("/api/chat/completions", completionRunner(agentDictionary, model2graphData, [], onLogCallback));
|
|
39
41
|
|
|
40
42
|
```
|
|
41
43
|
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { agentsList, agentDoc, agentDispatcher, agentRunner, nonStreamAgentDispatcher, streamAgentDispatcher, updateAgentVerbose } from "./agents";
|
|
2
2
|
export { graphRunner, streamGraphRunner, nonStreamGraphRunner } from "./graph";
|
|
3
3
|
export { completionRunner } from "./completions";
|
|
4
|
-
export {
|
|
4
|
+
export { modelList } from "./models";
|
|
5
|
+
export { ExpressAgentInfo, StreamChunkCallback, StreamCompletionChunkCallback, Model2GraphData, GraphDictionary, ContentCallback, DefaultEndOfStreamDelimiter, } from "./type";
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.completionRunner = exports.nonStreamGraphRunner = exports.streamGraphRunner = exports.graphRunner = exports.updateAgentVerbose = exports.streamAgentDispatcher = exports.nonStreamAgentDispatcher = exports.agentRunner = exports.agentDispatcher = exports.agentDoc = exports.agentsList = void 0;
|
|
3
|
+
exports.DefaultEndOfStreamDelimiter = exports.modelList = exports.completionRunner = exports.nonStreamGraphRunner = exports.streamGraphRunner = exports.graphRunner = exports.updateAgentVerbose = exports.streamAgentDispatcher = exports.nonStreamAgentDispatcher = exports.agentRunner = exports.agentDispatcher = exports.agentDoc = exports.agentsList = void 0;
|
|
4
4
|
var agents_1 = require("./agents");
|
|
5
5
|
Object.defineProperty(exports, "agentsList", { enumerable: true, get: function () { return agents_1.agentsList; } });
|
|
6
6
|
Object.defineProperty(exports, "agentDoc", { enumerable: true, get: function () { return agents_1.agentDoc; } });
|
|
@@ -15,3 +15,7 @@ Object.defineProperty(exports, "streamGraphRunner", { enumerable: true, get: fun
|
|
|
15
15
|
Object.defineProperty(exports, "nonStreamGraphRunner", { enumerable: true, get: function () { return graph_1.nonStreamGraphRunner; } });
|
|
16
16
|
var completions_1 = require("./completions");
|
|
17
17
|
Object.defineProperty(exports, "completionRunner", { enumerable: true, get: function () { return completions_1.completionRunner; } });
|
|
18
|
+
var models_1 = require("./models");
|
|
19
|
+
Object.defineProperty(exports, "modelList", { enumerable: true, get: function () { return models_1.modelList; } });
|
|
20
|
+
var type_1 = require("./type");
|
|
21
|
+
Object.defineProperty(exports, "DefaultEndOfStreamDelimiter", { enumerable: true, get: function () { return type_1.DefaultEndOfStreamDelimiter; } });
|
package/lib/models.d.ts
ADDED
package/lib/models.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.modelList = void 0;
|
|
4
|
+
const modelList = (modelDictionary) => {
|
|
5
|
+
return async (req, res) => {
|
|
6
|
+
const data = Object.keys(modelDictionary).map((id) => {
|
|
7
|
+
// const model = modelDictionary[id];
|
|
8
|
+
return {
|
|
9
|
+
id,
|
|
10
|
+
object: "model",
|
|
11
|
+
created: 1686935002,
|
|
12
|
+
owned_by: "graphai",
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
res.json({ object: "list", data });
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
exports.modelList = modelList;
|
package/lib/type.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ type BaseData = {
|
|
|
21
21
|
export type StreamChunkCallback = <T = string | Record<string, string>>(context: AgentFunctionContext, token: T) => void;
|
|
22
22
|
export type StreamCompletionChunkCallback = <T = string | Record<string, string>>(data: BaseData, status: string, token?: T) => void;
|
|
23
23
|
export type Model2GraphData = (model: string) => GraphData;
|
|
24
|
+
export type GraphDictionary = Record<string, GraphData>;
|
|
24
25
|
export type ContentCallback = <T = string | Record<string, string>>(token: T) => void;
|
|
25
26
|
export declare const DefaultEndOfStreamDelimiter = "___END___";
|
|
26
27
|
export {};
|