Преглед на файлове

zen: track model tier in stats

Frank преди 1 месец
родител
ревизия
ea5dd9d940
променени са 4 файла, в които са добавени 26 реда и са изтрити 54 реда
  1. 2 1
      infra/stats.ts
  2. 2 1
      packages/console/function/src/log-processor.ts
  3. 10 0
      packages/session-ui/sst-env.d.ts
  4. 12 52
      sst-env.d.ts

+ 2 - 1
infra/stats.ts

@@ -42,11 +42,12 @@ const inferenceEventTable = new aws.s3tables.Table(
             { name: "request", type: "string", required: false },
             { name: "client", type: "string", required: false },
             { name: "user_agent", type: "string", required: false },
+            { name: "model", type: "string", required: false },
+            { name: "model_tier", type: "string", required: false },
             { name: "model_variant", type: "string", required: false },
             { name: "source", type: "string", required: false },
             { name: "provider", type: "string", required: false },
             { name: "provider_model", type: "string", required: false },
-            { name: "model", type: "string", required: false },
             { name: "llm_error_code", type: "int", required: false },
             { name: "llm_error_message", type: "string", required: false },
             { name: "error_response", type: "string", required: false },

+ 2 - 1
packages/console/function/src/log-processor.ts

@@ -118,11 +118,12 @@ function toLakeEvent(time: string, data: Record<string, unknown>) {
     request: string(data, "request"),
     client: string(data, "client"),
     user_agent: string(data, "user_agent"),
+    model: string(data, "model"),
+    model_tier: string(data, "model.tier"),
     model_variant: string(data, "model.variant"),
     source: string(data, "source"),
     provider: string(data, "provider"),
     provider_model: string(data, "provider.model"),
-    model: string(data, "model"),
     llm_error_code: integer(data, "llm.error.code"),
     llm_error_message: string(data, "llm.error.message"),
     error_response: string(data, "error.response"),

+ 10 - 0
packages/session-ui/sst-env.d.ts

@@ -0,0 +1,10 @@
+/* This file is auto-generated by SST. Do not edit. */
+/* tslint:disable */
+/* eslint-disable */
+/* deno-fmt-ignore-file */
+/* biome-ignore-all lint: auto-generated */
+
+/// <reference path="../../sst-env.d.ts" />
+
+import "sst"
+export {}

+ 12 - 52
sst-env.d.ts

@@ -26,6 +26,14 @@ declare module "sst" {
     "AuthApi": import("@cloudflare/workers-types").Service
     "AuthStorage": import("@cloudflare/workers-types").KVNamespace
     "Bucket": import("@cloudflare/workers-types").R2Bucket
+    "CLOUDFLARE_API_TOKEN": {
+      "type": "sst.sst.Secret"
+      "value": string
+    }
+    "CLOUDFLARE_DEFAULT_ACCOUNT_ID": {
+      "type": "sst.sst.Secret"
+      "value": string
+    }
     "Console": {
       "type": "sst.cloudflare.SolidStart"
       "url": string
@@ -91,37 +99,6 @@ declare module "sst" {
       "type": "random.index/randomPassword.RandomPassword"
       "value": string
     }
-    "InferenceEvent": {
-      "catalog": string
-      "database": string
-      "region": string
-      "table": string
-      "tableBucket": string
-      "type": "sst.sst.Linkable"
-      "workgroup": string
-    }
-    "LakeIngest": {
-      "secret": string
-      "type": "sst.sst.Linkable"
-      "url": string
-    }
-    "LakeIngestConfig": {
-      "secret": string
-      "streamName": string
-      "type": "sst.sst.Linkable"
-    }
-    "LakeIngestSecret": {
-      "type": "random.index/randomPassword.RandomPassword"
-      "value": string
-    }
-    "LakeIngestService": {
-      "service": string
-      "type": "sst.aws.Service"
-      "url": string
-    }
-    "LakeVpc": {
-      "type": "sst.aws.Vpc"
-    }
     "LogProcessor": import("@cloudflare/workers-types").Service
     "R2AccessKey": {
       "type": "sst.sst.Secret"
@@ -155,28 +132,11 @@ declare module "sst" {
       "type": "sst.sst.Linkable"
       "value": string
     }
-    "Stat": import("@cloudflare/workers-types").Service
-    "Stats": {
-      "type": "sst.cloudflare.SolidStart"
-      "url": string
-    }
-    "StatsDatabase": {
-      "database": string
-      "host": string
-      "password": string
-      "port": number
-      "type": "sst.sst.Linkable"
-      "url": string
-      "username": string
-    }
-    "StatsSyncConfig": {
-      "dataset": string
-      "type": "sst.sst.Linkable"
-    }
-    "StatsSyncService": {
-      "service": string
-      "type": "sst.aws.Service"
+    "SUPPORT_API_KEY": {
+      "type": "sst.sst.Secret"
+      "value": string
     }
+    "Stat": import("@cloudflare/workers-types").Service
     "Teams": {
       "type": "sst.cloudflare.SolidStart"
       "url": string