1- import type { RunResult , EvalConfig , TraceResult , StandardResponse } from '../lib/types' ;
1+ import type { RunResult , EvalConfig , TraceResult , MetricMetadata , StandardResponse } from '../lib/types' ;
22import { config } from '../config' ;
33
44const API_BASE_URL = `${ config . api . baseUrl } /api` ;
@@ -150,22 +150,22 @@ export async function evaluateTracesStreaming(
150150 }
151151}
152152
153- export async function listMetrics ( ) {
153+ export async function listMetrics ( ) : Promise < MetricMetadata [ ] > {
154154 try {
155155 const response = await fetch ( `${ API_BASE_URL } /metrics` ) ;
156156
157157 if ( ! response . ok ) {
158158 throw new Error ( `Failed to fetch metrics: ${ response . statusText } ` ) ;
159159 }
160160
161- return unwrap ( response ) ;
161+ return unwrap < MetricMetadata [ ] > ( response ) ;
162162 } catch ( error ) {
163163 console . error ( 'Failed to list metrics:' , error ) ;
164164 throw error ;
165165 }
166166}
167167
168- export async function validateEvalSet ( evalSetFile : File ) {
168+ export async function validateEvalSet ( evalSetFile : File ) : Promise < { valid : boolean ; evalSetId ?: string ; numCases ?: number ; errors ?: string [ ] } > {
169169 const formData = new FormData ( ) ;
170170 formData . append ( 'eval_set_file' , evalSetFile ) ;
171171
@@ -179,7 +179,7 @@ export async function validateEvalSet(evalSetFile: File) {
179179 throw new Error ( `Failed to validate eval set: ${ response . statusText } ` ) ;
180180 }
181181
182- return unwrap ( response ) ;
182+ return unwrap < { valid : boolean ; evalSetId ?: string ; numCases ?: number ; errors ?: string [ ] } > ( response ) ;
183183 } catch ( error ) {
184184 console . error ( 'Failed to validate eval set:' , error ) ;
185185 throw error ;
@@ -247,18 +247,18 @@ export async function loadBugReport(
247247 throw new Error ( errorMessage ) ;
248248 }
249249
250- return unwrap ( response ) ;
250+ return unwrap < { loadedSessions : string [ ] ; count : number } > ( response ) ;
251251}
252252
253- export async function healthCheck ( ) {
253+ export async function healthCheck ( ) : Promise < { status : string ; version : string } > {
254254 try {
255255 const response = await fetch ( `${ API_BASE_URL } /health` ) ;
256256
257257 if ( ! response . ok ) {
258258 throw new Error ( `Health check failed: ${ response . statusText } ` ) ;
259259 }
260260
261- return unwrap ( response ) ;
261+ return unwrap < { status : string ; version : string } > ( response ) ;
262262 } catch ( error ) {
263263 console . error ( 'Health check failed:' , error ) ;
264264 throw error ;
0 commit comments