Programmatically fetching logged data

If you want to fetch your logged data and metrics programmatically, you can do so via our Typescript and Python clients:

First, npm install @rungalileo/observe

Then add the following to y

import { ApiClient } from "@rungalileo/observe";
const apiClient = new ApiClient();
await apiClient.init("YOUR_PROJECT_NAME");

You can use this with getLoggedData to retrieve the raw data.

// Optional
const filters = [
    { "col_name": "model", "operator": "eq", "value": "gpt-3.5-turbo" },
]

// Optional
const sort_spec = [
    { "col_name": "created_at", "sort_dir": "asc" }
]

const rows = await apiClient.getLoggedData(
    "2024-03-11T16:15:28.294Z",  // ISO start_time string with timezone
    "2024-03-12T16:15:28.294Z",  // ISO end_time string with timezone
    filters,                     // (optional) See above for an example.
    sort_spec,                   // (optional) See above for an example
    limit                        // a number of items to return
);
console.log(rows);

You can use getMetrics to get corresponding metrics.

const metrics = await apiClient.getMetrics(
    "2024-03-11T16:15:28.294Z",
    "2024-03-12T16:15:28.294Z",
    filters
);
console.log(metrics);

Last updated