@@ -23,6 +23,11 @@ export interface AiExtractStructuredResponse {
2323 /**
2424 * The reason the response finishes. */
2525 readonly completionReason ?: string ;
26+ /**
27+ * The confidence score numeric values for each extracted field as a JSON dictionary. This can be empty if no field could be extracted. */
28+ readonly confidenceScore ?: {
29+ readonly [ key : string ] : any ;
30+ } ;
2631 readonly aiAgentInfo ?: AiAgentInfo ;
2732 readonly rawData ?: SerializedData ;
2833}
@@ -33,6 +38,19 @@ export function serializeAiExtractStructuredResponse(
3338 [ 'answer' ] : serializeAiExtractResponse ( val . answer ) ,
3439 [ 'created_at' ] : serializeDateTime ( val . createdAt ) ,
3540 [ 'completion_reason' ] : val . completionReason ,
41+ [ 'confidence_score' ] :
42+ val . confidenceScore == void 0
43+ ? val . confidenceScore
44+ : ( Object . fromEntries (
45+ Object . entries ( val . confidenceScore ) . map ( ( [ k , v ] : [ string , any ] ) => [
46+ k ,
47+ ( function ( v : any ) : any {
48+ return v ;
49+ } ) ( v ) ,
50+ ] )
51+ ) as {
52+ readonly [ key : string ] : any ;
53+ } ) ,
3654 [ 'ai_agent_info' ] :
3755 val . aiAgentInfo == void 0
3856 ? val . aiAgentInfo
@@ -78,6 +96,33 @@ export function deserializeAiExtractStructuredResponse(
7896 }
7997 const completionReason : undefined | string =
8098 val . completion_reason == void 0 ? void 0 : val . completion_reason ;
99+ if ( ! ( val . confidence_score == void 0 ) && ! sdIsMap ( val . confidence_score ) ) {
100+ throw new BoxSdkError ( {
101+ message :
102+ 'Expecting object for "confidence_score" of type "AiExtractStructuredResponse"' ,
103+ } ) ;
104+ }
105+ const confidenceScore :
106+ | undefined
107+ | {
108+ readonly [ key : string ] : any ;
109+ } =
110+ val . confidence_score == void 0
111+ ? void 0
112+ : sdIsMap ( val . confidence_score )
113+ ? ( Object . fromEntries (
114+ Object . entries ( val . confidence_score ) . map (
115+ ( [ k , v ] : [ string , any ] ) => [
116+ k ,
117+ ( function ( v : any ) : any {
118+ return v ;
119+ } ) ( v ) ,
120+ ]
121+ )
122+ ) as {
123+ readonly [ key : string ] : any ;
124+ } )
125+ : { } ;
81126 const aiAgentInfo : undefined | AiAgentInfo =
82127 val . ai_agent_info == void 0
83128 ? void 0
@@ -86,6 +131,7 @@ export function deserializeAiExtractStructuredResponse(
86131 answer : answer ,
87132 createdAt : createdAt ,
88133 completionReason : completionReason ,
134+ confidenceScore : confidenceScore ,
89135 aiAgentInfo : aiAgentInfo ,
90136 } satisfies AiExtractStructuredResponse ;
91137}
0 commit comments