@llmops/core 1.0.0-beta.4 → 1.0.0-beta.6

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/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import z$1, { z } from "zod";
1
+ import { z } from "zod";
2
2
  import gateway from "@llmops/gateway";
3
3
  import pino from "pino";
4
4
 
@@ -1390,244 +1390,4 @@ declare class LLMOpsPricingProvider implements PricingProvider {
1390
1390
  */
1391
1391
  declare function getDefaultPricingProvider(): LLMOpsPricingProvider;
1392
1392
  //#endregion
1393
- //#region src/telemetry/postgres.d.ts
1394
- declare const insertLLMRequestSchema: z$1.ZodObject<{
1395
- requestId: z$1.ZodString;
1396
- configId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1397
- variantId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1398
- environmentId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1399
- providerConfigId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1400
- provider: z$1.ZodString;
1401
- model: z$1.ZodString;
1402
- promptTokens: z$1.ZodDefault<z$1.ZodNumber>;
1403
- completionTokens: z$1.ZodDefault<z$1.ZodNumber>;
1404
- totalTokens: z$1.ZodDefault<z$1.ZodNumber>;
1405
- cachedTokens: z$1.ZodDefault<z$1.ZodNumber>;
1406
- cacheCreationTokens: z$1.ZodDefault<z$1.ZodNumber>;
1407
- cost: z$1.ZodDefault<z$1.ZodNumber>;
1408
- cacheSavings: z$1.ZodDefault<z$1.ZodNumber>;
1409
- inputCost: z$1.ZodDefault<z$1.ZodNumber>;
1410
- outputCost: z$1.ZodDefault<z$1.ZodNumber>;
1411
- endpoint: z$1.ZodString;
1412
- statusCode: z$1.ZodNumber;
1413
- latencyMs: z$1.ZodDefault<z$1.ZodNumber>;
1414
- isStreaming: z$1.ZodDefault<z$1.ZodBoolean>;
1415
- userId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1416
- tags: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
1417
- guardrailResults: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodObject<{
1418
- results: z$1.ZodArray<z$1.ZodObject<{
1419
- checkId: z$1.ZodString;
1420
- functionId: z$1.ZodString;
1421
- hookType: z$1.ZodEnum<{
1422
- beforeRequestHook: "beforeRequestHook";
1423
- afterRequestHook: "afterRequestHook";
1424
- }>;
1425
- verdict: z$1.ZodBoolean;
1426
- latencyMs: z$1.ZodNumber;
1427
- }, z$1.core.$strip>>;
1428
- action: z$1.ZodEnum<{
1429
- allowed: "allowed";
1430
- blocked: "blocked";
1431
- logged: "logged";
1432
- }>;
1433
- totalLatencyMs: z$1.ZodNumber;
1434
- }, z$1.core.$strip>>>;
1435
- traceId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1436
- spanId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1437
- parentSpanId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1438
- sessionId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1439
- }, z$1.core.$strip>;
1440
- type LLMRequestInsert = z$1.infer<typeof insertLLMRequestSchema>;
1441
- declare const COST_SUMMARY_GROUP_BY: readonly ["day", "hour", "model", "provider", "endpoint", "tags"];
1442
- type CostSummaryGroupBy = (typeof COST_SUMMARY_GROUP_BY)[number];
1443
- declare const upsertTraceSchema: z$1.ZodObject<{
1444
- traceId: z$1.ZodString;
1445
- name: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1446
- sessionId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1447
- userId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1448
- status: z$1.ZodDefault<z$1.ZodEnum<{
1449
- error: "error";
1450
- unset: "unset";
1451
- ok: "ok";
1452
- }>>;
1453
- startTime: z$1.ZodDate;
1454
- endTime: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodDate>>;
1455
- durationMs: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
1456
- spanCount: z$1.ZodDefault<z$1.ZodNumber>;
1457
- totalInputTokens: z$1.ZodDefault<z$1.ZodNumber>;
1458
- totalOutputTokens: z$1.ZodDefault<z$1.ZodNumber>;
1459
- totalTokens: z$1.ZodDefault<z$1.ZodNumber>;
1460
- totalCost: z$1.ZodDefault<z$1.ZodNumber>;
1461
- tags: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
1462
- metadata: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1463
- }, z$1.core.$strip>;
1464
- type TraceUpsert = z$1.infer<typeof upsertTraceSchema>;
1465
- declare const insertSpanSchema: z$1.ZodObject<{
1466
- traceId: z$1.ZodString;
1467
- spanId: z$1.ZodString;
1468
- parentSpanId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1469
- name: z$1.ZodString;
1470
- kind: z$1.ZodDefault<z$1.ZodNumber>;
1471
- status: z$1.ZodDefault<z$1.ZodNumber>;
1472
- statusMessage: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1473
- startTime: z$1.ZodDate;
1474
- endTime: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodDate>>;
1475
- durationMs: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
1476
- provider: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1477
- model: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1478
- promptTokens: z$1.ZodDefault<z$1.ZodNumber>;
1479
- completionTokens: z$1.ZodDefault<z$1.ZodNumber>;
1480
- totalTokens: z$1.ZodDefault<z$1.ZodNumber>;
1481
- cost: z$1.ZodDefault<z$1.ZodNumber>;
1482
- configId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1483
- variantId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1484
- environmentId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1485
- providerConfigId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1486
- requestId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1487
- source: z$1.ZodDefault<z$1.ZodEnum<{
1488
- gateway: "gateway";
1489
- otlp: "otlp";
1490
- langsmith: "langsmith";
1491
- }>>;
1492
- input: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodUnknown>>;
1493
- output: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodUnknown>>;
1494
- attributes: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1495
- }, z$1.core.$strip>;
1496
- type SpanInsert = z$1.infer<typeof insertSpanSchema>;
1497
- declare const insertSpanEventSchema: z$1.ZodObject<{
1498
- traceId: z$1.ZodString;
1499
- spanId: z$1.ZodString;
1500
- name: z$1.ZodString;
1501
- timestamp: z$1.ZodDate;
1502
- attributes: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1503
- }, z$1.core.$strip>;
1504
- type SpanEventInsert = z$1.infer<typeof insertSpanEventSchema>;
1505
- declare function createLLMRequestsStore(pool: any): {
1506
- batchInsertRequests: (requests: LLMRequestInsert[]) => Promise<{
1507
- count: number;
1508
- }>;
1509
- insertRequest: (request: LLMRequestInsert) => Promise<any>;
1510
- listRequests: (params?: {
1511
- limit?: number;
1512
- offset?: number;
1513
- configId?: string;
1514
- variantId?: string;
1515
- environmentId?: string;
1516
- providerConfigId?: string;
1517
- provider?: string;
1518
- model?: string;
1519
- startDate?: Date;
1520
- endDate?: Date;
1521
- tags?: Record<string, string[]>;
1522
- }) => Promise<{
1523
- data: any;
1524
- total: any;
1525
- limit: number;
1526
- offset: number;
1527
- }>;
1528
- getRequestByRequestId: (requestId: string) => Promise<any>;
1529
- getTotalCost: (params: {
1530
- startDate: Date;
1531
- endDate: Date;
1532
- configId?: string;
1533
- variantId?: string;
1534
- environmentId?: string;
1535
- tags?: Record<string, string[]>;
1536
- }) => Promise<any>;
1537
- getCostByModel: (params: {
1538
- startDate: Date;
1539
- endDate: Date;
1540
- }) => Promise<any>;
1541
- getCostByProvider: (params: {
1542
- startDate: Date;
1543
- endDate: Date;
1544
- }) => Promise<any>;
1545
- getDailyCosts: (params: {
1546
- startDate: Date;
1547
- endDate: Date;
1548
- }) => Promise<any>;
1549
- getCostSummary: (params: {
1550
- startDate: Date;
1551
- endDate: Date;
1552
- configId?: string;
1553
- variantId?: string;
1554
- environmentId?: string;
1555
- groupBy?: CostSummaryGroupBy;
1556
- tags?: Record<string, string[]>;
1557
- tagKeys?: string[];
1558
- }) => Promise<any>;
1559
- getRequestStats: (params: {
1560
- startDate: Date;
1561
- endDate: Date;
1562
- configId?: string;
1563
- variantId?: string;
1564
- environmentId?: string;
1565
- tags?: Record<string, string[]>;
1566
- }) => Promise<any>;
1567
- getDistinctTags: () => Promise<any>;
1568
- };
1569
- declare function createTracesStore(pool: any): {
1570
- upsertTrace: (data: TraceUpsert) => Promise<void>;
1571
- batchInsertSpans: (spans: SpanInsert[]) => Promise<{
1572
- count: number;
1573
- }>;
1574
- batchInsertSpanEvents: (events: SpanEventInsert[]) => Promise<{
1575
- count: number;
1576
- }>;
1577
- listTraces: (params?: {
1578
- limit?: number;
1579
- offset?: number;
1580
- sessionId?: string;
1581
- userId?: string;
1582
- status?: string;
1583
- name?: string;
1584
- startDate?: Date;
1585
- endDate?: Date;
1586
- tags?: Record<string, string[]>;
1587
- }) => Promise<{
1588
- data: any;
1589
- total: any;
1590
- limit: number;
1591
- offset: number;
1592
- }>;
1593
- getTraceWithSpans: (traceId: string) => Promise<{
1594
- trace: any;
1595
- spans: any;
1596
- events: any;
1597
- } | undefined>;
1598
- getTraceStats: (params: {
1599
- startDate: Date;
1600
- endDate: Date;
1601
- sessionId?: string;
1602
- userId?: string;
1603
- }) => Promise<any>;
1604
- };
1605
- type PgStore = ReturnType<typeof createLLMRequestsStore> & ReturnType<typeof createTracesStore> & {
1606
- _pool: unknown;
1607
- _schema: string;
1608
- };
1609
- /**
1610
- * Create a PostgreSQL-backed telemetry store.
1611
- *
1612
- * Usage:
1613
- * ```ts
1614
- * import { llmops } from '@llmops/sdk'
1615
- * import { pgStore } from '@llmops/sdk/store/pg'
1616
- *
1617
- * const ops = llmops({
1618
- * telemetry: pgStore(process.env.DATABASE_URL),
1619
- * })
1620
- * ```
1621
- */
1622
- declare function createPgStore(connectionString: string, options?: {
1623
- schema?: string;
1624
- }): PgStore;
1625
- //#endregion
1626
- //#region src/telemetry/interface.d.ts
1627
- /**
1628
- * TelemetryStore provides read + write access to telemetry data.
1629
- * Implemented by pgStore (and future sqliteStore, etc.)
1630
- */
1631
- type TelemetryStore = Omit<PgStore, '_pool' | '_schema'>;
1632
- //#endregion
1633
- export { type AnthropicProviderConfig, type AnyProviderConfig, type AzureAIProviderConfig, type AzureOpenAIProviderConfig, BaseCacheConfig, type BaseProviderConfig, type BedrockProviderConfig, COST_SUMMARY_GROUP_BY, CacheBackend, CacheBackendType, CacheConfig, CacheEntry, CacheOptions, CacheService, CacheStats, ChatCompletionCreateParamsBase, type CortexProviderConfig, CostResult, CostSummaryGroupBy, DEFAULT_PROVIDER_ENV_VARS, FileCacheBackend, FileCacheConfig, type FireworksAIProviderConfig, type GoogleProviderConfig, type HuggingFaceProviderConfig, type InlineProviderConfig, type InlineProvidersConfig, LLMOPS_INTERNAL_HEADER, LLMOPS_REQUEST_ID_HEADER, LLMOPS_SESSION_ID_HEADER, LLMOPS_SPAN_ID_HEADER, LLMOPS_SPAN_NAME_HEADER, LLMOPS_TRACE_ID_HEADER, LLMOPS_TRACE_NAME_HEADER, LLMOPS_USER_ID_HEADER, LLMOpsClient, LLMOpsConfig, type LLMOpsConfigInput, LLMOpsPricingProvider, LLMRequestInsert, MS, MemoryCacheBackend, MemoryCacheConfig, type MistralAIProviderConfig, ModelPricing, type OpenAIProviderConfig, type OracleProviderConfig, PgStore, Prettify, PricingProvider, type ProviderConfigMap, type ProvidersConfig, type SagemakerProviderConfig, SpanEventInsert, SpanInsert, type StabilityAIProviderConfig, SupportedProviders, TelemetryStore, TraceUpsert, UsageData, type ValidatedLLMOpsConfig, VariantJsonData, type VertexAIProviderConfig, type WorkersAIProviderConfig, calculateCacheAwareCost, calculateCost, chatCompletionCreateParamsBaseSchema, createPgStore, dollarsToMicroDollars, formatCost, gateway, generateId, getDefaultPricingProvider, getDefaultProviders, llmopsConfigSchema, logger, mergeWithDefaultProviders, microDollarsToDollars, validateLLMOpsConfig, variantJsonDataSchema };
1393
+ export { type AnthropicProviderConfig, type AnyProviderConfig, type AzureAIProviderConfig, type AzureOpenAIProviderConfig, BaseCacheConfig, type BaseProviderConfig, type BedrockProviderConfig, CacheBackend, CacheBackendType, CacheConfig, CacheEntry, CacheOptions, CacheService, CacheStats, ChatCompletionCreateParamsBase, type CortexProviderConfig, CostResult, DEFAULT_PROVIDER_ENV_VARS, FileCacheBackend, FileCacheConfig, type FireworksAIProviderConfig, type GoogleProviderConfig, type HuggingFaceProviderConfig, type InlineProviderConfig, type InlineProvidersConfig, LLMOPS_INTERNAL_HEADER, LLMOPS_REQUEST_ID_HEADER, LLMOPS_SESSION_ID_HEADER, LLMOPS_SPAN_ID_HEADER, LLMOPS_SPAN_NAME_HEADER, LLMOPS_TRACE_ID_HEADER, LLMOPS_TRACE_NAME_HEADER, LLMOPS_USER_ID_HEADER, LLMOpsClient, LLMOpsConfig, type LLMOpsConfigInput, LLMOpsPricingProvider, MS, MemoryCacheBackend, MemoryCacheConfig, type MistralAIProviderConfig, ModelPricing, type OpenAIProviderConfig, type OracleProviderConfig, Prettify, PricingProvider, type ProviderConfigMap, type ProvidersConfig, type SagemakerProviderConfig, type StabilityAIProviderConfig, SupportedProviders, UsageData, type ValidatedLLMOpsConfig, VariantJsonData, type VertexAIProviderConfig, type WorkersAIProviderConfig, calculateCacheAwareCost, calculateCost, chatCompletionCreateParamsBaseSchema, dollarsToMicroDollars, formatCost, gateway, generateId, getDefaultPricingProvider, getDefaultProviders, llmopsConfigSchema, logger, mergeWithDefaultProviders, microDollarsToDollars, validateLLMOpsConfig, variantJsonDataSchema };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import gateway from "@llmops/gateway";
2
2
  import pino from "pino";
3
- import z$1, { z } from "zod";
3
+ import { z } from "zod";
4
4
 
5
5
  //#region src/constants/headers.d.ts
6
6
  /**
@@ -1390,244 +1390,4 @@ declare class LLMOpsPricingProvider implements PricingProvider {
1390
1390
  */
1391
1391
  declare function getDefaultPricingProvider(): LLMOpsPricingProvider;
1392
1392
  //#endregion
1393
- //#region src/telemetry/postgres.d.ts
1394
- declare const insertLLMRequestSchema: z$1.ZodObject<{
1395
- requestId: z$1.ZodString;
1396
- configId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1397
- variantId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1398
- environmentId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1399
- providerConfigId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1400
- provider: z$1.ZodString;
1401
- model: z$1.ZodString;
1402
- promptTokens: z$1.ZodDefault<z$1.ZodNumber>;
1403
- completionTokens: z$1.ZodDefault<z$1.ZodNumber>;
1404
- totalTokens: z$1.ZodDefault<z$1.ZodNumber>;
1405
- cachedTokens: z$1.ZodDefault<z$1.ZodNumber>;
1406
- cacheCreationTokens: z$1.ZodDefault<z$1.ZodNumber>;
1407
- cost: z$1.ZodDefault<z$1.ZodNumber>;
1408
- cacheSavings: z$1.ZodDefault<z$1.ZodNumber>;
1409
- inputCost: z$1.ZodDefault<z$1.ZodNumber>;
1410
- outputCost: z$1.ZodDefault<z$1.ZodNumber>;
1411
- endpoint: z$1.ZodString;
1412
- statusCode: z$1.ZodNumber;
1413
- latencyMs: z$1.ZodDefault<z$1.ZodNumber>;
1414
- isStreaming: z$1.ZodDefault<z$1.ZodBoolean>;
1415
- userId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1416
- tags: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
1417
- guardrailResults: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodObject<{
1418
- results: z$1.ZodArray<z$1.ZodObject<{
1419
- checkId: z$1.ZodString;
1420
- functionId: z$1.ZodString;
1421
- hookType: z$1.ZodEnum<{
1422
- beforeRequestHook: "beforeRequestHook";
1423
- afterRequestHook: "afterRequestHook";
1424
- }>;
1425
- verdict: z$1.ZodBoolean;
1426
- latencyMs: z$1.ZodNumber;
1427
- }, z$1.core.$strip>>;
1428
- action: z$1.ZodEnum<{
1429
- allowed: "allowed";
1430
- blocked: "blocked";
1431
- logged: "logged";
1432
- }>;
1433
- totalLatencyMs: z$1.ZodNumber;
1434
- }, z$1.core.$strip>>>;
1435
- traceId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1436
- spanId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1437
- parentSpanId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1438
- sessionId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1439
- }, z$1.core.$strip>;
1440
- type LLMRequestInsert = z$1.infer<typeof insertLLMRequestSchema>;
1441
- declare const COST_SUMMARY_GROUP_BY: readonly ["day", "hour", "model", "provider", "endpoint", "tags"];
1442
- type CostSummaryGroupBy = (typeof COST_SUMMARY_GROUP_BY)[number];
1443
- declare const upsertTraceSchema: z$1.ZodObject<{
1444
- traceId: z$1.ZodString;
1445
- name: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1446
- sessionId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1447
- userId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1448
- status: z$1.ZodDefault<z$1.ZodEnum<{
1449
- error: "error";
1450
- unset: "unset";
1451
- ok: "ok";
1452
- }>>;
1453
- startTime: z$1.ZodDate;
1454
- endTime: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodDate>>;
1455
- durationMs: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
1456
- spanCount: z$1.ZodDefault<z$1.ZodNumber>;
1457
- totalInputTokens: z$1.ZodDefault<z$1.ZodNumber>;
1458
- totalOutputTokens: z$1.ZodDefault<z$1.ZodNumber>;
1459
- totalTokens: z$1.ZodDefault<z$1.ZodNumber>;
1460
- totalCost: z$1.ZodDefault<z$1.ZodNumber>;
1461
- tags: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
1462
- metadata: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1463
- }, z$1.core.$strip>;
1464
- type TraceUpsert = z$1.infer<typeof upsertTraceSchema>;
1465
- declare const insertSpanSchema: z$1.ZodObject<{
1466
- traceId: z$1.ZodString;
1467
- spanId: z$1.ZodString;
1468
- parentSpanId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1469
- name: z$1.ZodString;
1470
- kind: z$1.ZodDefault<z$1.ZodNumber>;
1471
- status: z$1.ZodDefault<z$1.ZodNumber>;
1472
- statusMessage: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1473
- startTime: z$1.ZodDate;
1474
- endTime: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodDate>>;
1475
- durationMs: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
1476
- provider: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1477
- model: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1478
- promptTokens: z$1.ZodDefault<z$1.ZodNumber>;
1479
- completionTokens: z$1.ZodDefault<z$1.ZodNumber>;
1480
- totalTokens: z$1.ZodDefault<z$1.ZodNumber>;
1481
- cost: z$1.ZodDefault<z$1.ZodNumber>;
1482
- configId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1483
- variantId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1484
- environmentId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1485
- providerConfigId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1486
- requestId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1487
- source: z$1.ZodDefault<z$1.ZodEnum<{
1488
- gateway: "gateway";
1489
- otlp: "otlp";
1490
- langsmith: "langsmith";
1491
- }>>;
1492
- input: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodUnknown>>;
1493
- output: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodUnknown>>;
1494
- attributes: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1495
- }, z$1.core.$strip>;
1496
- type SpanInsert = z$1.infer<typeof insertSpanSchema>;
1497
- declare const insertSpanEventSchema: z$1.ZodObject<{
1498
- traceId: z$1.ZodString;
1499
- spanId: z$1.ZodString;
1500
- name: z$1.ZodString;
1501
- timestamp: z$1.ZodDate;
1502
- attributes: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1503
- }, z$1.core.$strip>;
1504
- type SpanEventInsert = z$1.infer<typeof insertSpanEventSchema>;
1505
- declare function createLLMRequestsStore(pool: any): {
1506
- batchInsertRequests: (requests: LLMRequestInsert[]) => Promise<{
1507
- count: number;
1508
- }>;
1509
- insertRequest: (request: LLMRequestInsert) => Promise<any>;
1510
- listRequests: (params?: {
1511
- limit?: number;
1512
- offset?: number;
1513
- configId?: string;
1514
- variantId?: string;
1515
- environmentId?: string;
1516
- providerConfigId?: string;
1517
- provider?: string;
1518
- model?: string;
1519
- startDate?: Date;
1520
- endDate?: Date;
1521
- tags?: Record<string, string[]>;
1522
- }) => Promise<{
1523
- data: any;
1524
- total: any;
1525
- limit: number;
1526
- offset: number;
1527
- }>;
1528
- getRequestByRequestId: (requestId: string) => Promise<any>;
1529
- getTotalCost: (params: {
1530
- startDate: Date;
1531
- endDate: Date;
1532
- configId?: string;
1533
- variantId?: string;
1534
- environmentId?: string;
1535
- tags?: Record<string, string[]>;
1536
- }) => Promise<any>;
1537
- getCostByModel: (params: {
1538
- startDate: Date;
1539
- endDate: Date;
1540
- }) => Promise<any>;
1541
- getCostByProvider: (params: {
1542
- startDate: Date;
1543
- endDate: Date;
1544
- }) => Promise<any>;
1545
- getDailyCosts: (params: {
1546
- startDate: Date;
1547
- endDate: Date;
1548
- }) => Promise<any>;
1549
- getCostSummary: (params: {
1550
- startDate: Date;
1551
- endDate: Date;
1552
- configId?: string;
1553
- variantId?: string;
1554
- environmentId?: string;
1555
- groupBy?: CostSummaryGroupBy;
1556
- tags?: Record<string, string[]>;
1557
- tagKeys?: string[];
1558
- }) => Promise<any>;
1559
- getRequestStats: (params: {
1560
- startDate: Date;
1561
- endDate: Date;
1562
- configId?: string;
1563
- variantId?: string;
1564
- environmentId?: string;
1565
- tags?: Record<string, string[]>;
1566
- }) => Promise<any>;
1567
- getDistinctTags: () => Promise<any>;
1568
- };
1569
- declare function createTracesStore(pool: any): {
1570
- upsertTrace: (data: TraceUpsert) => Promise<void>;
1571
- batchInsertSpans: (spans: SpanInsert[]) => Promise<{
1572
- count: number;
1573
- }>;
1574
- batchInsertSpanEvents: (events: SpanEventInsert[]) => Promise<{
1575
- count: number;
1576
- }>;
1577
- listTraces: (params?: {
1578
- limit?: number;
1579
- offset?: number;
1580
- sessionId?: string;
1581
- userId?: string;
1582
- status?: string;
1583
- name?: string;
1584
- startDate?: Date;
1585
- endDate?: Date;
1586
- tags?: Record<string, string[]>;
1587
- }) => Promise<{
1588
- data: any;
1589
- total: any;
1590
- limit: number;
1591
- offset: number;
1592
- }>;
1593
- getTraceWithSpans: (traceId: string) => Promise<{
1594
- trace: any;
1595
- spans: any;
1596
- events: any;
1597
- } | undefined>;
1598
- getTraceStats: (params: {
1599
- startDate: Date;
1600
- endDate: Date;
1601
- sessionId?: string;
1602
- userId?: string;
1603
- }) => Promise<any>;
1604
- };
1605
- type PgStore = ReturnType<typeof createLLMRequestsStore> & ReturnType<typeof createTracesStore> & {
1606
- _pool: unknown;
1607
- _schema: string;
1608
- };
1609
- /**
1610
- * Create a PostgreSQL-backed telemetry store.
1611
- *
1612
- * Usage:
1613
- * ```ts
1614
- * import { llmops } from '@llmops/sdk'
1615
- * import { pgStore } from '@llmops/sdk/store/pg'
1616
- *
1617
- * const ops = llmops({
1618
- * telemetry: pgStore(process.env.DATABASE_URL),
1619
- * })
1620
- * ```
1621
- */
1622
- declare function createPgStore(connectionString: string, options?: {
1623
- schema?: string;
1624
- }): PgStore;
1625
- //#endregion
1626
- //#region src/telemetry/interface.d.ts
1627
- /**
1628
- * TelemetryStore provides read + write access to telemetry data.
1629
- * Implemented by pgStore (and future sqliteStore, etc.)
1630
- */
1631
- type TelemetryStore = Omit<PgStore, '_pool' | '_schema'>;
1632
- //#endregion
1633
- export { type AnthropicProviderConfig, type AnyProviderConfig, type AzureAIProviderConfig, type AzureOpenAIProviderConfig, BaseCacheConfig, type BaseProviderConfig, type BedrockProviderConfig, COST_SUMMARY_GROUP_BY, CacheBackend, CacheBackendType, CacheConfig, CacheEntry, CacheOptions, CacheService, CacheStats, ChatCompletionCreateParamsBase, type CortexProviderConfig, CostResult, CostSummaryGroupBy, DEFAULT_PROVIDER_ENV_VARS, FileCacheBackend, FileCacheConfig, type FireworksAIProviderConfig, type GoogleProviderConfig, type HuggingFaceProviderConfig, type InlineProviderConfig, type InlineProvidersConfig, LLMOPS_INTERNAL_HEADER, LLMOPS_REQUEST_ID_HEADER, LLMOPS_SESSION_ID_HEADER, LLMOPS_SPAN_ID_HEADER, LLMOPS_SPAN_NAME_HEADER, LLMOPS_TRACE_ID_HEADER, LLMOPS_TRACE_NAME_HEADER, LLMOPS_USER_ID_HEADER, LLMOpsClient, LLMOpsConfig, type LLMOpsConfigInput, LLMOpsPricingProvider, LLMRequestInsert, MS, MemoryCacheBackend, MemoryCacheConfig, type MistralAIProviderConfig, ModelPricing, type OpenAIProviderConfig, type OracleProviderConfig, PgStore, Prettify, PricingProvider, type ProviderConfigMap, type ProvidersConfig, type SagemakerProviderConfig, SpanEventInsert, SpanInsert, type StabilityAIProviderConfig, SupportedProviders, TelemetryStore, TraceUpsert, UsageData, type ValidatedLLMOpsConfig, VariantJsonData, type VertexAIProviderConfig, type WorkersAIProviderConfig, calculateCacheAwareCost, calculateCost, chatCompletionCreateParamsBaseSchema, createPgStore, dollarsToMicroDollars, formatCost, gateway, generateId, getDefaultPricingProvider, getDefaultProviders, llmopsConfigSchema, logger, mergeWithDefaultProviders, microDollarsToDollars, validateLLMOpsConfig, variantJsonDataSchema };
1393
+ export { type AnthropicProviderConfig, type AnyProviderConfig, type AzureAIProviderConfig, type AzureOpenAIProviderConfig, BaseCacheConfig, type BaseProviderConfig, type BedrockProviderConfig, CacheBackend, CacheBackendType, CacheConfig, CacheEntry, CacheOptions, CacheService, CacheStats, ChatCompletionCreateParamsBase, type CortexProviderConfig, CostResult, DEFAULT_PROVIDER_ENV_VARS, FileCacheBackend, FileCacheConfig, type FireworksAIProviderConfig, type GoogleProviderConfig, type HuggingFaceProviderConfig, type InlineProviderConfig, type InlineProvidersConfig, LLMOPS_INTERNAL_HEADER, LLMOPS_REQUEST_ID_HEADER, LLMOPS_SESSION_ID_HEADER, LLMOPS_SPAN_ID_HEADER, LLMOPS_SPAN_NAME_HEADER, LLMOPS_TRACE_ID_HEADER, LLMOPS_TRACE_NAME_HEADER, LLMOPS_USER_ID_HEADER, LLMOpsClient, LLMOpsConfig, type LLMOpsConfigInput, LLMOpsPricingProvider, MS, MemoryCacheBackend, MemoryCacheConfig, type MistralAIProviderConfig, ModelPricing, type OpenAIProviderConfig, type OracleProviderConfig, Prettify, PricingProvider, type ProviderConfigMap, type ProvidersConfig, type SagemakerProviderConfig, type StabilityAIProviderConfig, SupportedProviders, UsageData, type ValidatedLLMOpsConfig, VariantJsonData, type VertexAIProviderConfig, type WorkersAIProviderConfig, calculateCacheAwareCost, calculateCost, chatCompletionCreateParamsBaseSchema, dollarsToMicroDollars, formatCost, gateway, generateId, getDefaultPricingProvider, getDefaultProviders, llmopsConfigSchema, logger, mergeWithDefaultProviders, microDollarsToDollars, validateLLMOpsConfig, variantJsonDataSchema };