Fix schema validation error in getModelUsages (#93)

This commit is contained in:
Chris Estreich 2025-06-10 13:20:05 -07:00 • committed by GitHub
parent 36e442601b
commit 6922e4b3ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -301,6 +301,7 @@ export const getModelUsage = async ({
}
const userFilter = userId ? 'AND userId = {userId: String}' : '';
const queryParams: Record<string, string | number | string[]> = {
orgId: orgId!,
timePeriod,
@ -310,6 +311,7 @@ export const getModelUsage = async ({
TelemetryEventName.LLM_COMPLETION,
],
};
if (userId) {
queryParams.userId = userId;
}
@ -327,6 +329,7 @@ export const getModelUsage = async ({
orgId = {orgId: String}
AND timestamp >= toUnixTimestamp(now() - INTERVAL {timePeriod: Int32} DAY)
AND type IN ({types: Array(String)})
AND modelId IS NOT NULL
${userFilter}
GROUP BY 1, 2
`,