@breign/client 1.0.155 → 1.0.157

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.
@@ -10,7 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { EphemeralInstancesMetricsResponseUio, MetricForAgentUio, MetricForDayInnerUio, MetricUio, MetricsBrainsAgentResponseUio, MetricsTopAgentsResponseInnerUio, MetricsTopAgentsUsageResponseInnerUio, MetricsUsersResponseUio, OrgUsageMetricsResponseUio } from '../models/index';
13
+ import type { EphemeralInstancesMetricsResponseUio, MetricForAgentUio, MetricForDayInnerUio, MetricUio, MetricsBrainsAgentResponseUio, MetricsTopAgentsResponseInnerUio, MetricsTopAgentsUsageResponseInnerUio, MetricsUsersResponseUio, OrgUsageMetricsResponseUio, OrganizationModelConsumptionUio } from '../models/index';
14
14
  export interface GetBrainsMetricsRequest {
15
15
  startDate?: string;
16
16
  endDate?: string;
@@ -34,6 +34,11 @@ export interface GetMetricsOrganizationEphemeralInstancesRequest {
34
34
  endDate?: string;
35
35
  granularity?: GetMetricsOrganizationEphemeralInstancesGranularityEnum;
36
36
  }
37
+ export interface GetMetricsOrganizationModelConsumptionRequest {
38
+ organizationId: string;
39
+ startDate?: string;
40
+ endDate?: string;
41
+ }
37
42
  export interface GetMetricsOrganizationUsageRequest {
38
43
  organizationId: string;
39
44
  startDate?: string;
@@ -111,6 +116,16 @@ export declare class MetricsApi extends runtime.BaseAPI {
111
116
  * Get ephemeral instances metrics for an organization
112
117
  */
113
118
  getMetricsOrganizationEphemeralInstances(organizationId: string, startDate?: string, endDate?: string, granularity?: GetMetricsOrganizationEphemeralInstancesGranularityEnum, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EphemeralInstancesMetricsResponseUio>;
119
+ /**
120
+ * Tokens consumed by model and provider, split between agents, organization costs without an agent, direct AI Gateway calls, and users. Restricted to organization administrators.
121
+ * Get model consumption for an organization
122
+ */
123
+ getMetricsOrganizationModelConsumptionRaw(requestParameters: GetMetricsOrganizationModelConsumptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<OrganizationModelConsumptionUio>>;
124
+ /**
125
+ * Tokens consumed by model and provider, split between agents, organization costs without an agent, direct AI Gateway calls, and users. Restricted to organization administrators.
126
+ * Get model consumption for an organization
127
+ */
128
+ getMetricsOrganizationModelConsumption(organizationId: string, startDate?: string, endDate?: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<OrganizationModelConsumptionUio>;
114
129
  /**
115
130
  * Returns LLM requests and token usage over time for all agents in the organization
116
131
  * Get usage metrics for an organization
@@ -222,6 +222,41 @@ class MetricsApi extends runtime.BaseAPI {
222
222
  const response = await this.getMetricsOrganizationEphemeralInstancesRaw({ organizationId: organizationId, startDate: startDate, endDate: endDate, granularity: granularity }, initOverrides);
223
223
  return await response.value();
224
224
  }
225
+ /**
226
+ * Tokens consumed by model and provider, split between agents, organization costs without an agent, direct AI Gateway calls, and users. Restricted to organization administrators.
227
+ * Get model consumption for an organization
228
+ */
229
+ async getMetricsOrganizationModelConsumptionRaw(requestParameters, initOverrides) {
230
+ if (requestParameters['organizationId'] == null) {
231
+ throw new runtime.RequiredError('organizationId', 'Required parameter "organizationId" was null or undefined when calling getMetricsOrganizationModelConsumption().');
232
+ }
233
+ const queryParameters = {};
234
+ if (requestParameters['startDate'] != null) {
235
+ queryParameters['startDate'] = requestParameters['startDate'];
236
+ }
237
+ if (requestParameters['endDate'] != null) {
238
+ queryParameters['endDate'] = requestParameters['endDate'];
239
+ }
240
+ const headerParameters = {};
241
+ if (this.configuration && this.configuration.apiKey) {
242
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
243
+ }
244
+ const response = await this.request({
245
+ path: `/metrics/organizations/{organizationId}/model-consumption`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters['organizationId']))),
246
+ method: 'GET',
247
+ headers: headerParameters,
248
+ query: queryParameters,
249
+ }, initOverrides);
250
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.OrganizationModelConsumptionUioFromJSON)(jsonValue));
251
+ }
252
+ /**
253
+ * Tokens consumed by model and provider, split between agents, organization costs without an agent, direct AI Gateway calls, and users. Restricted to organization administrators.
254
+ * Get model consumption for an organization
255
+ */
256
+ async getMetricsOrganizationModelConsumption(organizationId, startDate, endDate, initOverrides) {
257
+ const response = await this.getMetricsOrganizationModelConsumptionRaw({ organizationId: organizationId, startDate: startDate, endDate: endDate }, initOverrides);
258
+ return await response.value();
259
+ }
225
260
  /**
226
261
  * Returns LLM requests and token usage over time for all agents in the organization
227
262
  * Get usage metrics for an organization
@@ -120,6 +120,12 @@ export interface FileCreationResponseUio {
120
120
  * @memberof FileCreationResponseUio
121
121
  */
122
122
  status?: FileStatusUio;
123
+ /**
124
+ * Why the file ended in ERROR; null otherwise.
125
+ * @type {string}
126
+ * @memberof FileCreationResponseUio
127
+ */
128
+ error?: string | null;
123
129
  /**
124
130
  *
125
131
  * @type {boolean}
@@ -65,6 +65,7 @@ function FileCreationResponseUioFromJSONTyped(json, ignoreDiscriminator) {
65
65
  'createdAt': json['createdAt'] == null ? undefined : json['createdAt'],
66
66
  'updatedAt': json['updatedAt'] == null ? undefined : json['updatedAt'],
67
67
  'status': json['status'] == null ? undefined : (0, FileStatusUio_1.FileStatusUioFromJSON)(json['status']),
68
+ 'error': json['error'] == null ? undefined : json['error'],
68
69
  'isActive': json['isActive'] == null ? undefined : json['isActive'],
69
70
  };
70
71
  }
@@ -93,6 +94,7 @@ function FileCreationResponseUioToJSONTyped(value, ignoreDiscriminator = false)
93
94
  'createdAt': value['createdAt'],
94
95
  'updatedAt': value['updatedAt'],
95
96
  'status': (0, FileStatusUio_1.FileStatusUioToJSON)(value['status']),
97
+ 'error': value['error'],
96
98
  'isActive': value['isActive'],
97
99
  };
98
100
  }
@@ -19,6 +19,7 @@ export declare const FileStatusUio: {
19
19
  readonly Uploaded: "UPLOADED";
20
20
  readonly Processing: "PROCESSING";
21
21
  readonly Indexed: "INDEXED";
22
+ readonly Error: "ERROR";
22
23
  };
23
24
  export type FileStatusUio = typeof FileStatusUio[keyof typeof FileStatusUio];
24
25
  export declare function instanceOfFileStatusUio(value: any): boolean;
@@ -28,7 +28,8 @@ exports.FileStatusUio = {
28
28
  Pending: 'PENDING',
29
29
  Uploaded: 'UPLOADED',
30
30
  Processing: 'PROCESSING',
31
- Indexed: 'INDEXED'
31
+ Indexed: 'INDEXED',
32
+ Error: 'ERROR'
32
33
  };
33
34
  function instanceOfFileStatusUio(value) {
34
35
  for (const key in exports.FileStatusUio) {
@@ -120,6 +120,12 @@ export interface FileUio {
120
120
  * @memberof FileUio
121
121
  */
122
122
  status?: FileStatusUio;
123
+ /**
124
+ * Why the file ended in ERROR; null otherwise.
125
+ * @type {string}
126
+ * @memberof FileUio
127
+ */
128
+ error?: string | null;
123
129
  /**
124
130
  *
125
131
  * @type {boolean}
@@ -61,6 +61,7 @@ function FileUioFromJSONTyped(json, ignoreDiscriminator) {
61
61
  'createdAt': json['createdAt'] == null ? undefined : json['createdAt'],
62
62
  'updatedAt': json['updatedAt'] == null ? undefined : json['updatedAt'],
63
63
  'status': json['status'] == null ? undefined : (0, FileStatusUio_1.FileStatusUioFromJSON)(json['status']),
64
+ 'error': json['error'] == null ? undefined : json['error'],
64
65
  'isActive': json['isActive'] == null ? undefined : json['isActive'],
65
66
  };
66
67
  }
@@ -89,6 +90,7 @@ function FileUioToJSONTyped(value, ignoreDiscriminator = false) {
89
90
  'createdAt': value['createdAt'],
90
91
  'updatedAt': value['updatedAt'],
91
92
  'status': (0, FileStatusUio_1.FileStatusUioToJSON)(value['status']),
93
+ 'error': value['error'],
92
94
  'isActive': value['isActive'],
93
95
  };
94
96
  }
@@ -120,6 +120,12 @@ export interface FileWithDownloadUrlUio {
120
120
  * @memberof FileWithDownloadUrlUio
121
121
  */
122
122
  status?: FileStatusUio;
123
+ /**
124
+ * Why the file ended in ERROR; null otherwise.
125
+ * @type {string}
126
+ * @memberof FileWithDownloadUrlUio
127
+ */
128
+ error?: string | null;
123
129
  /**
124
130
  *
125
131
  * @type {boolean}
@@ -63,6 +63,7 @@ function FileWithDownloadUrlUioFromJSONTyped(json, ignoreDiscriminator) {
63
63
  'createdAt': json['createdAt'] == null ? undefined : json['createdAt'],
64
64
  'updatedAt': json['updatedAt'] == null ? undefined : json['updatedAt'],
65
65
  'status': json['status'] == null ? undefined : (0, FileStatusUio_1.FileStatusUioFromJSON)(json['status']),
66
+ 'error': json['error'] == null ? undefined : json['error'],
66
67
  'isActive': json['isActive'] == null ? undefined : json['isActive'],
67
68
  'downloadURL': json['downloadURL'],
68
69
  };
@@ -92,6 +93,7 @@ function FileWithDownloadUrlUioToJSONTyped(value, ignoreDiscriminator = false) {
92
93
  'createdAt': value['createdAt'],
93
94
  'updatedAt': value['updatedAt'],
94
95
  'status': (0, FileStatusUio_1.FileStatusUioToJSON)(value['status']),
96
+ 'error': value['error'],
95
97
  'isActive': value['isActive'],
96
98
  'downloadURL': value['downloadURL'],
97
99
  };
@@ -120,6 +120,12 @@ export interface KnowledgeFileUio {
120
120
  * @memberof KnowledgeFileUio
121
121
  */
122
122
  status?: FileStatusUio;
123
+ /**
124
+ * Why the file ended in ERROR; null otherwise.
125
+ * @type {string}
126
+ * @memberof KnowledgeFileUio
127
+ */
128
+ error?: string | null;
123
129
  /**
124
130
  *
125
131
  * @type {boolean}
@@ -61,6 +61,7 @@ function KnowledgeFileUioFromJSONTyped(json, ignoreDiscriminator) {
61
61
  'createdAt': json['createdAt'] == null ? undefined : json['createdAt'],
62
62
  'updatedAt': json['updatedAt'] == null ? undefined : json['updatedAt'],
63
63
  'status': json['status'] == null ? undefined : (0, FileStatusUio_1.FileStatusUioFromJSON)(json['status']),
64
+ 'error': json['error'] == null ? undefined : json['error'],
64
65
  'isActive': json['isActive'] == null ? undefined : json['isActive'],
65
66
  };
66
67
  }
@@ -89,6 +90,7 @@ function KnowledgeFileUioToJSONTyped(value, ignoreDiscriminator = false) {
89
90
  'createdAt': value['createdAt'],
90
91
  'updatedAt': value['updatedAt'],
91
92
  'status': (0, FileStatusUio_1.FileStatusUioToJSON)(value['status']),
93
+ 'error': value['error'],
92
94
  'isActive': value['isActive'],
93
95
  };
94
96
  }
@@ -0,0 +1,81 @@
1
+ /**
2
+ * brain-client
3
+ * Api ands models for brain-app and brain-app
4
+ *
5
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import type { ModelConsumptionSliceUio } from './ModelConsumptionSliceUio';
13
+ /**
14
+ *
15
+ * @export
16
+ * @interface ModelConsumptionItemUio
17
+ */
18
+ export interface ModelConsumptionItemUio {
19
+ /**
20
+ * Identifiant stable du moteur. Les lignes historiques d'agent portent encore le type (openai, mistral).
21
+ * @type {string}
22
+ * @memberof ModelConsumptionItemUio
23
+ */
24
+ provider: string;
25
+ /**
26
+ * Nom du moteur écrit au moment de l'appel. Repli sur l'identifiant lorsqu'aucun nom n'est connu.
27
+ * @type {string}
28
+ * @memberof ModelConsumptionItemUio
29
+ */
30
+ providerName: string;
31
+ /**
32
+ *
33
+ * @type {string}
34
+ * @memberof ModelConsumptionItemUio
35
+ */
36
+ model: string;
37
+ /**
38
+ *
39
+ * @type {number}
40
+ * @memberof ModelConsumptionItemUio
41
+ */
42
+ requests: number;
43
+ /**
44
+ *
45
+ * @type {number}
46
+ * @memberof ModelConsumptionItemUio
47
+ */
48
+ inputTokens: number;
49
+ /**
50
+ *
51
+ * @type {number}
52
+ * @memberof ModelConsumptionItemUio
53
+ */
54
+ outputTokens: number;
55
+ /**
56
+ *
57
+ * @type {number}
58
+ * @memberof ModelConsumptionItemUio
59
+ */
60
+ totalTokens: number;
61
+ /**
62
+ *
63
+ * @type {Array<ModelConsumptionSliceUio>}
64
+ * @memberof ModelConsumptionItemUio
65
+ */
66
+ sources: Array<ModelConsumptionSliceUio>;
67
+ /**
68
+ *
69
+ * @type {Array<ModelConsumptionSliceUio>}
70
+ * @memberof ModelConsumptionItemUio
71
+ */
72
+ users: Array<ModelConsumptionSliceUio>;
73
+ }
74
+ /**
75
+ * Check if a given object implements the ModelConsumptionItemUio interface.
76
+ */
77
+ export declare function instanceOfModelConsumptionItemUio(value: object): value is ModelConsumptionItemUio;
78
+ export declare function ModelConsumptionItemUioFromJSON(json: any): ModelConsumptionItemUio;
79
+ export declare function ModelConsumptionItemUioFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelConsumptionItemUio;
80
+ export declare function ModelConsumptionItemUioToJSON(json: any): ModelConsumptionItemUio;
81
+ export declare function ModelConsumptionItemUioToJSONTyped(value?: ModelConsumptionItemUio | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * brain-client
6
+ * Api ands models for brain-app and brain-app
7
+ *
8
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.instanceOfModelConsumptionItemUio = instanceOfModelConsumptionItemUio;
17
+ exports.ModelConsumptionItemUioFromJSON = ModelConsumptionItemUioFromJSON;
18
+ exports.ModelConsumptionItemUioFromJSONTyped = ModelConsumptionItemUioFromJSONTyped;
19
+ exports.ModelConsumptionItemUioToJSON = ModelConsumptionItemUioToJSON;
20
+ exports.ModelConsumptionItemUioToJSONTyped = ModelConsumptionItemUioToJSONTyped;
21
+ const ModelConsumptionSliceUio_1 = require("./ModelConsumptionSliceUio");
22
+ /**
23
+ * Check if a given object implements the ModelConsumptionItemUio interface.
24
+ */
25
+ function instanceOfModelConsumptionItemUio(value) {
26
+ if (!('provider' in value) || value['provider'] === undefined)
27
+ return false;
28
+ if (!('providerName' in value) || value['providerName'] === undefined)
29
+ return false;
30
+ if (!('model' in value) || value['model'] === undefined)
31
+ return false;
32
+ if (!('requests' in value) || value['requests'] === undefined)
33
+ return false;
34
+ if (!('inputTokens' in value) || value['inputTokens'] === undefined)
35
+ return false;
36
+ if (!('outputTokens' in value) || value['outputTokens'] === undefined)
37
+ return false;
38
+ if (!('totalTokens' in value) || value['totalTokens'] === undefined)
39
+ return false;
40
+ if (!('sources' in value) || value['sources'] === undefined)
41
+ return false;
42
+ if (!('users' in value) || value['users'] === undefined)
43
+ return false;
44
+ return true;
45
+ }
46
+ function ModelConsumptionItemUioFromJSON(json) {
47
+ return ModelConsumptionItemUioFromJSONTyped(json, false);
48
+ }
49
+ function ModelConsumptionItemUioFromJSONTyped(json, ignoreDiscriminator) {
50
+ if (json == null) {
51
+ return json;
52
+ }
53
+ return {
54
+ 'provider': json['provider'],
55
+ 'providerName': json['providerName'],
56
+ 'model': json['model'],
57
+ 'requests': json['requests'],
58
+ 'inputTokens': json['inputTokens'],
59
+ 'outputTokens': json['outputTokens'],
60
+ 'totalTokens': json['totalTokens'],
61
+ 'sources': (json['sources'].map(ModelConsumptionSliceUio_1.ModelConsumptionSliceUioFromJSON)),
62
+ 'users': (json['users'].map(ModelConsumptionSliceUio_1.ModelConsumptionSliceUioFromJSON)),
63
+ };
64
+ }
65
+ function ModelConsumptionItemUioToJSON(json) {
66
+ return ModelConsumptionItemUioToJSONTyped(json, false);
67
+ }
68
+ function ModelConsumptionItemUioToJSONTyped(value, ignoreDiscriminator = false) {
69
+ if (value == null) {
70
+ return value;
71
+ }
72
+ return {
73
+ 'provider': value['provider'],
74
+ 'providerName': value['providerName'],
75
+ 'model': value['model'],
76
+ 'requests': value['requests'],
77
+ 'inputTokens': value['inputTokens'],
78
+ 'outputTokens': value['outputTokens'],
79
+ 'totalTokens': value['totalTokens'],
80
+ 'sources': (value['sources'].map(ModelConsumptionSliceUio_1.ModelConsumptionSliceUioToJSON)),
81
+ 'users': (value['users'].map(ModelConsumptionSliceUio_1.ModelConsumptionSliceUioToJSON)),
82
+ };
83
+ }
@@ -0,0 +1,78 @@
1
+ /**
2
+ * brain-client
3
+ * Api ands models for brain-app and brain-app
4
+ *
5
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ * Part de consommation sur une source (agent, gateway, organisation) ou un utilisateur.
14
+ * @export
15
+ * @interface ModelConsumptionSliceUio
16
+ */
17
+ export interface ModelConsumptionSliceUio {
18
+ /**
19
+ *
20
+ * @type {string}
21
+ * @memberof ModelConsumptionSliceUio
22
+ */
23
+ key: string;
24
+ /**
25
+ *
26
+ * @type {string}
27
+ * @memberof ModelConsumptionSliceUio
28
+ */
29
+ kind: ModelConsumptionSliceUioKindEnum;
30
+ /**
31
+ * Nom d'agent ou email. Vide pour une consommation non attribuée à un utilisateur.
32
+ * @type {string}
33
+ * @memberof ModelConsumptionSliceUio
34
+ */
35
+ label: string;
36
+ /**
37
+ *
38
+ * @type {number}
39
+ * @memberof ModelConsumptionSliceUio
40
+ */
41
+ requests: number;
42
+ /**
43
+ *
44
+ * @type {number}
45
+ * @memberof ModelConsumptionSliceUio
46
+ */
47
+ inputTokens: number;
48
+ /**
49
+ *
50
+ * @type {number}
51
+ * @memberof ModelConsumptionSliceUio
52
+ */
53
+ outputTokens: number;
54
+ /**
55
+ *
56
+ * @type {number}
57
+ * @memberof ModelConsumptionSliceUio
58
+ */
59
+ totalTokens: number;
60
+ }
61
+ /**
62
+ * @export
63
+ */
64
+ export declare const ModelConsumptionSliceUioKindEnum: {
65
+ readonly Agent: "agent";
66
+ readonly Gateway: "gateway";
67
+ readonly Organization: "organization";
68
+ readonly User: "user";
69
+ };
70
+ export type ModelConsumptionSliceUioKindEnum = typeof ModelConsumptionSliceUioKindEnum[keyof typeof ModelConsumptionSliceUioKindEnum];
71
+ /**
72
+ * Check if a given object implements the ModelConsumptionSliceUio interface.
73
+ */
74
+ export declare function instanceOfModelConsumptionSliceUio(value: object): value is ModelConsumptionSliceUio;
75
+ export declare function ModelConsumptionSliceUioFromJSON(json: any): ModelConsumptionSliceUio;
76
+ export declare function ModelConsumptionSliceUioFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelConsumptionSliceUio;
77
+ export declare function ModelConsumptionSliceUioToJSON(json: any): ModelConsumptionSliceUio;
78
+ export declare function ModelConsumptionSliceUioToJSONTyped(value?: ModelConsumptionSliceUio | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * brain-client
6
+ * Api ands models for brain-app and brain-app
7
+ *
8
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.ModelConsumptionSliceUioKindEnum = void 0;
17
+ exports.instanceOfModelConsumptionSliceUio = instanceOfModelConsumptionSliceUio;
18
+ exports.ModelConsumptionSliceUioFromJSON = ModelConsumptionSliceUioFromJSON;
19
+ exports.ModelConsumptionSliceUioFromJSONTyped = ModelConsumptionSliceUioFromJSONTyped;
20
+ exports.ModelConsumptionSliceUioToJSON = ModelConsumptionSliceUioToJSON;
21
+ exports.ModelConsumptionSliceUioToJSONTyped = ModelConsumptionSliceUioToJSONTyped;
22
+ /**
23
+ * @export
24
+ */
25
+ exports.ModelConsumptionSliceUioKindEnum = {
26
+ Agent: 'agent',
27
+ Gateway: 'gateway',
28
+ Organization: 'organization',
29
+ User: 'user'
30
+ };
31
+ /**
32
+ * Check if a given object implements the ModelConsumptionSliceUio interface.
33
+ */
34
+ function instanceOfModelConsumptionSliceUio(value) {
35
+ if (!('key' in value) || value['key'] === undefined)
36
+ return false;
37
+ if (!('kind' in value) || value['kind'] === undefined)
38
+ return false;
39
+ if (!('label' in value) || value['label'] === undefined)
40
+ return false;
41
+ if (!('requests' in value) || value['requests'] === undefined)
42
+ return false;
43
+ if (!('inputTokens' in value) || value['inputTokens'] === undefined)
44
+ return false;
45
+ if (!('outputTokens' in value) || value['outputTokens'] === undefined)
46
+ return false;
47
+ if (!('totalTokens' in value) || value['totalTokens'] === undefined)
48
+ return false;
49
+ return true;
50
+ }
51
+ function ModelConsumptionSliceUioFromJSON(json) {
52
+ return ModelConsumptionSliceUioFromJSONTyped(json, false);
53
+ }
54
+ function ModelConsumptionSliceUioFromJSONTyped(json, ignoreDiscriminator) {
55
+ if (json == null) {
56
+ return json;
57
+ }
58
+ return {
59
+ 'key': json['key'],
60
+ 'kind': json['kind'],
61
+ 'label': json['label'],
62
+ 'requests': json['requests'],
63
+ 'inputTokens': json['inputTokens'],
64
+ 'outputTokens': json['outputTokens'],
65
+ 'totalTokens': json['totalTokens'],
66
+ };
67
+ }
68
+ function ModelConsumptionSliceUioToJSON(json) {
69
+ return ModelConsumptionSliceUioToJSONTyped(json, false);
70
+ }
71
+ function ModelConsumptionSliceUioToJSONTyped(value, ignoreDiscriminator = false) {
72
+ if (value == null) {
73
+ return value;
74
+ }
75
+ return {
76
+ 'key': value['key'],
77
+ 'kind': value['kind'],
78
+ 'label': value['label'],
79
+ 'requests': value['requests'],
80
+ 'inputTokens': value['inputTokens'],
81
+ 'outputTokens': value['outputTokens'],
82
+ 'totalTokens': value['totalTokens'],
83
+ };
84
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * brain-client
3
+ * Api ands models for brain-app and brain-app
4
+ *
5
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface OrganizationModelConsumptionTotalUio
16
+ */
17
+ export interface OrganizationModelConsumptionTotalUio {
18
+ /**
19
+ *
20
+ * @type {number}
21
+ * @memberof OrganizationModelConsumptionTotalUio
22
+ */
23
+ requests: number;
24
+ /**
25
+ *
26
+ * @type {number}
27
+ * @memberof OrganizationModelConsumptionTotalUio
28
+ */
29
+ inputTokens: number;
30
+ /**
31
+ *
32
+ * @type {number}
33
+ * @memberof OrganizationModelConsumptionTotalUio
34
+ */
35
+ outputTokens: number;
36
+ /**
37
+ *
38
+ * @type {number}
39
+ * @memberof OrganizationModelConsumptionTotalUio
40
+ */
41
+ totalTokens: number;
42
+ /**
43
+ *
44
+ * @type {number}
45
+ * @memberof OrganizationModelConsumptionTotalUio
46
+ */
47
+ uniqueUsers: number;
48
+ }
49
+ /**
50
+ * Check if a given object implements the OrganizationModelConsumptionTotalUio interface.
51
+ */
52
+ export declare function instanceOfOrganizationModelConsumptionTotalUio(value: object): value is OrganizationModelConsumptionTotalUio;
53
+ export declare function OrganizationModelConsumptionTotalUioFromJSON(json: any): OrganizationModelConsumptionTotalUio;
54
+ export declare function OrganizationModelConsumptionTotalUioFromJSONTyped(json: any, ignoreDiscriminator: boolean): OrganizationModelConsumptionTotalUio;
55
+ export declare function OrganizationModelConsumptionTotalUioToJSON(json: any): OrganizationModelConsumptionTotalUio;
56
+ export declare function OrganizationModelConsumptionTotalUioToJSONTyped(value?: OrganizationModelConsumptionTotalUio | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * brain-client
6
+ * Api ands models for brain-app and brain-app
7
+ *
8
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.instanceOfOrganizationModelConsumptionTotalUio = instanceOfOrganizationModelConsumptionTotalUio;
17
+ exports.OrganizationModelConsumptionTotalUioFromJSON = OrganizationModelConsumptionTotalUioFromJSON;
18
+ exports.OrganizationModelConsumptionTotalUioFromJSONTyped = OrganizationModelConsumptionTotalUioFromJSONTyped;
19
+ exports.OrganizationModelConsumptionTotalUioToJSON = OrganizationModelConsumptionTotalUioToJSON;
20
+ exports.OrganizationModelConsumptionTotalUioToJSONTyped = OrganizationModelConsumptionTotalUioToJSONTyped;
21
+ /**
22
+ * Check if a given object implements the OrganizationModelConsumptionTotalUio interface.
23
+ */
24
+ function instanceOfOrganizationModelConsumptionTotalUio(value) {
25
+ if (!('requests' in value) || value['requests'] === undefined)
26
+ return false;
27
+ if (!('inputTokens' in value) || value['inputTokens'] === undefined)
28
+ return false;
29
+ if (!('outputTokens' in value) || value['outputTokens'] === undefined)
30
+ return false;
31
+ if (!('totalTokens' in value) || value['totalTokens'] === undefined)
32
+ return false;
33
+ if (!('uniqueUsers' in value) || value['uniqueUsers'] === undefined)
34
+ return false;
35
+ return true;
36
+ }
37
+ function OrganizationModelConsumptionTotalUioFromJSON(json) {
38
+ return OrganizationModelConsumptionTotalUioFromJSONTyped(json, false);
39
+ }
40
+ function OrganizationModelConsumptionTotalUioFromJSONTyped(json, ignoreDiscriminator) {
41
+ if (json == null) {
42
+ return json;
43
+ }
44
+ return {
45
+ 'requests': json['requests'],
46
+ 'inputTokens': json['inputTokens'],
47
+ 'outputTokens': json['outputTokens'],
48
+ 'totalTokens': json['totalTokens'],
49
+ 'uniqueUsers': json['uniqueUsers'],
50
+ };
51
+ }
52
+ function OrganizationModelConsumptionTotalUioToJSON(json) {
53
+ return OrganizationModelConsumptionTotalUioToJSONTyped(json, false);
54
+ }
55
+ function OrganizationModelConsumptionTotalUioToJSONTyped(value, ignoreDiscriminator = false) {
56
+ if (value == null) {
57
+ return value;
58
+ }
59
+ return {
60
+ 'requests': value['requests'],
61
+ 'inputTokens': value['inputTokens'],
62
+ 'outputTokens': value['outputTokens'],
63
+ 'totalTokens': value['totalTokens'],
64
+ 'uniqueUsers': value['uniqueUsers'],
65
+ };
66
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * brain-client
3
+ * Api ands models for brain-app and brain-app
4
+ *
5
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import type { OrganizationModelConsumptionTotalUio } from './OrganizationModelConsumptionTotalUio';
13
+ import type { ModelConsumptionItemUio } from './ModelConsumptionItemUio';
14
+ /**
15
+ *
16
+ * @export
17
+ * @interface OrganizationModelConsumptionUio
18
+ */
19
+ export interface OrganizationModelConsumptionUio {
20
+ /**
21
+ *
22
+ * @type {OrganizationModelConsumptionTotalUio}
23
+ * @memberof OrganizationModelConsumptionUio
24
+ */
25
+ total: OrganizationModelConsumptionTotalUio;
26
+ /**
27
+ *
28
+ * @type {Array<ModelConsumptionItemUio>}
29
+ * @memberof OrganizationModelConsumptionUio
30
+ */
31
+ byModel: Array<ModelConsumptionItemUio>;
32
+ }
33
+ /**
34
+ * Check if a given object implements the OrganizationModelConsumptionUio interface.
35
+ */
36
+ export declare function instanceOfOrganizationModelConsumptionUio(value: object): value is OrganizationModelConsumptionUio;
37
+ export declare function OrganizationModelConsumptionUioFromJSON(json: any): OrganizationModelConsumptionUio;
38
+ export declare function OrganizationModelConsumptionUioFromJSONTyped(json: any, ignoreDiscriminator: boolean): OrganizationModelConsumptionUio;
39
+ export declare function OrganizationModelConsumptionUioToJSON(json: any): OrganizationModelConsumptionUio;
40
+ export declare function OrganizationModelConsumptionUioToJSONTyped(value?: OrganizationModelConsumptionUio | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * brain-client
6
+ * Api ands models for brain-app and brain-app
7
+ *
8
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.instanceOfOrganizationModelConsumptionUio = instanceOfOrganizationModelConsumptionUio;
17
+ exports.OrganizationModelConsumptionUioFromJSON = OrganizationModelConsumptionUioFromJSON;
18
+ exports.OrganizationModelConsumptionUioFromJSONTyped = OrganizationModelConsumptionUioFromJSONTyped;
19
+ exports.OrganizationModelConsumptionUioToJSON = OrganizationModelConsumptionUioToJSON;
20
+ exports.OrganizationModelConsumptionUioToJSONTyped = OrganizationModelConsumptionUioToJSONTyped;
21
+ const OrganizationModelConsumptionTotalUio_1 = require("./OrganizationModelConsumptionTotalUio");
22
+ const ModelConsumptionItemUio_1 = require("./ModelConsumptionItemUio");
23
+ /**
24
+ * Check if a given object implements the OrganizationModelConsumptionUio interface.
25
+ */
26
+ function instanceOfOrganizationModelConsumptionUio(value) {
27
+ if (!('total' in value) || value['total'] === undefined)
28
+ return false;
29
+ if (!('byModel' in value) || value['byModel'] === undefined)
30
+ return false;
31
+ return true;
32
+ }
33
+ function OrganizationModelConsumptionUioFromJSON(json) {
34
+ return OrganizationModelConsumptionUioFromJSONTyped(json, false);
35
+ }
36
+ function OrganizationModelConsumptionUioFromJSONTyped(json, ignoreDiscriminator) {
37
+ if (json == null) {
38
+ return json;
39
+ }
40
+ return {
41
+ 'total': (0, OrganizationModelConsumptionTotalUio_1.OrganizationModelConsumptionTotalUioFromJSON)(json['total']),
42
+ 'byModel': (json['byModel'].map(ModelConsumptionItemUio_1.ModelConsumptionItemUioFromJSON)),
43
+ };
44
+ }
45
+ function OrganizationModelConsumptionUioToJSON(json) {
46
+ return OrganizationModelConsumptionUioToJSONTyped(json, false);
47
+ }
48
+ function OrganizationModelConsumptionUioToJSONTyped(value, ignoreDiscriminator = false) {
49
+ if (value == null) {
50
+ return value;
51
+ }
52
+ return {
53
+ 'total': (0, OrganizationModelConsumptionTotalUio_1.OrganizationModelConsumptionTotalUioToJSON)(value['total']),
54
+ 'byModel': (value['byModel'].map(ModelConsumptionItemUio_1.ModelConsumptionItemUioToJSON)),
55
+ };
56
+ }
@@ -325,6 +325,8 @@ export * from './MetricsTopAgentsResponseInnerUio';
325
325
  export * from './MetricsTopAgentsUsageResponseInnerUio';
326
326
  export * from './MetricsUsersResponseUio';
327
327
  export * from './ModelAgentUio';
328
+ export * from './ModelConsumptionItemUio';
329
+ export * from './ModelConsumptionSliceUio';
328
330
  export * from './ModelDefinitionUio';
329
331
  export * from './ModelUio';
330
332
  export * from './OcrModeUio';
@@ -337,6 +339,8 @@ export * from './OrgUsageTimeSeriesPointUio';
337
339
  export * from './OrganizationEngineUio';
338
340
  export * from './OrganizationMemberUio';
339
341
  export * from './OrganizationMemberUserUio';
342
+ export * from './OrganizationModelConsumptionTotalUio';
343
+ export * from './OrganizationModelConsumptionUio';
340
344
  export * from './OrganizationOcrConfigUio';
341
345
  export * from './OrganizationOcrConfigUpdateRequestUio';
342
346
  export * from './OrganizationPermissionKeyUio';
@@ -343,6 +343,8 @@ __exportStar(require("./MetricsTopAgentsResponseInnerUio"), exports);
343
343
  __exportStar(require("./MetricsTopAgentsUsageResponseInnerUio"), exports);
344
344
  __exportStar(require("./MetricsUsersResponseUio"), exports);
345
345
  __exportStar(require("./ModelAgentUio"), exports);
346
+ __exportStar(require("./ModelConsumptionItemUio"), exports);
347
+ __exportStar(require("./ModelConsumptionSliceUio"), exports);
346
348
  __exportStar(require("./ModelDefinitionUio"), exports);
347
349
  __exportStar(require("./ModelUio"), exports);
348
350
  __exportStar(require("./OcrModeUio"), exports);
@@ -355,6 +357,8 @@ __exportStar(require("./OrgUsageTimeSeriesPointUio"), exports);
355
357
  __exportStar(require("./OrganizationEngineUio"), exports);
356
358
  __exportStar(require("./OrganizationMemberUio"), exports);
357
359
  __exportStar(require("./OrganizationMemberUserUio"), exports);
360
+ __exportStar(require("./OrganizationModelConsumptionTotalUio"), exports);
361
+ __exportStar(require("./OrganizationModelConsumptionUio"), exports);
358
362
  __exportStar(require("./OrganizationOcrConfigUio"), exports);
359
363
  __exportStar(require("./OrganizationOcrConfigUpdateRequestUio"), exports);
360
364
  __exportStar(require("./OrganizationPermissionKeyUio"), exports);
package/dist/openapi.json CHANGED
@@ -7293,6 +7293,58 @@
7293
7293
  "tags" : [ "metrics" ]
7294
7294
  }
7295
7295
  },
7296
+ "/metrics/organizations/{organizationId}/model-consumption" : {
7297
+ "get" : {
7298
+ "description" : "Tokens consumed by model and provider, split between agents, organization costs without an agent, direct AI Gateway calls, and users. Restricted to organization administrators.",
7299
+ "operationId" : "getMetricsOrganizationModelConsumption",
7300
+ "parameters" : [ {
7301
+ "description" : "ID of the organization",
7302
+ "in" : "path",
7303
+ "name" : "organizationId",
7304
+ "required" : true,
7305
+ "schema" : {
7306
+ "type" : "string"
7307
+ }
7308
+ }, {
7309
+ "description" : "Start date for metrics (ISO format)",
7310
+ "in" : "query",
7311
+ "name" : "startDate",
7312
+ "schema" : {
7313
+ "type" : "string"
7314
+ }
7315
+ }, {
7316
+ "description" : "End date for metrics (ISO format)",
7317
+ "in" : "query",
7318
+ "name" : "endDate",
7319
+ "schema" : {
7320
+ "type" : "string"
7321
+ }
7322
+ } ],
7323
+ "responses" : {
7324
+ "200" : {
7325
+ "content" : {
7326
+ "application/json" : {
7327
+ "schema" : {
7328
+ "$ref" : "#/components/schemas/OrganizationModelConsumption"
7329
+ }
7330
+ }
7331
+ },
7332
+ "description" : "Model consumption retrieved successfully"
7333
+ },
7334
+ "401" : {
7335
+ "description" : "Unauthorized"
7336
+ },
7337
+ "403" : {
7338
+ "description" : "Forbidden"
7339
+ },
7340
+ "500" : {
7341
+ "description" : "Server error"
7342
+ }
7343
+ },
7344
+ "summary" : "Get model consumption for an organization",
7345
+ "tags" : [ "metrics" ]
7346
+ }
7347
+ },
7296
7348
  "/agents/{agentId}/guardians" : {
7297
7349
  "get" : {
7298
7350
  "operationId" : "getGuardiansForAgent",
@@ -17671,6 +17723,11 @@
17671
17723
  "status" : {
17672
17724
  "$ref" : "#/components/schemas/FileStatus"
17673
17725
  },
17726
+ "error" : {
17727
+ "description" : "Why the file ended in ERROR; null otherwise.",
17728
+ "nullable" : true,
17729
+ "type" : "string"
17730
+ },
17674
17731
  "isActive" : {
17675
17732
  "type" : "boolean"
17676
17733
  }
@@ -20435,6 +20492,92 @@
20435
20492
  },
20436
20493
  "type" : "array"
20437
20494
  },
20495
+ "OrganizationModelConsumption" : {
20496
+ "properties" : {
20497
+ "total" : {
20498
+ "$ref" : "#/components/schemas/OrganizationModelConsumption_total"
20499
+ },
20500
+ "byModel" : {
20501
+ "items" : {
20502
+ "$ref" : "#/components/schemas/ModelConsumptionItem"
20503
+ },
20504
+ "type" : "array"
20505
+ }
20506
+ },
20507
+ "required" : [ "byModel", "total" ],
20508
+ "type" : "object"
20509
+ },
20510
+ "ModelConsumptionItem" : {
20511
+ "properties" : {
20512
+ "provider" : {
20513
+ "description" : "Identifiant stable du moteur. Les lignes historiques d'agent portent encore le type (openai, mistral).",
20514
+ "type" : "string"
20515
+ },
20516
+ "providerName" : {
20517
+ "description" : "Nom du moteur écrit au moment de l'appel. Repli sur l'identifiant lorsqu'aucun nom n'est connu.",
20518
+ "type" : "string"
20519
+ },
20520
+ "model" : {
20521
+ "type" : "string"
20522
+ },
20523
+ "requests" : {
20524
+ "type" : "number"
20525
+ },
20526
+ "inputTokens" : {
20527
+ "type" : "number"
20528
+ },
20529
+ "outputTokens" : {
20530
+ "type" : "number"
20531
+ },
20532
+ "totalTokens" : {
20533
+ "type" : "number"
20534
+ },
20535
+ "sources" : {
20536
+ "items" : {
20537
+ "$ref" : "#/components/schemas/ModelConsumptionSlice"
20538
+ },
20539
+ "type" : "array"
20540
+ },
20541
+ "users" : {
20542
+ "items" : {
20543
+ "$ref" : "#/components/schemas/ModelConsumptionSlice"
20544
+ },
20545
+ "type" : "array"
20546
+ }
20547
+ },
20548
+ "required" : [ "inputTokens", "model", "outputTokens", "provider", "providerName", "requests", "sources", "totalTokens", "users" ],
20549
+ "type" : "object"
20550
+ },
20551
+ "ModelConsumptionSlice" : {
20552
+ "description" : "Part de consommation sur une source (agent, gateway, organisation) ou un utilisateur.",
20553
+ "properties" : {
20554
+ "key" : {
20555
+ "type" : "string"
20556
+ },
20557
+ "kind" : {
20558
+ "enum" : [ "agent", "gateway", "organization", "user" ],
20559
+ "type" : "string"
20560
+ },
20561
+ "label" : {
20562
+ "description" : "Nom d'agent ou email. Vide pour une consommation non attribuée à un utilisateur.",
20563
+ "type" : "string"
20564
+ },
20565
+ "requests" : {
20566
+ "type" : "number"
20567
+ },
20568
+ "inputTokens" : {
20569
+ "type" : "number"
20570
+ },
20571
+ "outputTokens" : {
20572
+ "type" : "number"
20573
+ },
20574
+ "totalTokens" : {
20575
+ "type" : "number"
20576
+ }
20577
+ },
20578
+ "required" : [ "inputTokens", "key", "kind", "label", "outputTokens", "requests", "totalTokens" ],
20579
+ "type" : "object"
20580
+ },
20438
20581
  "Guardian" : {
20439
20582
  "properties" : {
20440
20583
  "id" : {
@@ -24148,7 +24291,7 @@
24148
24291
  "type" : "object"
24149
24292
  },
24150
24293
  "FileStatus" : {
24151
- "enum" : [ "SCRAPING", "PENDING", "UPLOADED", "PROCESSING", "INDEXED" ],
24294
+ "enum" : [ "SCRAPING", "PENDING", "UPLOADED", "PROCESSING", "INDEXED", "ERROR" ],
24152
24295
  "type" : "string"
24153
24296
  },
24154
24297
  "HealthStatus" : {
@@ -25921,6 +26064,27 @@
25921
26064
  "required" : [ "agentId", "agentName", "usage" ],
25922
26065
  "type" : "object"
25923
26066
  },
26067
+ "OrganizationModelConsumption_total" : {
26068
+ "properties" : {
26069
+ "requests" : {
26070
+ "type" : "number"
26071
+ },
26072
+ "inputTokens" : {
26073
+ "type" : "number"
26074
+ },
26075
+ "outputTokens" : {
26076
+ "type" : "number"
26077
+ },
26078
+ "totalTokens" : {
26079
+ "type" : "number"
26080
+ },
26081
+ "uniqueUsers" : {
26082
+ "type" : "number"
26083
+ }
26084
+ },
26085
+ "required" : [ "inputTokens", "outputTokens", "requests", "totalTokens", "uniqueUsers" ],
26086
+ "type" : "object"
26087
+ },
25924
26088
  "OrganizationMember_user" : {
25925
26089
  "properties" : {
25926
26090
  "email" : {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breign/client",
3
- "version": "1.0.155",
3
+ "version": "1.0.157",
4
4
  "main": "dist/index.js",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",