I wnat to inspect the details abount the ai_agent, so I get the AI agent default configuration with this:
a2 = client.ai.get_ai_agent_default_config(GetAiAgentDefaultConfigMode.EXTRACT_STRUCTURED, language="ja-JP")
And I tried to use tihs configration with this:
ans4 = client.ai.create_ai_extract_structured(
... [AiItemBase(id="................")],
... fields=[field5, field6],
... ai_agent=a2,
... )
but I got some errors: (When I do not use ai_agent=a2, I can get the collect result.)
Traceback (most recent call last):
File "", line 1, in
File "/Users/jscuser01/.pyenv/versions/3.10.16/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/box_sdk_gen/managers/ai.py", line 453, in create_ai_extract_structured
response: FetchResponse = self.network_session.network_client.fetch(
File "/Users/jscuser01/.pyenv/versions/3.10.16/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/box_sdk_gen/networking/box_network_client.py", line 134, in fetch
self._raise_on_unsuccessful_request(
File "/Users/jscuser01/.pyenv/versions/3.10.16/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/box_sdk_gen/networking/box_network_client.py", line 267, in _raise_on_unsuccessful_request
raise BoxAPIError(
box_sdk_gen.box.errors.BoxAPIError:
Timestamp: 2025-06-10 14:58:27.791832
Underlying error: None
Message: 400 [{"keyword":"enum","dataPath":".long_text.embeddings.model","schemaPath":"#/properties/long_text/properties/embeddings/properties/model/enum","params":{"allowedValues":["azure__openai__text_embedding_ada_002"]},"message":"should be equal to one of the allowed values"}]; Request ID:
Request:
Method: POST
URL: https://api.box.com/2.0/ai/extract_structured
Query params:
{}
Headers:
{ 'Authorization': '---[redacted]---',
'Content-Type': 'application/json',
'User-Agent': 'box-python-generated-sdk-1.14.0',
'X-Box-UA': 'agent=box-python-generated-sdk/1.14.0; env=python/3.10.16'}
Body:
('{"items": [{"id": "1887265902551", "type": "file"}], "fields": [{"key": '
'"\u6587\u66f8\u306e\u7a2e\u985e", "description": '
'"\u6587\u66f8\u306e\u5206\u985e", "displayName": '
'"\u6587\u66f8\u306e\u7a2e\u985e", "type": "string"}, {"key": '
'"\u5951\u7d04\u95a2\u4fc2\u4f1a\u793e", "description": '
'"\u5951\u7d04\u53cc\u65b9", "displayName": '
'"\u5951\u7d04\u4f1a\u793e", "type": "string"}], "ai_agent": '
'{"basic_image": {"model": "azure__openai__gpt_4_1_mini", "system_message": '
'"Respond only in valid json. You are extracting metadata that is name, value '
'pairs from a document. Only output the metadata in valid json form, as '
'{\"name1\":\"value1\",\"name2\":\"value2\"} and nothing else. You '
'will be given the document data and the schema for the metadata, that '
'defines the name, description and type of each of the fields you will be '
'extracting. Schema is of the form {\"fields\": [{\"key\": '
'\"key_name\", \"prompt\": \"prompt to extract the value\", \"type\": '
'\"date\"}]}. Leverage prompt for each key to identify where the key and '
'value pairs are in the document. In certain cases, prompt can also indicate '
'the instructions to perform on the document to obtain the value. Prompt will '
'be in the form of Schema is schema \n document is document", '
'"prompt_template": "If you need to know today's date to respond, it is '
'{current_date}. Schema is {user_question} \n document is '
'{content}", "num_tokens_for_completion": 8400, '
'"llm_endpoint_params": {"temperature": 0, "top_p": 1, "frequency_penalty": '
'0.75, "presence_penalty": 0.75, "stop": "<|im_end|>", "type": '
'"openai_params"}}, "type": "ai_agent_extract_structured", "long_text": '
'{"model": "google__gemini_2_0_flash_001", "num_tokens_for_completion": 4096, '
'"llm_endpoint_params": {"type": "google_params", "temperature": 0, "top_p": '
'1, "top_k": 1}, "system_message": "Respond only in valid json. You are '
'extracting metadata that is name, value pairs from a document. Only output '
'the metadata in valid json form, as '
'{\"name1\":\"value1\",\"name2\":\"value2\"} and nothing else. You '
'will be given the document data and the schema for the metadata, that '
'defines the name, description and type of each of the fields you will be '
'extracting. Schema is of the form {\"fields\": [{\"key\": '
'\"key_name\", \"prompt\": \"prompt to extract the value\", \"type\": '
'\"date\"}]}. Leverage prompt for each key to identify where the key and '
'value pairs are in the document. In certain cases, prompt can also indicate '
'the instructions to perform on the document to obtain the value. Prompt will '
'be in the form of Schema is schema \n document is document", '
'"prompt_template": "If you need to know today's date to respond, it is '
'{current_date}. Schema is {user_question} \n document is '
'{content}", "embeddings": {"model": "google__text_embedding_005", '
'"strategy": {"id": "basic", "num_tokens_per_chunk": 128}}}, "basic_text": '
'{"model": "google__gemini_2_0_flash_001", "num_tokens_for_completion": 4096, '
'"llm_endpoint_params": {"type": "google_params", "temperature": 0, "top_p": '
'1, "top_k": 1}, "system_message": "Respond only in valid json. You are '
'extracting metadata that is name, value pairs from a document. Only output '
'the metadata in valid json form, as '
'{\"name1\":\"value1\",\"name2\":\"value2\"} and nothing else. You '
'will be given the document data and the schema for the metadata, that '
'defines the name, description and type of each of the fields you will be '
'extracting. Schema is of the form {\"fields\": [{\"key\": '
'\"key_name\", \"prompt\": \"prompt to extract the value\", \"type\": '
'\"date\"}]}. Leverage prompt for each key to identify where the key and '
'value pairs are in the document. In certain cases, prompt can also indicate '
'the instructions to perform on the document to obtain the value. Prompt will '
'be in the form of Schema is schema \n document is document", '
'"prompt_template": "If you need to know today's date to respond, it is '
'{current_date}. Schema is {user_question} \n document is '
'{content}"}}}')
Response:
Status code: 400
Headers:
{ 'Alt-Svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000',
'Transfer-Encoding': 'chunked',
'access-control-expose-headers': 'Server-Timing',
'box-request-id': '08eb03a203b7740bbcd67d916857d4610',
'cache-control': 'no-cache',
'content-type': 'application/json; charset=utf-8',
'date': 'Tue, 10 Jun 2025 05:58:27 GMT',
'server-timing': 'traceparent;desc="00-8f6281ababb00b01e028ed87babf7f43-681d4affb1b5f88b-00"',
'set-cookie': 'csrf-token=OqX0kRQSnF7KNq9fSPc4e0RUTXQGNtVLaxMMBwV32Lg; '
'Secure; SameSite=None; Path=/',
'strict-transport-security': 'max-age=31536000',
'via': '1.1 google',
'x-content-type-options': 'nosniff',
'x-download-options': 'noopen',
'x-envoy-upstream-service-time': '85',
'x-frame-options': 'SAMEORIGIN',
'x-xss-protection': '0'}
Code: bad_request
Context Info:
{}
Request Id:
Help Url: https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/
Body:
{ 'code': 'bad_request',
'help_url': 'https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/',
'message': '[{"keyword":"enum","dataPath":".long_text.embeddings.model","schemaPath":"#/properties/long_text/properties/embeddings/properties/model/enum","params":{"allowedValues":["azure__openai__text_embedding_ada_002"]},"message":"should '
'be equal to one of the allowed values"}]',
'request_id': '',
'status': 400,
'type': 'error'}
Versions Used
Python SDK: 3.10.16
Python: 1.14.0
Thans for any help.
I wnat to inspect the details abount the ai_agent, so I get the AI agent default configuration with this:
a2 = client.ai.get_ai_agent_default_config(GetAiAgentDefaultConfigMode.EXTRACT_STRUCTURED, language="ja-JP")
And I tried to use tihs configration with this:
but I got some errors: (When I do not use ai_agent=a2, I can get the collect result.)
Traceback (most recent call last):
File "", line 1, in
File "/Users/jscuser01/.pyenv/versions/3.10.16/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/box_sdk_gen/managers/ai.py", line 453, in create_ai_extract_structured
response: FetchResponse = self.network_session.network_client.fetch(
File "/Users/jscuser01/.pyenv/versions/3.10.16/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/box_sdk_gen/networking/box_network_client.py", line 134, in fetch
self._raise_on_unsuccessful_request(
File "/Users/jscuser01/.pyenv/versions/3.10.16/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/box_sdk_gen/networking/box_network_client.py", line 267, in _raise_on_unsuccessful_request
raise BoxAPIError(
box_sdk_gen.box.errors.BoxAPIError:
Timestamp: 2025-06-10 14:58:27.791832
Underlying error: None
Message: 400 [{"keyword":"enum","dataPath":".long_text.embeddings.model","schemaPath":"#/properties/long_text/properties/embeddings/properties/model/enum","params":{"allowedValues":["azure__openai__text_embedding_ada_002"]},"message":"should be equal to one of the allowed values"}]; Request ID:
Request:
Method: POST
URL: https://api.box.com/2.0/ai/extract_structured
Query params:
{}
Headers:
{ 'Authorization': '---[redacted]---',
'Content-Type': 'application/json',
'User-Agent': 'box-python-generated-sdk-1.14.0',
'X-Box-UA': 'agent=box-python-generated-sdk/1.14.0; env=python/3.10.16'}
Body:
('{"items": [{"id": "1887265902551", "type": "file"}], "fields": [{"key": '
'"\u6587\u66f8\u306e\u7a2e\u985e", "description": '
'"\u6587\u66f8\u306e\u5206\u985e", "displayName": '
'"\u6587\u66f8\u306e\u7a2e\u985e", "type": "string"}, {"key": '
'"\u5951\u7d04\u95a2\u4fc2\u4f1a\u793e", "description": '
'"\u5951\u7d04\u53cc\u65b9", "displayName": '
'"\u5951\u7d04\u4f1a\u793e", "type": "string"}], "ai_agent": '
'{"basic_image": {"model": "azure__openai__gpt_4_1_mini", "system_message": '
'"Respond only in valid json. You are extracting metadata that is name, value '
'pairs from a document. Only output the metadata in valid json form, as '
'{\"name1\":\"value1\",\"name2\":\"value2\"} and nothing else. You '
'will be given the document data and the schema for the metadata, that '
'defines the name, description and type of each of the fields you will be '
'extracting. Schema is of the form {\"fields\": [{\"key\": '
'\"key_name\", \"prompt\": \"prompt to extract the value\", \"type\": '
'\"date\"}]}. Leverage prompt for each key to identify where the key and '
'value pairs are in the document. In certain cases, prompt can also indicate '
'the instructions to perform on the document to obtain the value. Prompt will '
'be in the form of Schema is
schema\n document isdocument", ''"prompt_template": "If you need to know today's date to respond, it is '
'{current_date}. Schema is
{user_question}\n document is ''
{content}", "num_tokens_for_completion": 8400, ''"llm_endpoint_params": {"temperature": 0, "top_p": 1, "frequency_penalty": '
'0.75, "presence_penalty": 0.75, "stop": "<|im_end|>", "type": '
'"openai_params"}}, "type": "ai_agent_extract_structured", "long_text": '
'{"model": "google__gemini_2_0_flash_001", "num_tokens_for_completion": 4096, '
'"llm_endpoint_params": {"type": "google_params", "temperature": 0, "top_p": '
'1, "top_k": 1}, "system_message": "Respond only in valid json. You are '
'extracting metadata that is name, value pairs from a document. Only output '
'the metadata in valid json form, as '
'{\"name1\":\"value1\",\"name2\":\"value2\"} and nothing else. You '
'will be given the document data and the schema for the metadata, that '
'defines the name, description and type of each of the fields you will be '
'extracting. Schema is of the form {\"fields\": [{\"key\": '
'\"key_name\", \"prompt\": \"prompt to extract the value\", \"type\": '
'\"date\"}]}. Leverage prompt for each key to identify where the key and '
'value pairs are in the document. In certain cases, prompt can also indicate '
'the instructions to perform on the document to obtain the value. Prompt will '
'be in the form of Schema is
schema\n document isdocument", ''"prompt_template": "If you need to know today's date to respond, it is '
'{current_date}. Schema is
{user_question}\n document is ''
{content}", "embeddings": {"model": "google__text_embedding_005", ''"strategy": {"id": "basic", "num_tokens_per_chunk": 128}}}, "basic_text": '
'{"model": "google__gemini_2_0_flash_001", "num_tokens_for_completion": 4096, '
'"llm_endpoint_params": {"type": "google_params", "temperature": 0, "top_p": '
'1, "top_k": 1}, "system_message": "Respond only in valid json. You are '
'extracting metadata that is name, value pairs from a document. Only output '
'the metadata in valid json form, as '
'{\"name1\":\"value1\",\"name2\":\"value2\"} and nothing else. You '
'will be given the document data and the schema for the metadata, that '
'defines the name, description and type of each of the fields you will be '
'extracting. Schema is of the form {\"fields\": [{\"key\": '
'\"key_name\", \"prompt\": \"prompt to extract the value\", \"type\": '
'\"date\"}]}. Leverage prompt for each key to identify where the key and '
'value pairs are in the document. In certain cases, prompt can also indicate '
'the instructions to perform on the document to obtain the value. Prompt will '
'be in the form of Schema is
schema\n document isdocument", ''"prompt_template": "If you need to know today's date to respond, it is '
'{current_date}. Schema is
{user_question}\n document is ''
{content}"}}}')Response:
Status code: 400
Headers:
{ 'Alt-Svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000',
'Transfer-Encoding': 'chunked',
'access-control-expose-headers': 'Server-Timing',
'box-request-id': '08eb03a203b7740bbcd67d916857d4610',
'cache-control': 'no-cache',
'content-type': 'application/json; charset=utf-8',
'date': 'Tue, 10 Jun 2025 05:58:27 GMT',
'server-timing': 'traceparent;desc="00-8f6281ababb00b01e028ed87babf7f43-681d4affb1b5f88b-00"',
'set-cookie': 'csrf-token=OqX0kRQSnF7KNq9fSPc4e0RUTXQGNtVLaxMMBwV32Lg; '
'Secure; SameSite=None; Path=/',
'strict-transport-security': 'max-age=31536000',
'via': '1.1 google',
'x-content-type-options': 'nosniff',
'x-download-options': 'noopen',
'x-envoy-upstream-service-time': '85',
'x-frame-options': 'SAMEORIGIN',
'x-xss-protection': '0'}
Code: bad_request
Context Info:
{}
Request Id:
Help Url: https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/
Body:
{ 'code': 'bad_request',
'help_url': 'https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/',
'message': '[{"keyword":"enum","dataPath":".long_text.embeddings.model","schemaPath":"#/properties/long_text/properties/embeddings/properties/model/enum","params":{"allowedValues":["azure__openai__text_embedding_ada_002"]},"message":"should '
'be equal to one of the allowed values"}]',
'request_id': '',
'status': 400,
'type': 'error'}
Versions Used
Python SDK: 3.10.16
Python: 1.14.0
Thans for any help.