@purpleschool/ai-proxy 0.0.2 → 0.0.4
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.
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./errors"), exports);
|
package/build/index.js
CHANGED
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./constants"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purpleschool/ai-proxy",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -17,5 +17,8 @@
|
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"zod": "^3.22.4"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/node": "^24.3.0"
|
|
20
23
|
}
|
|
21
24
|
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
import "google/protobuf/timestamp.proto";
|
|
3
|
+
package AiProxy;
|
|
4
|
+
|
|
5
|
+
service AiProxyService {
|
|
6
|
+
rpc TextGeneration (TextGenerationRequest) returns (stream TextGenerationResponse);
|
|
7
|
+
rpc TextGenerationUnary (TextGenerationUnaryRequest) returns (TextGenerationUnaryResponse);
|
|
8
|
+
rpc ImageGeneration (ImageGenerationRequest) returns (ImageGenerationResponse);
|
|
9
|
+
rpc EmbeddingsGeneration (EmbeddingsGenerationRequest) returns (EmbeddingsGenerationResponse);
|
|
10
|
+
rpc GetAllAiModels(GetAllAiModelsRequest) returns (GetAllAiModelsResponse);
|
|
11
|
+
rpc GetAiModel(GetAiModelRequest) returns (GetAiModelResponse);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Text Generation (stream)
|
|
15
|
+
message TextGenerationRequest {
|
|
16
|
+
string model = 1;
|
|
17
|
+
repeated Message messages = 2;
|
|
18
|
+
repeated string features = 3;
|
|
19
|
+
WebSearchParams webSearchParams = 4;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
message Message {
|
|
23
|
+
optional string uuid = 1;
|
|
24
|
+
string role = 2;
|
|
25
|
+
string text = 3;
|
|
26
|
+
repeated File files = 4;
|
|
27
|
+
optional string status = 5;
|
|
28
|
+
optional string externalId = 6;
|
|
29
|
+
google.protobuf.Timestamp createdAt = 7;
|
|
30
|
+
google.protobuf.Timestamp updatedAt = 8;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
message WebSearchParams {
|
|
34
|
+
UserLocation userLocation = 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
message UserLocation {
|
|
38
|
+
string country = 1;
|
|
39
|
+
string city = 2;
|
|
40
|
+
string region = 3;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
message File {
|
|
44
|
+
string url = 1;
|
|
45
|
+
string type = 2;
|
|
46
|
+
string mimeType = 3;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
message TextGenerationResponse {
|
|
50
|
+
optional string delta = 1;
|
|
51
|
+
optional int32 inputTokens = 2;
|
|
52
|
+
optional int32 outputTokens = 3;
|
|
53
|
+
bool isFinish = 4;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// TextGenerationUnary
|
|
57
|
+
message TextGenerationUnaryRequest {
|
|
58
|
+
string model = 1;
|
|
59
|
+
repeated Message messages = 2;
|
|
60
|
+
repeated string features = 3;
|
|
61
|
+
WebSearchParams webSearchParams = 4;
|
|
62
|
+
string responseSchema = 5;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
message TextGenerationUnaryResponse {
|
|
66
|
+
string text = 1;
|
|
67
|
+
int32 inputTokens = 2;
|
|
68
|
+
int32 outputTokens = 3;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Image Generation
|
|
72
|
+
message ImageGenerationRequest {
|
|
73
|
+
string model = 1;
|
|
74
|
+
string prompt = 2;
|
|
75
|
+
int32 width = 3;
|
|
76
|
+
int32 height = 4;
|
|
77
|
+
repeated Message messages = 5;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
message ImageGenerationResponse {
|
|
81
|
+
string model = 1;
|
|
82
|
+
ImageGenerationData data = 2;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
message ImageGenerationData {
|
|
86
|
+
optional string url = 1;
|
|
87
|
+
optional string base64 = 2;
|
|
88
|
+
optional string externalId = 3;
|
|
89
|
+
string type = 4;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// GetAllAiModels
|
|
93
|
+
message GetAllAiModelsRequest {
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
message GetAllAiModelsResponse {
|
|
97
|
+
repeated AiModel data = 1;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
message AiModel {
|
|
101
|
+
string model = 1;
|
|
102
|
+
string contentType = 2;
|
|
103
|
+
repeated string features = 3;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// GetAiModel
|
|
107
|
+
message GetAiModelRequest {
|
|
108
|
+
string model = 1;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
message GetAiModelResponse {
|
|
112
|
+
AiModel data = 1;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// GenerateEmbeddings
|
|
116
|
+
message EmbeddingsGenerationRequest {
|
|
117
|
+
repeated string queries = 1;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
message Embedding {
|
|
121
|
+
repeated double embedding = 1;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
message EmbeddingsGenerationResponse {
|
|
125
|
+
repeated Embedding data = 1;
|
|
126
|
+
}
|
package/proto/ai-api.proto
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
syntax = "proto3";
|
|
2
|
-
|
|
3
|
-
package AiApi;
|
|
4
|
-
|
|
5
|
-
service AiApiService {
|
|
6
|
-
rpc ChatCompletions (ChatCompletionsRequest) returns (stream ChatCompletionsResponse);
|
|
7
|
-
rpc ImageGeneration (ImageGenerationRequest) returns (ImageGenerationResponse);
|
|
8
|
-
rpc GetAllAiModels(GetAllAiModelsRequest) returns (GetAllAiModelsResponse);
|
|
9
|
-
rpc GetAiModel(GetAiModelRequest) returns (GetAiModelResponse);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// Chat Completions
|
|
13
|
-
message ChatCompletionsRequest {
|
|
14
|
-
string model = 1;
|
|
15
|
-
repeated Message messages = 2;
|
|
16
|
-
repeated string features = 3;
|
|
17
|
-
UserLocation userLocation = 4;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
message Message {
|
|
21
|
-
string role = 1;
|
|
22
|
-
string text = 2;
|
|
23
|
-
repeated File files = 3;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
message UserLocation {
|
|
27
|
-
string country = 1;
|
|
28
|
-
string city = 2;
|
|
29
|
-
string region = 3;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
message File {
|
|
33
|
-
string url = 1;
|
|
34
|
-
string type = 2;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
message ChatCompletionsResponse {
|
|
38
|
-
optional string delta = 1;
|
|
39
|
-
bool isFinish = 2;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Image Generation
|
|
43
|
-
message ImageGenerationRequest {
|
|
44
|
-
string model = 1;
|
|
45
|
-
string prompt = 2;
|
|
46
|
-
int32 width = 3;
|
|
47
|
-
int32 height = 4;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
message ImageGenerationResponse {
|
|
51
|
-
string model = 1;
|
|
52
|
-
ImageGenerationData data = 2;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
message ImageGenerationData {
|
|
56
|
-
string url = 1;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// GetAllAiModels
|
|
60
|
-
message GetAllAiModelsRequest {
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
message GetAllAiModelsResponse {
|
|
64
|
-
repeated AiModel data = 1;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
message AiModel {
|
|
68
|
-
string model = 1;
|
|
69
|
-
string contentType = 2;
|
|
70
|
-
repeated string features = 3;
|
|
71
|
-
int32 maxInputLength = 4;
|
|
72
|
-
int32 maxInputTokens = 5;
|
|
73
|
-
AiModelConfig config = 6;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
message AiModelConfig {
|
|
77
|
-
repeated ImageSizeOption supportedResolutions = 1;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
message ImageSizeOption {
|
|
81
|
-
int32 width = 1;
|
|
82
|
-
int32 height = 2;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// GetAiModel
|
|
86
|
-
message GetAiModelRequest {
|
|
87
|
-
string model = 1;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
message GetAiModelResponse {
|
|
91
|
-
AiModel data = 1;
|
|
92
|
-
}
|
|
File without changes
|
|
File without changes
|