MCPcopy Create free account
hub / github.com/OpenPipe/OpenPipe / useStats

Function useStats

app/src/utils/hooks.ts:269–290  ·  view source on GitHub ↗
(
  selectedProjectId: string,
  startDate: string | null | undefined,
  endDate: string | null | undefined,
)

Source from the content-addressed store, hash-verified

267};
268
269export const useStats = (
270 selectedProjectId: string,
271 startDate: string | null | undefined,
272 endDate: string | null | undefined,
273) => {
274 const startDateUTC = startDate
275 ? toUTC(new Date(startDate)).startOf("day").toDate()
276 : toUTC(new Date()).startOf("month").toDate();
277
278 const endDateUTC = endDate
279 ? toUTC(new Date(endDate)).endOf("day").toDate()
280 : toUTC(new Date()).endOf("month").toDate();
281
282 return api.usage.stats.useQuery(
283 {
284 projectId: selectedProjectId,
285 startDate: startDateUTC,
286 endDate: endDateUTC,
287 },
288 { enabled: !!selectedProjectId },
289 );
290};
291
292export const useModelTestingStats = (
293 datasetId?: string,

Callers 3

UsageGraphFunction · 0.90
CostGraphFunction · 0.90
UsageFunction · 0.90

Calls 1

toUTCFunction · 0.90

Tested by

no test coverage detected