Skip to content

Commit cc053e8

Browse files
committed
fix dimensions gathering
1 parent 919686f commit cc053e8

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

dashboard/ai-analytics/src/lib/dimensions.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,7 @@ export const fetchAvailableDimensions = async () => {
88
}
99

1010
try {
11-
// SQL query to get all unique values for each dimension
12-
const query = `
13-
SELECT
14-
groupUniqArray(organization) as organization,
15-
groupUniqArray(project) as project,
16-
groupUniqArray(environment) as environment,
17-
groupUniqArray(model) as model,
18-
groupUniqArray(provider) as provider
19-
FROM llm_events WHERE timestamp > now() - interval '1 month' FORMAT JSON
20-
`;
21-
22-
// URL encode the query
23-
const encodedQuery = encodeURIComponent(query);
24-
const url = `${TINYBIRD_API_URL}/v0/sql?q=${encodedQuery}`;
25-
26-
console.log('Fetching available dimensions from:', url);
27-
11+
const url = `${TINYBIRD_API_URL}/v0/pipes/llm_dimensions.json`;
2812
const response = await fetch(url, {
2913
headers: {
3014
Authorization: `Bearer ${TINYBIRD_API_KEY}`,
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
TOKEN read_pipes READ
2+
3+
NODE llm_dimensions_node
4+
SQL >
5+
SELECT
6+
groupUniqArray(organization) as organization,
7+
groupUniqArray(project) as project,
8+
groupUniqArray(environment) as environment,
9+
groupUniqArray(model) as model,
10+
groupUniqArray(provider) as provider
11+
FROM llm_events WHERE timestamp > now() - interval '1 month'
12+
13+
TYPE endpoint

0 commit comments

Comments
 (0)