@llmops/sdk 1.0.0-beta.2 → 1.0.0-beta.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/dist/store/pg.mjs CHANGED
@@ -1,3 +1,433 @@
1
1
  import { createPgStore as pgStore } from "@llmops/core";
2
2
 
3
- export { pgStore };
3
+ //#region src/store/pg/generated/llm_requests.ts
4
+ const LlmRequestsSchema = {
5
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
6
+ "title": "LlmRequests",
7
+ "type": "object",
8
+ "properties": {
9
+ "id": {
10
+ "type": "string",
11
+ "format": "uuid"
12
+ },
13
+ "requestId": {
14
+ "type": "string",
15
+ "format": "uuid"
16
+ },
17
+ "configId": {
18
+ "type": ["string", "null"],
19
+ "format": "uuid"
20
+ },
21
+ "variantId": {
22
+ "type": ["string", "null"],
23
+ "format": "uuid"
24
+ },
25
+ "environmentId": {
26
+ "type": ["string", "null"],
27
+ "format": "uuid"
28
+ },
29
+ "providerConfigId": {
30
+ "type": ["string", "null"],
31
+ "format": "uuid"
32
+ },
33
+ "provider": {
34
+ "type": "string",
35
+ "maxLength": 255
36
+ },
37
+ "model": {
38
+ "type": "string",
39
+ "maxLength": 255
40
+ },
41
+ "promptTokens": { "type": "integer" },
42
+ "completionTokens": { "type": "integer" },
43
+ "totalTokens": { "type": "integer" },
44
+ "cachedTokens": { "type": "integer" },
45
+ "cacheCreationTokens": { "type": "integer" },
46
+ "cost": { "type": "integer" },
47
+ "cacheSavings": { "type": "integer" },
48
+ "inputCost": { "type": "integer" },
49
+ "outputCost": { "type": "integer" },
50
+ "endpoint": {
51
+ "type": "string",
52
+ "maxLength": 255
53
+ },
54
+ "statusCode": { "type": "integer" },
55
+ "latencyMs": { "type": "integer" },
56
+ "isStreaming": { "type": "boolean" },
57
+ "userId": {
58
+ "type": ["string", "null"],
59
+ "maxLength": 255
60
+ },
61
+ "tags": { "type": "object" },
62
+ "guardrailResults": { "type": ["object", "null"] },
63
+ "traceId": {
64
+ "type": ["string", "null"],
65
+ "maxLength": 255
66
+ },
67
+ "spanId": {
68
+ "type": ["string", "null"],
69
+ "maxLength": 255
70
+ },
71
+ "parentSpanId": {
72
+ "type": ["string", "null"],
73
+ "maxLength": 255
74
+ },
75
+ "sessionId": {
76
+ "type": ["string", "null"],
77
+ "maxLength": 255
78
+ },
79
+ "createdAt": {
80
+ "type": "string",
81
+ "format": "date-time"
82
+ },
83
+ "updatedAt": {
84
+ "type": "string",
85
+ "format": "date-time"
86
+ }
87
+ },
88
+ "required": [
89
+ "id",
90
+ "requestId",
91
+ "provider",
92
+ "model",
93
+ "promptTokens",
94
+ "completionTokens",
95
+ "totalTokens",
96
+ "cachedTokens",
97
+ "cacheCreationTokens",
98
+ "cost",
99
+ "cacheSavings",
100
+ "inputCost",
101
+ "outputCost",
102
+ "endpoint",
103
+ "statusCode",
104
+ "latencyMs",
105
+ "isStreaming",
106
+ "tags",
107
+ "createdAt",
108
+ "updatedAt"
109
+ ],
110
+ "additionalProperties": false
111
+ };
112
+
113
+ //#endregion
114
+ //#region src/store/pg/generated/span_events.ts
115
+ const SpanEventsSchema = {
116
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
117
+ "title": "SpanEvents",
118
+ "type": "object",
119
+ "properties": {
120
+ "id": {
121
+ "type": "string",
122
+ "format": "uuid"
123
+ },
124
+ "traceId": {
125
+ "type": "string",
126
+ "maxLength": 255
127
+ },
128
+ "spanId": {
129
+ "type": "string",
130
+ "maxLength": 255
131
+ },
132
+ "name": {
133
+ "type": "string",
134
+ "maxLength": 255
135
+ },
136
+ "timestamp": {
137
+ "type": "string",
138
+ "format": "date-time"
139
+ },
140
+ "attributes": { "type": "object" },
141
+ "createdAt": {
142
+ "type": "string",
143
+ "format": "date-time"
144
+ }
145
+ },
146
+ "required": [
147
+ "id",
148
+ "traceId",
149
+ "spanId",
150
+ "name",
151
+ "timestamp",
152
+ "attributes",
153
+ "createdAt"
154
+ ],
155
+ "additionalProperties": false
156
+ };
157
+
158
+ //#endregion
159
+ //#region src/store/pg/generated/spans.ts
160
+ const SpansSchema = {
161
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
162
+ "title": "Spans",
163
+ "type": "object",
164
+ "properties": {
165
+ "id": {
166
+ "type": "string",
167
+ "format": "uuid"
168
+ },
169
+ "traceId": {
170
+ "type": "string",
171
+ "maxLength": 255
172
+ },
173
+ "spanId": {
174
+ "type": "string",
175
+ "maxLength": 255
176
+ },
177
+ "parentSpanId": {
178
+ "type": ["string", "null"],
179
+ "maxLength": 255
180
+ },
181
+ "name": {
182
+ "type": "string",
183
+ "maxLength": 255
184
+ },
185
+ "kind": { "type": "integer" },
186
+ "status": { "type": "integer" },
187
+ "statusMessage": { "type": ["string", "null"] },
188
+ "startTime": {
189
+ "type": "string",
190
+ "format": "date-time"
191
+ },
192
+ "endTime": {
193
+ "type": ["string", "null"],
194
+ "format": "date-time"
195
+ },
196
+ "durationMs": { "type": ["integer", "null"] },
197
+ "provider": {
198
+ "type": ["string", "null"],
199
+ "maxLength": 255
200
+ },
201
+ "model": {
202
+ "type": ["string", "null"],
203
+ "maxLength": 255
204
+ },
205
+ "promptTokens": { "type": "integer" },
206
+ "completionTokens": { "type": "integer" },
207
+ "totalTokens": { "type": "integer" },
208
+ "cost": { "type": "integer" },
209
+ "configId": {
210
+ "type": ["string", "null"],
211
+ "format": "uuid"
212
+ },
213
+ "variantId": {
214
+ "type": ["string", "null"],
215
+ "format": "uuid"
216
+ },
217
+ "environmentId": {
218
+ "type": ["string", "null"],
219
+ "format": "uuid"
220
+ },
221
+ "providerConfigId": {
222
+ "type": ["string", "null"],
223
+ "format": "uuid"
224
+ },
225
+ "requestId": {
226
+ "type": ["string", "null"],
227
+ "format": "uuid"
228
+ },
229
+ "source": {
230
+ "type": "string",
231
+ "maxLength": 50
232
+ },
233
+ "input": { "type": ["object", "null"] },
234
+ "output": { "type": ["object", "null"] },
235
+ "attributes": { "type": "object" },
236
+ "createdAt": {
237
+ "type": "string",
238
+ "format": "date-time"
239
+ },
240
+ "updatedAt": {
241
+ "type": "string",
242
+ "format": "date-time"
243
+ }
244
+ },
245
+ "required": [
246
+ "id",
247
+ "traceId",
248
+ "spanId",
249
+ "name",
250
+ "kind",
251
+ "status",
252
+ "startTime",
253
+ "promptTokens",
254
+ "completionTokens",
255
+ "totalTokens",
256
+ "cost",
257
+ "source",
258
+ "attributes",
259
+ "createdAt",
260
+ "updatedAt"
261
+ ],
262
+ "additionalProperties": false
263
+ };
264
+
265
+ //#endregion
266
+ //#region src/store/pg/generated/traces.ts
267
+ const TracesSchema = {
268
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
269
+ "title": "Traces",
270
+ "type": "object",
271
+ "properties": {
272
+ "id": {
273
+ "type": "string",
274
+ "format": "uuid"
275
+ },
276
+ "traceId": {
277
+ "type": "string",
278
+ "maxLength": 255
279
+ },
280
+ "name": {
281
+ "type": ["string", "null"],
282
+ "maxLength": 255
283
+ },
284
+ "sessionId": {
285
+ "type": ["string", "null"],
286
+ "maxLength": 255
287
+ },
288
+ "userId": {
289
+ "type": ["string", "null"],
290
+ "maxLength": 255
291
+ },
292
+ "status": {
293
+ "type": "string",
294
+ "maxLength": 50
295
+ },
296
+ "startTime": {
297
+ "type": "string",
298
+ "format": "date-time"
299
+ },
300
+ "endTime": {
301
+ "type": ["string", "null"],
302
+ "format": "date-time"
303
+ },
304
+ "durationMs": { "type": ["integer", "null"] },
305
+ "spanCount": { "type": "integer" },
306
+ "totalInputTokens": { "type": "integer" },
307
+ "totalOutputTokens": { "type": "integer" },
308
+ "totalTokens": { "type": "integer" },
309
+ "totalCost": { "type": "integer" },
310
+ "tags": { "type": "object" },
311
+ "metadata": { "type": "object" },
312
+ "createdAt": {
313
+ "type": "string",
314
+ "format": "date-time"
315
+ },
316
+ "updatedAt": {
317
+ "type": "string",
318
+ "format": "date-time"
319
+ }
320
+ },
321
+ "required": [
322
+ "id",
323
+ "traceId",
324
+ "status",
325
+ "startTime",
326
+ "spanCount",
327
+ "totalInputTokens",
328
+ "totalOutputTokens",
329
+ "totalTokens",
330
+ "totalCost",
331
+ "tags",
332
+ "metadata",
333
+ "createdAt",
334
+ "updatedAt"
335
+ ],
336
+ "additionalProperties": false
337
+ };
338
+
339
+ //#endregion
340
+ //#region src/store/pg/queries/gen/getCostByModel.ts
341
+ const GetCostByModelParamsSchema = {
342
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
343
+ "title": "GetCostByModelParams",
344
+ "type": "object",
345
+ "properties": {
346
+ "start_date": { "type": "string" },
347
+ "end_date": { "type": "string" }
348
+ },
349
+ "required": ["start_date", "end_date"],
350
+ "additionalProperties": false
351
+ };
352
+
353
+ //#endregion
354
+ //#region src/store/pg/queries/gen/getCostByProvider.ts
355
+ const GetCostByProviderParamsSchema = {
356
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
357
+ "title": "GetCostByProviderParams",
358
+ "type": "object",
359
+ "properties": {
360
+ "start_date": { "type": "string" },
361
+ "end_date": { "type": "string" }
362
+ },
363
+ "required": ["start_date", "end_date"],
364
+ "additionalProperties": false
365
+ };
366
+
367
+ //#endregion
368
+ //#region src/store/pg/queries/gen/getDailyCosts.ts
369
+ const GetDailyCostsParamsSchema = {
370
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
371
+ "title": "GetDailyCostsParams",
372
+ "type": "object",
373
+ "properties": {
374
+ "start_date": { "type": "string" },
375
+ "end_date": { "type": "string" }
376
+ },
377
+ "required": ["start_date", "end_date"],
378
+ "additionalProperties": false
379
+ };
380
+
381
+ //#endregion
382
+ //#region src/store/pg/queries/gen/getRequestByRequestId.ts
383
+ const GetRequestByRequestIdParamsSchema = {
384
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
385
+ "title": "GetRequestByRequestIdParams",
386
+ "type": "object",
387
+ "properties": { "request_id": { "type": "string" } },
388
+ "required": ["request_id"],
389
+ "additionalProperties": false
390
+ };
391
+
392
+ //#endregion
393
+ //#region src/store/pg/queries/gen/getRequestStats.ts
394
+ const GetRequestStatsParamsSchema = {
395
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
396
+ "title": "GetRequestStatsParams",
397
+ "type": "object",
398
+ "properties": {
399
+ "start_date": { "type": "string" },
400
+ "end_date": { "type": "string" },
401
+ "config_id": { "type": "string" },
402
+ "variant_id": { "type": "string" },
403
+ "environment_id": { "type": "string" }
404
+ },
405
+ "required": [
406
+ "start_date",
407
+ "end_date",
408
+ "config_id",
409
+ "variant_id",
410
+ "environment_id"
411
+ ],
412
+ "additionalProperties": false
413
+ };
414
+
415
+ //#endregion
416
+ //#region src/store/pg/queries/gen/getTotalCost.ts
417
+ const GetTotalCostParamsSchema = {
418
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
419
+ "title": "GetTotalCostParams",
420
+ "type": "object",
421
+ "properties": {
422
+ "start_date": { "type": "string" },
423
+ "end_date": {
424
+ "type": "string",
425
+ "format": "date-time"
426
+ }
427
+ },
428
+ "required": ["start_date", "end_date"],
429
+ "additionalProperties": false
430
+ };
431
+
432
+ //#endregion
433
+ export { GetCostByModelParamsSchema, GetCostByProviderParamsSchema, GetDailyCostsParamsSchema, GetRequestByRequestIdParamsSchema, GetRequestStatsParamsSchema, GetTotalCostParamsSchema, LlmRequestsSchema, SpanEventsSchema, SpansSchema, TracesSchema, pgStore };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llmops/sdk",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.3",
4
4
  "description": "An LLMOps toolkit for TypeScript applications",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -104,11 +104,14 @@
104
104
  "access": "public"
105
105
  },
106
106
  "dependencies": {
107
- "@llmops/app": "^1.0.0-beta.2",
108
- "@llmops/core": "^1.0.0-beta.2"
107
+ "@llmops/core": "^1.0.0-beta.3",
108
+ "@llmops/app": "^1.0.0-beta.3"
109
109
  },
110
110
  "devDependencies": {
111
+ "@tsqx/cli": "^0.0.4",
112
+ "@tsqx/kit": "^0.0.4",
111
113
  "@types/express": "^5.0.6",
114
+ "@types/pg": "^8.15.6",
112
115
  "hono": "^4.7.0"
113
116
  },
114
117
  "scripts": {