@ancatag/n-r 0.2.18 → 0.2.19
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/dist/chat.d.ts +5 -5
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js +19 -9
- package/dist/chat.js.map +1 -1
- package/dist/client.d.ts +0 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -7
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts +5 -5
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +16 -7
- package/dist/models.js.map +1 -1
- package/dist/proto/engine.proto +431 -0
- package/dist/proto/generated/engine.d.ts +440 -0
- package/dist/proto/generated/engine.d.ts.map +1 -0
- package/dist/proto/generated/engine.js +39 -0
- package/dist/proto/generated/engine.js.map +1 -0
- package/dist/proto/generated/google/protobuf/duration.d.ts +80 -0
- package/dist/proto/generated/google/protobuf/duration.d.ts.map +1 -0
- package/dist/proto/generated/google/protobuf/duration.js +9 -0
- package/dist/proto/generated/google/protobuf/duration.js.map +1 -0
- package/dist/proto/generated/google/protobuf/timestamp.d.ts +110 -0
- package/dist/proto/generated/google/protobuf/timestamp.d.ts.map +1 -0
- package/dist/proto/generated/google/protobuf/timestamp.js +9 -0
- package/dist/proto/generated/google/protobuf/timestamp.js.map +1 -0
- package/dist/proto/generated/nova-service.d.ts +478 -0
- package/dist/proto/generated/nova-service.d.ts.map +1 -0
- package/dist/proto/generated/nova-service.js +122 -0
- package/dist/proto/generated/nova-service.js.map +1 -0
- package/dist/proto/nova-service.proto +472 -0
- package/package.json +17 -7
package/dist/chat.d.ts
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Chat Completions API
|
|
3
3
|
* Handles chat completion requests (streaming and non-streaming)
|
|
4
4
|
*/
|
|
5
|
-
import { GrpcClient } from "./grpc-client.js";
|
|
6
5
|
import { HttpClient } from "./http-client.js";
|
|
7
|
-
import type { ChatCompletionChunk, ChatCompletionRequest, ChatCompletionResponse } from "./types.js";
|
|
6
|
+
import type { ChatCompletionChunk, ChatCompletionRequest, ChatCompletionResponse, NovaClientConfig } from "./types.js";
|
|
8
7
|
export declare class ChatCompletions {
|
|
9
8
|
private readonly httpClient;
|
|
10
|
-
private readonly
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
private readonly config;
|
|
10
|
+
private grpcClientInstance?;
|
|
11
|
+
constructor(httpClient: HttpClient, config: NovaClientConfig);
|
|
12
|
+
private getGrpcClient;
|
|
13
13
|
/**
|
|
14
14
|
* Create a chat completion (non-streaming)
|
|
15
15
|
*/
|
package/dist/chat.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../src/chat.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../src/chat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EACX,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,MAAM,YAAY,CAAC;AAEpB,qBAAa,eAAe;IAG1B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAHxB,OAAO,CAAC,kBAAkB,CAAC,CAAa;gBAEtB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,gBAAgB;YAG5B,aAAa;IAW3B;;OAEG;IACG,MAAM,CACX,OAAO,EAAE,qBAAqB,GAC5B,OAAO,CAAC,sBAAsB,CAAC;IAsBlC;;;OAGG;IACI,YAAY,CAClB,OAAO,EAAE,qBAAqB,EAC9B,MAAM,CAAC,EAAE,WAAW,GAClB,cAAc,CAAC,mBAAmB,EAAE,IAAI,EAAE,OAAO,CAAC;CA4DrD"}
|
package/dist/chat.js
CHANGED
|
@@ -4,20 +4,29 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export class ChatCompletions {
|
|
6
6
|
httpClient;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
config;
|
|
8
|
+
grpcClientInstance;
|
|
9
|
+
constructor(httpClient, config) {
|
|
9
10
|
this.httpClient = httpClient;
|
|
10
|
-
this.
|
|
11
|
+
this.config = config;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
async getGrpcClient() {
|
|
14
|
+
if (this.config.transport !== "grpc") {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
if (!this.grpcClientInstance) {
|
|
18
|
+
const { GrpcClient } = await import("./grpc-client.js");
|
|
19
|
+
this.grpcClientInstance = new GrpcClient(this.config);
|
|
20
|
+
}
|
|
21
|
+
return this.grpcClientInstance;
|
|
14
22
|
}
|
|
15
23
|
/**
|
|
16
24
|
* Create a chat completion (non-streaming)
|
|
17
25
|
*/
|
|
18
26
|
async create(request) {
|
|
19
|
-
|
|
20
|
-
|
|
27
|
+
const grpcClient = await this.getGrpcClient();
|
|
28
|
+
if (grpcClient) {
|
|
29
|
+
return grpcClient.createChatCompletion(request);
|
|
21
30
|
}
|
|
22
31
|
// Filter out undefined values to avoid sending them to the API
|
|
23
32
|
const filteredRequest = Object.fromEntries(Object.entries(request).filter(([_, value]) => value !== undefined));
|
|
@@ -32,8 +41,9 @@ export class ChatCompletions {
|
|
|
32
41
|
* Returns an async iterator over chunks
|
|
33
42
|
*/
|
|
34
43
|
async *createStream(request, signal) {
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
const grpcClient = await this.getGrpcClient();
|
|
45
|
+
if (grpcClient) {
|
|
46
|
+
for await (const chunk of grpcClient.createChatCompletionStream(request)) {
|
|
37
47
|
yield chunk;
|
|
38
48
|
}
|
|
39
49
|
return;
|
package/dist/chat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../src/chat.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../src/chat.ts"],"names":[],"mappings":"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"}
|
package/dist/client.d.ts
CHANGED
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,gBAAgB,EAAiB,MAAM,YAAY,CAAC;AAElE,qBAAa,UAAU;IACtB,SAAgB,IAAI,EAAE,eAAe,CAAC;IACtC,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;gBAE5B,MAAM,EAAE,gBAAgB;IAMpC,OAAO,CAAC,aAAa;IAIrB;;OAEG;IACH,SAAS,IAAI,MAAM;CAMnB"}
|
package/dist/client.js
CHANGED
|
@@ -3,21 +3,16 @@
|
|
|
3
3
|
* Main client class for interacting with Nova AI API
|
|
4
4
|
*/
|
|
5
5
|
import { ChatCompletions } from "./chat.js";
|
|
6
|
-
import { GrpcClient } from "./grpc-client.js";
|
|
7
6
|
import { HttpClient } from "./http-client.js";
|
|
8
7
|
import { Models } from "./models.js";
|
|
9
8
|
export class NovaClient {
|
|
10
9
|
chat;
|
|
11
10
|
models;
|
|
12
11
|
httpClient;
|
|
13
|
-
grpcClient;
|
|
14
12
|
constructor(config) {
|
|
15
13
|
this.httpClient = new HttpClient(config);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
this.chat = new ChatCompletions(this.httpClient, this.grpcClient);
|
|
20
|
-
this.models = new Models(this.httpClient, this.grpcClient);
|
|
14
|
+
this.chat = new ChatCompletions(this.httpClient, config);
|
|
15
|
+
this.models = new Models(this.httpClient, config);
|
|
21
16
|
}
|
|
22
17
|
shouldUseGrpc(transport) {
|
|
23
18
|
return transport === "grpc";
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,MAAM,OAAO,UAAU;IACN,IAAI,CAAkB;IACtB,MAAM,CAAS;IACd,UAAU,CAAa;IAExC,YAAY,MAAwB;QACnC,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;IAEO,aAAa,CAAC,SAAyB;QAC9C,OAAO,SAAS,KAAK,MAAM,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,SAAS;QACR,oEAAoE;QACpE,MAAM,GAAG,GAAI,IAAI,CAAC,UAAkB,CAAC,MAAgB,CAAC;QACtD,IAAI,GAAG,CAAC,MAAM,IAAI,EAAE;YAAE,OAAO,GAAG,CAAC;QACjC,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAChD,CAAC;CACD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export declare const NOVA_SERVICE_PROTO: string;
|
|
|
37
37
|
export declare const ENGINE_PROTO: string;
|
|
38
38
|
export { ChatCompletions } from "./chat.js";
|
|
39
39
|
export { NovaClient } from "./client.js";
|
|
40
|
-
export { GrpcClient } from "./grpc-client.js";
|
|
40
|
+
export type { GrpcClient } from "./grpc-client.js";
|
|
41
41
|
export { HttpClient } from "./http-client.js";
|
|
42
42
|
export { Models } from "./models.js";
|
|
43
43
|
export type { ChatCompletionChoice, ChatCompletionChunk, ChatCompletionChunkChoice, ChatCompletionError, ChatCompletionRequest, ChatCompletionResponse, ChatCompletionUsage, ChatMessage, Model, NovaClientConfig, NovaTransport, } from "./types.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAOH,eAAO,MAAM,kBAAkB,QAI9B,CAAC;AACF,eAAO,MAAM,YAAY,QAA2C,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAOH,eAAO,MAAM,kBAAkB,QAI9B,CAAC;AACF,eAAO,MAAM,YAAY,QAA2C,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EACX,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,WAAW,EACX,KAAK,EACL,gBAAgB,EAChB,aAAa,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -40,7 +40,6 @@ export const NOVA_SERVICE_PROTO = join(__dirname, "proto", "nova-service.proto")
|
|
|
40
40
|
export const ENGINE_PROTO = join(__dirname, "proto", "engine.proto");
|
|
41
41
|
export { ChatCompletions } from "./chat.js";
|
|
42
42
|
export { NovaClient } from "./client.js";
|
|
43
|
-
export { GrpcClient } from "./grpc-client.js";
|
|
44
43
|
export { HttpClient } from "./http-client.js";
|
|
45
44
|
export { Models } from "./models.js";
|
|
46
45
|
export { NovaError } from "./types.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CACrC,SAAS,EACT,OAAO,EACP,oBAAoB,CACpB,CAAC;AACF,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CACrC,SAAS,EACT,OAAO,EACP,oBAAoB,CACpB,CAAC;AACF,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAcrC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/models.d.ts
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Models API
|
|
3
3
|
* Handles model listing and retrieval
|
|
4
4
|
*/
|
|
5
|
-
import { GrpcClient } from "./grpc-client.js";
|
|
6
5
|
import { HttpClient } from "./http-client.js";
|
|
7
|
-
import type { Model } from "./types.js";
|
|
6
|
+
import type { Model, NovaClientConfig } from "./types.js";
|
|
8
7
|
export declare class Models {
|
|
9
8
|
private readonly httpClient;
|
|
10
|
-
private readonly
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
private readonly config;
|
|
10
|
+
private grpcClientInstance?;
|
|
11
|
+
constructor(httpClient: HttpClient, config: NovaClientConfig);
|
|
12
|
+
private getGrpcClient;
|
|
13
13
|
/**
|
|
14
14
|
* List all available models for the API key
|
|
15
15
|
*/
|
package/dist/models.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE1D,qBAAa,MAAM;IAIjB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJxB,OAAO,CAAC,kBAAkB,CAAC,CAAa;gBAGtB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,gBAAgB;YAG5B,aAAa;IAW3B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;IAU9B;;OAEG;IACG,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;CAI1C"}
|
package/dist/models.js
CHANGED
|
@@ -4,20 +4,29 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export class Models {
|
|
6
6
|
httpClient;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
config;
|
|
8
|
+
grpcClientInstance;
|
|
9
|
+
constructor(httpClient, config) {
|
|
9
10
|
this.httpClient = httpClient;
|
|
10
|
-
this.
|
|
11
|
+
this.config = config;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
async getGrpcClient() {
|
|
14
|
+
if (this.config.transport !== "grpc") {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
if (!this.grpcClientInstance) {
|
|
18
|
+
const { GrpcClient } = await import("./grpc-client.js");
|
|
19
|
+
this.grpcClientInstance = new GrpcClient(this.config);
|
|
20
|
+
}
|
|
21
|
+
return this.grpcClientInstance;
|
|
14
22
|
}
|
|
15
23
|
/**
|
|
16
24
|
* List all available models for the API key
|
|
17
25
|
*/
|
|
18
26
|
async list() {
|
|
19
|
-
|
|
20
|
-
|
|
27
|
+
const grpcClient = await this.getGrpcClient();
|
|
28
|
+
if (grpcClient) {
|
|
29
|
+
return grpcClient.listModels();
|
|
21
30
|
}
|
|
22
31
|
const response = await this.httpClient.get("v1/models");
|
|
23
32
|
return response.data || [];
|
package/dist/models.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,OAAO,MAAM;
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,OAAO,MAAM;IAIA;IACA;IAJV,kBAAkB,CAAc;IAExC,YACkB,UAAsB,EACtB,MAAwB;QADxB,eAAU,GAAV,UAAU,CAAY;QACtB,WAAM,GAAN,MAAM,CAAkB;IACvC,CAAC;IAEI,KAAK,CAAC,aAAa;QAC1B,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,KAAK,MAAM,EAAE,CAAC;YACtC,OAAO,SAAS,CAAC;QAClB,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC9B,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;YACxD,IAAI,CAAC,kBAAkB,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvD,CAAC;QACD,OAAO,IAAI,CAAC,kBAAkB,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI;QACT,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QAC9C,IAAI,UAAU,EAAE,CAAC;YAChB,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC;QAChC,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAoB,WAAW,CAAC,CAAC;QAC3E,OAAO,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,OAAe;QACxB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAQ,aAAa,OAAO,EAAE,CAAC,CAAC;QAC1E,OAAO,QAAQ,CAAC;IACjB,CAAC;CACD"}
|
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package engine;
|
|
4
|
+
|
|
5
|
+
// ===================================================================
|
|
6
|
+
// NOVA ENGINE SERVICE
|
|
7
|
+
// ===================================================================
|
|
8
|
+
// Multi-modal AI generation service with intelligent model selection
|
|
9
|
+
|
|
10
|
+
service EngineService {
|
|
11
|
+
// Model Selection
|
|
12
|
+
rpc SelectModel(SelectModelRequest) returns (SelectModelResponse);
|
|
13
|
+
rpc GetAvailableModels(GetModelsRequest) returns (GetModelsResponse);
|
|
14
|
+
rpc GetModelPresets(GetPresetsRequest) returns (GetPresetsResponse);
|
|
15
|
+
|
|
16
|
+
// Generation - Text
|
|
17
|
+
rpc GenerateText(GenerateTextRequest) returns (stream GenerateTextResponse);
|
|
18
|
+
|
|
19
|
+
// Generation - Image (Future)
|
|
20
|
+
rpc GenerateImage(GenerateImageRequest) returns (GenerateImageResponse);
|
|
21
|
+
|
|
22
|
+
// Generation - Video (Future)
|
|
23
|
+
rpc GenerateVideo(GenerateVideoRequest) returns (GenerateVideoResponse);
|
|
24
|
+
|
|
25
|
+
// Generation - Audio (Future)
|
|
26
|
+
rpc GenerateAudio(GenerateAudioRequest) returns (GenerateAudioResponse);
|
|
27
|
+
|
|
28
|
+
// Provider Management
|
|
29
|
+
rpc GetProviders(GetProvidersRequest) returns (GetProvidersResponse);
|
|
30
|
+
rpc UpdateProvider(UpdateProviderRequest) returns (UpdateProviderResponse);
|
|
31
|
+
rpc CheckProviderHealth(CheckHealthRequest) returns (CheckHealthResponse);
|
|
32
|
+
|
|
33
|
+
// Analytics & Metrics
|
|
34
|
+
rpc GetGenerationMetrics(GetMetricsRequest) returns (GetMetricsResponse);
|
|
35
|
+
rpc GetUsageStats(GetUsageStatsRequest) returns (GetUsageStatsResponse);
|
|
36
|
+
|
|
37
|
+
// Cache Management
|
|
38
|
+
rpc ClearCache(ClearCacheRequest) returns (ClearCacheResponse);
|
|
39
|
+
rpc GetCacheStats(CacheStatsRequest) returns (CacheStatsResponse);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ===================================================================
|
|
43
|
+
// COMMON MESSAGES
|
|
44
|
+
// ===================================================================
|
|
45
|
+
|
|
46
|
+
message Empty {}
|
|
47
|
+
|
|
48
|
+
message ErrorResponse {
|
|
49
|
+
string code = 1;
|
|
50
|
+
string message = 2;
|
|
51
|
+
map<string, string> details = 3;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// ===================================================================
|
|
55
|
+
// MODEL SELECTION MESSAGES
|
|
56
|
+
// ===================================================================
|
|
57
|
+
|
|
58
|
+
message SelectModelRequest {
|
|
59
|
+
string character_id = 1;
|
|
60
|
+
string generation_type = 2; // "text", "image", "video", "audio"
|
|
61
|
+
optional string preferred_provider = 3;
|
|
62
|
+
optional string preferred_model = 4;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
message SelectModelResponse {
|
|
66
|
+
string model_id = 1;
|
|
67
|
+
string model_name = 2;
|
|
68
|
+
string model_identifier = 3;
|
|
69
|
+
string provider = 4;
|
|
70
|
+
string integration_id = 5;
|
|
71
|
+
ModelConfig config = 6;
|
|
72
|
+
bool success = 7;
|
|
73
|
+
optional string error_message = 8;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
message ModelConfig {
|
|
77
|
+
optional double temperature = 1;
|
|
78
|
+
optional int32 max_tokens = 2;
|
|
79
|
+
optional double top_p = 3;
|
|
80
|
+
repeated string stop_sequences = 4;
|
|
81
|
+
map<string, string> additional_params = 5;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
message GetModelsRequest {
|
|
85
|
+
string generation_type = 1;
|
|
86
|
+
optional bool active_only = 2;
|
|
87
|
+
optional string provider = 3;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
message GetModelsResponse {
|
|
91
|
+
repeated ModelInfo models = 1;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
message ModelInfo {
|
|
95
|
+
string id = 1;
|
|
96
|
+
string name = 2;
|
|
97
|
+
string identifier = 3;
|
|
98
|
+
string type = 4;
|
|
99
|
+
string provider = 5;
|
|
100
|
+
string provider_name = 6;
|
|
101
|
+
bool is_active = 7;
|
|
102
|
+
bool is_default = 8;
|
|
103
|
+
int32 priority = 9;
|
|
104
|
+
optional ModelConfig default_config = 10;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
message GetPresetsRequest {
|
|
108
|
+
optional string tier = 1;
|
|
109
|
+
optional bool active_only = 2;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
message GetPresetsResponse {
|
|
113
|
+
repeated PresetInfo presets = 1;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
message PresetInfo {
|
|
117
|
+
string id = 1;
|
|
118
|
+
string name = 2;
|
|
119
|
+
string description = 3;
|
|
120
|
+
string tier = 4;
|
|
121
|
+
bool is_active = 5;
|
|
122
|
+
bool is_default = 6;
|
|
123
|
+
optional ModelInfo model = 7;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// ===================================================================
|
|
127
|
+
// TEXT GENERATION MESSAGES
|
|
128
|
+
// ===================================================================
|
|
129
|
+
|
|
130
|
+
message GenerateTextRequest {
|
|
131
|
+
string request_id = 1;
|
|
132
|
+
string model_id = 2;
|
|
133
|
+
repeated ChatMessage messages = 3;
|
|
134
|
+
optional string character_id = 4;
|
|
135
|
+
optional string user_id = 5;
|
|
136
|
+
optional string message_id = 6;
|
|
137
|
+
map<string, string> metadata = 7;
|
|
138
|
+
ModelConfig config = 8;
|
|
139
|
+
bool stream = 9;
|
|
140
|
+
optional string prompt = 10;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
message ChatMessage {
|
|
144
|
+
string role = 1; // "user", "assistant", "system"
|
|
145
|
+
string content = 2;
|
|
146
|
+
optional string name = 3;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
message GenerateTextResponse {
|
|
150
|
+
string request_id = 1;
|
|
151
|
+
string content = 2; // Text chunk for streaming
|
|
152
|
+
bool is_complete = 3;
|
|
153
|
+
optional GenerationMetadata generation_metadata = 4;
|
|
154
|
+
optional string error_message = 5;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
message GenerationMetadata {
|
|
158
|
+
int32 tokens_used = 1;
|
|
159
|
+
int32 input_tokens = 2;
|
|
160
|
+
int32 output_tokens = 3;
|
|
161
|
+
int32 response_time_ms = 4;
|
|
162
|
+
bool cache_hit = 5;
|
|
163
|
+
bool semantic_match = 6;
|
|
164
|
+
string model_used = 7;
|
|
165
|
+
string provider_used = 8;
|
|
166
|
+
optional double estimated_cost = 9;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// ===================================================================
|
|
170
|
+
// IMAGE GENERATION MESSAGES
|
|
171
|
+
// ===================================================================
|
|
172
|
+
|
|
173
|
+
message GenerateImageRequest {
|
|
174
|
+
string request_id = 1;
|
|
175
|
+
string model_id = 2;
|
|
176
|
+
string prompt = 3;
|
|
177
|
+
optional string negative_prompt = 4;
|
|
178
|
+
optional string character_id = 5;
|
|
179
|
+
optional string user_id = 6;
|
|
180
|
+
ImageConfig config = 7;
|
|
181
|
+
map<string, string> metadata = 8;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
message ImageConfig {
|
|
185
|
+
int32 width = 1;
|
|
186
|
+
int32 height = 2;
|
|
187
|
+
int32 num_images = 3;
|
|
188
|
+
optional string style = 4;
|
|
189
|
+
optional double guidance_scale = 5;
|
|
190
|
+
optional int32 steps = 6;
|
|
191
|
+
optional string quality = 7; // "standard", "hd"
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
message GenerateImageResponse {
|
|
195
|
+
string request_id = 1;
|
|
196
|
+
repeated string image_urls = 2;
|
|
197
|
+
repeated bytes image_data = 3; // Optional raw image data
|
|
198
|
+
GenerationMetadata generation_metadata = 4;
|
|
199
|
+
bool success = 5;
|
|
200
|
+
optional string error_message = 6;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// ===================================================================
|
|
204
|
+
// VIDEO GENERATION MESSAGES
|
|
205
|
+
// ===================================================================
|
|
206
|
+
|
|
207
|
+
message GenerateVideoRequest {
|
|
208
|
+
string request_id = 1;
|
|
209
|
+
string model_id = 2;
|
|
210
|
+
string prompt = 3;
|
|
211
|
+
optional string character_id = 4;
|
|
212
|
+
optional string user_id = 5;
|
|
213
|
+
VideoConfig config = 6;
|
|
214
|
+
map<string, string> metadata = 7;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
message VideoConfig {
|
|
218
|
+
int32 duration_seconds = 1;
|
|
219
|
+
optional int32 fps = 2;
|
|
220
|
+
optional string resolution = 3; // "720p", "1080p", "4k"
|
|
221
|
+
optional string style = 4;
|
|
222
|
+
optional string aspect_ratio = 5; // "16:9", "9:16", "1:1"
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
message GenerateVideoResponse {
|
|
226
|
+
string request_id = 1;
|
|
227
|
+
string video_url = 2;
|
|
228
|
+
optional string thumbnail_url = 3;
|
|
229
|
+
GenerationMetadata generation_metadata = 4;
|
|
230
|
+
bool success = 5;
|
|
231
|
+
optional string error_message = 6;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// ===================================================================
|
|
235
|
+
// AUDIO GENERATION MESSAGES
|
|
236
|
+
// ===================================================================
|
|
237
|
+
|
|
238
|
+
message GenerateAudioRequest {
|
|
239
|
+
string request_id = 1;
|
|
240
|
+
string model_id = 2;
|
|
241
|
+
string text = 3;
|
|
242
|
+
optional string character_id = 4;
|
|
243
|
+
optional string user_id = 5;
|
|
244
|
+
AudioConfig config = 6;
|
|
245
|
+
map<string, string> metadata = 7;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
message AudioConfig {
|
|
249
|
+
optional string voice = 1;
|
|
250
|
+
optional double speed = 2;
|
|
251
|
+
optional int32 sample_rate = 3;
|
|
252
|
+
optional string format = 4; // "mp3", "wav", "ogg"
|
|
253
|
+
optional double stability = 5;
|
|
254
|
+
optional double similarity_boost = 6;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
message GenerateAudioResponse {
|
|
258
|
+
string request_id = 1;
|
|
259
|
+
string audio_url = 2;
|
|
260
|
+
optional bytes audio_data = 3;
|
|
261
|
+
GenerationMetadata generation_metadata = 4;
|
|
262
|
+
bool success = 5;
|
|
263
|
+
optional string error_message = 6;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// ===================================================================
|
|
267
|
+
// PROVIDER MANAGEMENT MESSAGES
|
|
268
|
+
// ===================================================================
|
|
269
|
+
|
|
270
|
+
message GetProvidersRequest {
|
|
271
|
+
optional string type = 1; // Filter by type: "text", "image", "video", "audio"
|
|
272
|
+
optional bool enabled_only = 2;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
message GetProvidersResponse {
|
|
276
|
+
repeated ProviderInfo providers = 1;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
message ProviderInfo {
|
|
280
|
+
string id = 1;
|
|
281
|
+
string name = 2;
|
|
282
|
+
string provider = 3;
|
|
283
|
+
string type = 4;
|
|
284
|
+
bool is_enabled = 5;
|
|
285
|
+
string status = 6;
|
|
286
|
+
int32 priority = 7;
|
|
287
|
+
ProviderHealth health = 8;
|
|
288
|
+
repeated string supported_features = 9;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
message ProviderHealth {
|
|
292
|
+
bool is_healthy = 1;
|
|
293
|
+
int64 last_check_timestamp = 2;
|
|
294
|
+
optional int32 response_time_ms = 3;
|
|
295
|
+
optional string error_message = 4;
|
|
296
|
+
double uptime_percentage = 5;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
message UpdateProviderRequest {
|
|
300
|
+
string provider_id = 1;
|
|
301
|
+
optional bool is_enabled = 2;
|
|
302
|
+
optional string status = 3;
|
|
303
|
+
optional int32 priority = 4;
|
|
304
|
+
map<string, string> config_updates = 5;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
message UpdateProviderResponse {
|
|
308
|
+
bool success = 1;
|
|
309
|
+
string message = 2;
|
|
310
|
+
optional ProviderInfo updated_provider = 3;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
message CheckHealthRequest {
|
|
314
|
+
optional string provider_id = 1; // Check specific provider or all if empty
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
message CheckHealthResponse {
|
|
318
|
+
map<string, ProviderHealth> health_status = 1;
|
|
319
|
+
int32 healthy_count = 2;
|
|
320
|
+
int32 total_count = 3;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// ===================================================================
|
|
324
|
+
// ANALYTICS MESSAGES
|
|
325
|
+
// ===================================================================
|
|
326
|
+
|
|
327
|
+
message GetMetricsRequest {
|
|
328
|
+
string period_type = 1; // "hourly", "daily", "monthly"
|
|
329
|
+
int64 start_timestamp = 2;
|
|
330
|
+
int64 end_timestamp = 3;
|
|
331
|
+
optional string generation_type = 4;
|
|
332
|
+
optional string provider_id = 5;
|
|
333
|
+
optional string model_id = 6;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
message GetMetricsResponse {
|
|
337
|
+
repeated MetricData metrics = 1;
|
|
338
|
+
MetricSummary summary = 2;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
message MetricData {
|
|
342
|
+
int64 period_start = 1;
|
|
343
|
+
int64 period_end = 2;
|
|
344
|
+
string generation_type = 3;
|
|
345
|
+
int32 total_requests = 4;
|
|
346
|
+
int32 successful_requests = 5;
|
|
347
|
+
int32 failed_requests = 6;
|
|
348
|
+
int32 cached_requests = 7;
|
|
349
|
+
double avg_response_time = 8;
|
|
350
|
+
double p95_response_time = 9;
|
|
351
|
+
double cache_hit_rate = 10;
|
|
352
|
+
TokenUsage token_usage = 11;
|
|
353
|
+
double total_cost = 12;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
message MetricSummary {
|
|
357
|
+
int32 total_requests = 1;
|
|
358
|
+
int32 total_successful = 2;
|
|
359
|
+
int32 total_failed = 3;
|
|
360
|
+
int32 total_cached = 4;
|
|
361
|
+
double overall_cache_hit_rate = 5;
|
|
362
|
+
double total_cost = 6;
|
|
363
|
+
TokenUsage total_tokens = 7;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
message TokenUsage {
|
|
367
|
+
int32 input_tokens = 1;
|
|
368
|
+
int32 output_tokens = 2;
|
|
369
|
+
int32 total_tokens = 3;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
message GetUsageStatsRequest {
|
|
373
|
+
optional string character_id = 1;
|
|
374
|
+
optional string user_id = 2;
|
|
375
|
+
int64 start_timestamp = 3;
|
|
376
|
+
int64 end_timestamp = 4;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
message GetUsageStatsResponse {
|
|
380
|
+
map<string, int32> generations_by_type = 1;
|
|
381
|
+
TokenUsage total_tokens = 2;
|
|
382
|
+
double total_cost = 3;
|
|
383
|
+
int32 cache_hits = 4;
|
|
384
|
+
double cache_hit_rate = 5;
|
|
385
|
+
repeated ModelUsage model_usage = 6;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
message ModelUsage {
|
|
389
|
+
string model_id = 1;
|
|
390
|
+
string model_name = 2;
|
|
391
|
+
int32 request_count = 3;
|
|
392
|
+
TokenUsage tokens = 4;
|
|
393
|
+
double cost = 5;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// ===================================================================
|
|
397
|
+
// CACHE MANAGEMENT MESSAGES
|
|
398
|
+
// ===================================================================
|
|
399
|
+
|
|
400
|
+
message ClearCacheRequest {
|
|
401
|
+
optional string cache_type = 1; // "all", "generation", "model", "embedding"
|
|
402
|
+
optional string generation_type = 2; // Clear cache for specific type
|
|
403
|
+
optional bool force = 3; // Force clear even if recently used
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
message ClearCacheResponse {
|
|
407
|
+
bool success = 1;
|
|
408
|
+
string message = 2;
|
|
409
|
+
int32 entries_cleared = 3;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
message CacheStatsRequest {
|
|
413
|
+
optional string cache_type = 1;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
message CacheStatsResponse {
|
|
417
|
+
int64 total_entries = 1;
|
|
418
|
+
int64 total_hits = 2;
|
|
419
|
+
int64 total_misses = 3;
|
|
420
|
+
double hit_rate = 4;
|
|
421
|
+
int64 memory_usage_bytes = 5;
|
|
422
|
+
map<string, CacheTypeStats> stats_by_type = 6;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
message CacheTypeStats {
|
|
426
|
+
string type = 1;
|
|
427
|
+
int64 entries = 2;
|
|
428
|
+
int64 hits = 3;
|
|
429
|
+
int64 misses = 4;
|
|
430
|
+
double hit_rate = 5;
|
|
431
|
+
}
|