@@ -23,10 +23,10 @@ export declare class BamlRuntime {
2323 static fromFiles ( rootPath : string , files : Record < string , string > , envVars : Record < string , string | undefined | null > ) : BamlRuntime
2424 reset ( rootPath : string , files : Record < string , string > , envVars : Record < string , string > ) : void
2525 createContextManager ( ) : RuntimeContextManager
26- callFunction ( functionName : string , args : { [ name : string ] : any } , ctx : RuntimeContextManager , tb ? : TypeBuilder | undefined | null , cb ? : ClientRegistry | undefined | null ) : Promise < FunctionResult >
27- callFunctionSync ( functionName : string , args : { [ name : string ] : any } , ctx : RuntimeContextManager , tb ? : TypeBuilder | undefined | null , cb ? : ClientRegistry | undefined | null ) : FunctionResult
28- streamFunction ( functionName : string , args : { [ name : string ] : any } , cb : ( ( err : any , param : FunctionResult ) => void ) | undefined , ctx : RuntimeContextManager , tb ? : TypeBuilder | undefined | null , clientRegistry ? : ClientRegistry | undefined | null ) : FunctionResultStream
29- streamFunctionSync ( functionName : string , args : { [ name : string ] : any } , cb : ( ( err : any , param : FunctionResult ) => void ) | undefined , ctx : RuntimeContextManager , tb ? : TypeBuilder | undefined | null , clientRegistry ? : ClientRegistry | undefined | null ) : FunctionResultStream
26+ callFunction ( functionName : string , args : { [ name : string ] : any } , ctx : RuntimeContextManager , tb : TypeBuilder | undefined | null , cb : ClientRegistry | undefined | null , collectors : Array < Collector > ) : Promise < FunctionResult >
27+ callFunctionSync ( functionName : string , args : { [ name : string ] : any } , ctx : RuntimeContextManager , tb : TypeBuilder | undefined | null , cb : ClientRegistry | undefined | null , collectors : Array < Collector > ) : FunctionResult
28+ streamFunction ( functionName : string , args : { [ name : string ] : any } , cb : ( ( err : any , param : FunctionResult ) => void ) | undefined , ctx : RuntimeContextManager , tb : TypeBuilder | undefined | null , clientRegistry : ClientRegistry | undefined | null , collectors : Array < Collector > ) : FunctionResultStream
29+ streamFunctionSync ( functionName : string , args : { [ name : string ] : any } , cb : ( ( err : any , param : FunctionResult ) => void ) | undefined , ctx : RuntimeContextManager , tb : TypeBuilder | undefined | null , clientRegistry : ClientRegistry | undefined | null , collectors : Array < Collector > ) : FunctionResultStream
3030 setLogEventCallback ( func ?: undefined | ( ( err : any , param : BamlLogEvent ) => void ) ) : void
3131 flush ( ) : void
3232 drainStats ( ) : TraceStats
@@ -54,6 +54,17 @@ export declare class ClientRegistry {
5454 setPrimary ( primary : string ) : void
5555}
5656
57+ export declare class Collector {
58+ constructor ( name ?: string | undefined | null )
59+ get logs ( ) : Array < FunctionLog >
60+ get last ( ) : FunctionLog | null
61+ id ( functionLogId : string ) : FunctionLog | null
62+ get usage ( ) : Usage
63+ toString ( ) : string
64+ static __functionSpanCount ( ) : number
65+ static __printStorage ( ) : void
66+ }
67+
5768export declare class EnumBuilder {
5869 value ( name : string ) : EnumValueBuilder
5970 alias ( alias ?: string | undefined | null ) : EnumBuilder
@@ -71,6 +82,18 @@ export declare class FieldType {
7182 optional ( ) : FieldType
7283}
7384
85+ export declare class FunctionLog {
86+ toString ( ) : string
87+ get id ( ) : string
88+ get functionName ( ) : string
89+ get logType ( ) : string
90+ get timing ( ) : Timing
91+ get usage ( ) : Usage
92+ get calls ( ) : ( LLMCall | LLMStreamCall ) [ ]
93+ get rawLlmResponse ( ) : string | null
94+ get selectedCall ( ) : unknown
95+ }
96+
7497export declare class FunctionResult {
7598 isOk ( ) : boolean
7699 parsed ( allowPartials : boolean ) : any
@@ -81,12 +104,71 @@ export declare class FunctionResultStream {
81104 done ( rctx : RuntimeContextManager ) : Promise < FunctionResult >
82105}
83106
107+ export declare class HttpRequest {
108+ get bodyRaw ( ) : string
109+ get body ( ) : any
110+ toString ( ) : string
111+ get url ( ) : string
112+ get method ( ) : string
113+ get headers ( ) : object
114+ }
115+ export type HTTPRequest = HttpRequest
116+
117+ export declare class HttpResponse {
118+ toString ( ) : string
119+ get status ( ) : number
120+ get headers ( ) : object
121+ get body ( ) : any
122+ }
123+ export type HTTPResponse = HttpResponse
124+
125+ export declare class LlmCall {
126+ get selected ( ) : boolean
127+ get httpRequest ( ) : HTTPRequest | null
128+ get httpResponse ( ) : HTTPResponse | null
129+ get usage ( ) : Usage | null
130+ get timing ( ) : Timing
131+ get provider ( ) : string
132+ get clientName ( ) : string
133+ toString ( ) : string
134+ toString ( ) : string
135+ }
136+ export type LLMCall = LlmCall
137+
138+ export declare class LlmStreamCall {
139+ toString ( ) : string
140+ get httpRequest ( ) : HTTPRequest | null
141+ get httpResponse ( ) : HTTPResponse | null
142+ get provider ( ) : string
143+ get clientName ( ) : string
144+ get selected ( ) : boolean
145+ get usage ( ) : Usage | null
146+ get timing ( ) : StreamTiming
147+ toString ( ) : string
148+ }
149+ export type LLMStreamCall = LlmStreamCall
150+
84151export declare class RuntimeContextManager {
85152 upsertTags ( tags : any ) : void
86153 deepClone ( ) : RuntimeContextManager
87154 contextDepth ( ) : number
88155}
89156
157+ export declare class StreamTiming {
158+ toString ( ) : string
159+ get startTimeUtcMs ( ) : number
160+ get durationMs ( ) : number | null
161+ get timeToFirstParsedMs ( ) : number | null
162+ get timeToFirstTokenMs ( ) : number | null
163+ }
164+
165+ export declare class Timing {
166+ toString ( ) : string
167+ get startTimeUtcMs ( ) : number
168+ get durationMs ( ) : number | null
169+ get timeToFirstParsedMs ( ) : number | null
170+ }
171+
90172export declare class TraceStats {
91173 get failed ( ) : number
92174 get started ( ) : number
@@ -117,6 +199,12 @@ export declare class TypeBuilder {
117199 toString ( ) : string
118200}
119201
202+ export declare class Usage {
203+ toString ( ) : string
204+ get inputTokens ( ) : number | null
205+ get outputTokens ( ) : number | null
206+ }
207+
120208export interface BamlLogEvent {
121209 metadata : LogEventMetadata
122210 prompt ?: string
0 commit comments