@@ -31,7 +31,6 @@ import {
31
31
conformOutput ,
32
32
validateSupport ,
33
33
} from './model/middleware.js' ;
34
- import * as telemetry from './telemetry.js' ;
35
34
36
35
//
37
36
// IMPORTANT: Please keep type definitions in sync with
@@ -197,6 +196,7 @@ export const GenerateRequestSchema = z.object({
197
196
context : z . array ( DocumentDataSchema ) . optional ( ) ,
198
197
candidates : z . number ( ) . optional ( ) ,
199
198
} ) ;
199
+ export type GenerateRequestData = z . infer < typeof GenerateRequestSchema > ;
200
200
201
201
export interface GenerateRequest <
202
202
CustomOptionsSchema extends z . ZodTypeAny = z . ZodTypeAny ,
@@ -323,25 +323,15 @@ export function defineModel<
323
323
use : middleware ,
324
324
} ,
325
325
( input ) => {
326
- telemetry . recordGenerateActionInputLogs ( options . name , input ) ;
327
326
const startTimeMs = performance . now ( ) ;
328
327
329
- return runner ( input , getStreamingCallback ( ) )
330
- . then ( ( response ) => {
331
- const timedResponse = {
332
- ...response ,
333
- latencyMs : performance . now ( ) - startTimeMs ,
334
- } ;
335
- telemetry . recordGenerateActionOutputLogs ( options . name , response ) ;
336
- telemetry . recordGenerateActionMetrics ( options . name , input , {
337
- response : timedResponse ,
338
- } ) ;
339
- return timedResponse ;
340
- } )
341
- . catch ( ( err ) => {
342
- telemetry . recordGenerateActionMetrics ( options . name , input , { err } ) ;
343
- throw err ;
344
- } ) ;
328
+ return runner ( input , getStreamingCallback ( ) ) . then ( ( response ) => {
329
+ const timedResponse = {
330
+ ...response ,
331
+ latencyMs : performance . now ( ) - startTimeMs ,
332
+ } ;
333
+ return timedResponse ;
334
+ } ) ;
345
335
}
346
336
) ;
347
337
Object . assign ( act , {
0 commit comments