From 57567e7d72702ad1d99a0a2bc144c1390b128295 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Wed, 28 Jan 2026 08:19:09 -0800 Subject: [PATCH] test: test AI confidence score (box/box-codegen#919) --- .codegen.json | 2 +- docs/ai.md | 1 + test/ai.py | 16 ++++++++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.codegen.json b/.codegen.json index ff89bc9f1..9969bcb45 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "f9e2519", "specHash": "ccdb456", "version": "10.3.0" } +{ "engineHash": "b181eba", "specHash": "ccdb456", "version": "10.3.0" } diff --git a/docs/ai.md b/docs/ai.md index 1c9ab630d..96e3d76b5 100644 --- a/docs/ai.md +++ b/docs/ai.md @@ -246,6 +246,7 @@ client.ai.create_ai_extract_structured( ], ), ], + include_confidence_score=True, ai_agent=ai_extract_structured_agent_basic_text_config, ) ``` diff --git a/test/ai.py b/test/ai.py index 1658d4e6c..00e1100ca 100644 --- a/test/ai.py +++ b/test/ai.py @@ -252,7 +252,12 @@ def testAIExtractStructuredWithFields(): parent=UploadFileAttributesParentField(id='0'), ), string_to_byte_stream( - 'My name is John Doe. I was born in 4th July 1990. I am 34 years old. My hobby is guitar.' + ''.join( + [ + 'My name is John Doe. I was born in 4th July 1990. I am 34 years old. My hobby is guitar. My UUID is ', + get_uuid(), + ] + ) ), ) file: FileFull = uploaded_files.entries[0] @@ -300,8 +305,10 @@ def testAIExtractStructuredWithFields(): ], ), ], + include_confidence_score=True, ai_agent=ai_extract_structured_agent_basic_text_config, ) + assert not response.confidence_score == None assert to_string(response.answer.get('hobby')) == to_string(['guitar']) assert to_string(response.answer.get('firstName')) == 'John' assert to_string(response.answer.get('lastName')) == 'Doe' @@ -318,7 +325,12 @@ def testAIExtractStructuredWithMetadataTemplate(): parent=UploadFileAttributesParentField(id='0'), ), string_to_byte_stream( - 'My name is John Doe. I was born in 4th July 1990. I am 34 years old. My hobby is guitar.' + ''.join( + [ + 'My name is John Doe. I was born in 4th July 1990. I am 34 years old. My hobby is guitar. My UUID is ', + get_uuid(), + ] + ) ), ) file: FileFull = uploaded_files.entries[0]