Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "e392e8c", "specHash": "dd7f7a9", "version": "4.12.0" }
{ "engineHash": "ed5236c", "specHash": "131c54a", "version": "4.12.0" }
9 changes: 9 additions & 0 deletions box_sdk_gen/managers/ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,12 @@ def create_ai_ask(
) -> Optional[AiResponseFull]:
"""
Sends an AI request to supported LLMs and returns an answer specifically focused on the user's question given the provided context.

You can ask a question about a single file, several files, or the entire contents of a Box Hub. To search across and ask questions about everything in a Box Hub, send a single item with `type` set to `hubs` and the Hub's ID as the `id`. Box AI answers the question using the indexed content of all files in that Hub.


Asking questions about a Box Hub requires Box AI for Hubs to be enabled in the Admin Console before the Hub is created, so that its content is indexed.

:param mode: Box AI handles text documents with text representations up to 2MB in size, or a maximum of 25 files,
whichever comes first. If the text file size exceeds 2MB, the first 2MB of text representation will be processed.
Box AI handles image documents with a resolution of 1024 x 1024 pixels, with a maximum of 5 images or 5 pages
Expand All @@ -271,6 +277,9 @@ def create_ai_ask(
The prompt's length is limited to 10000 characters.
:type prompt: str
:param items: The items to be processed by the LLM, often files.
To search across and ask questions about the contents of a Box Hub,
pass a single item with `type` set to `hubs`. See the item `type`
property for details.
:type items: List[AiItemAsk]
:param dialogue_history: The history of prompts and answers previously passed to the LLM. This provides additional context to the LLM in generating the response., defaults to None
:type dialogue_history: Optional[List[AiDialogueHistory]], optional
Expand Down
24 changes: 23 additions & 1 deletion box_sdk_gen/managers/hubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ class GetEnterpriseHubsV2025R0Direction(str, Enum):
DESC = 'DESC'


class UpdateHubByIdV2025R0CopyHubAccess(str, Enum):
ALL = 'all'
COMPANY = 'company'
NONE = 'none'


class HubsManager:
def __init__(
self,
Expand Down Expand Up @@ -304,6 +310,7 @@ def update_hub_by_id_v2025_r0(
can_non_owners_invite: Optional[bool] = None,
can_shared_link_be_created: Optional[bool] = None,
can_public_shared_link_be_created: Optional[bool] = None,
copy_hub_access: Optional[UpdateHubByIdV2025R0CopyHubAccess] = None,
box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
extra_headers: Optional[Dict[str, Optional[str]]] = None
) -> HubV2025R0:
Expand Down Expand Up @@ -332,6 +339,12 @@ def update_hub_by_id_v2025_r0(
:type can_shared_link_be_created: Optional[bool], optional
:param can_public_shared_link_be_created: Indicates if a public shared link can be created for the Box Hub., defaults to None
:type can_public_shared_link_be_created: Optional[bool], optional
:param copy_hub_access: Specifies who is allowed to copy the Box Hub.

* `all` - Any user with access to the Hub can copy it.
* `company` - Only users within the same enterprise as the Hub can copy it.
* `none` - No one can copy the Hub., defaults to None
:type copy_hub_access: Optional[UpdateHubByIdV2025R0CopyHubAccess], optional
:param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
:type box_version: BoxVersionHeaderV2025R0, optional
:param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
Expand All @@ -349,6 +362,7 @@ def update_hub_by_id_v2025_r0(
'can_non_owners_invite': can_non_owners_invite,
'can_shared_link_be_created': can_shared_link_be_created,
'can_public_shared_link_be_created': can_public_shared_link_be_created,
'copy_hub_access': copy_hub_access,
}
headers_map: Dict[str, str] = prepare_params(
{'box-version': to_string(box_version), **extra_headers}
Expand Down Expand Up @@ -425,6 +439,7 @@ def copy_hub_v2025_r0(
*,
title: Optional[str] = None,
description: Optional[str] = None,
include_items: Optional[bool] = None,
box_version: BoxVersionHeaderV2025R0 = BoxVersionHeaderV2025R0._2025_0,
extra_headers: Optional[Dict[str, Optional[str]]] = None
) -> HubV2025R0:
Expand All @@ -446,14 +461,21 @@ def copy_hub_v2025_r0(
:type title: Optional[str], optional
:param description: Description of the Box Hub., defaults to None
:type description: Optional[str], optional
:param include_items: If true, the items which the user has Editor or Owner access to in the original Box Hub will be copied to the new Box Hub.
Defaults to false., defaults to None
:type include_items: Optional[bool], optional
:param box_version: Version header., defaults to BoxVersionHeaderV2025R0._2025_0
:type box_version: BoxVersionHeaderV2025R0, optional
:param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
:type extra_headers: Optional[Dict[str, Optional[str]]], optional
"""
if extra_headers is None:
extra_headers = {}
request_body: Dict = {'title': title, 'description': description}
request_body: Dict = {
'title': title,
'description': description,
'include_items': include_items,
}
headers_map: Dict[str, str] = prepare_params(
{'box-version': to_string(box_version), **extra_headers}
)
Expand Down
5 changes: 5 additions & 0 deletions box_sdk_gen/managers/sign_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ def create_sign_request(
external_id: Union[Optional[str], NullValue] = None,
template_id: Union[Optional[str], NullValue] = None,
external_system_name: Union[Optional[str], NullValue] = None,
request_flow: Union[Optional[str], NullValue] = None,
extra_headers: Optional[Dict[str, Optional[str]]] = None
) -> SignRequest:
"""
Expand Down Expand Up @@ -314,6 +315,9 @@ def create_sign_request(
:type template_id: Union[Optional[str], NullValue], optional
:param external_system_name: Used as an optional system name to appear in the signature log next to the signers who have been assigned the `embed_url_external_id`., defaults to None
:type external_system_name: Union[Optional[str], NullValue], optional
:param request_flow: The flow type of the sign request. Values can include `standard` or `cfr11`.
When not specified during creation, a default is chosen based on admin settings., defaults to None
:type request_flow: Union[Optional[str], NullValue], optional
:param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
:type extra_headers: Optional[Dict[str, Optional[str]]], optional
"""
Expand All @@ -337,6 +341,7 @@ def create_sign_request(
'external_id': external_id,
'template_id': template_id,
'external_system_name': external_system_name,
'request_flow': request_flow,
}
headers_map: Dict[str, str] = prepare_params({**extra_headers})
response: FetchResponse = self.network_session.network_client.fetch(
Expand Down
30 changes: 14 additions & 16 deletions box_sdk_gen/networking/box_network_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class APIRequest:
data: Optional[Union[str, ByteStream, MultipartEncoder]]
content_type: Optional[str] = None
allow_redirects: bool = True
timeout: Optional[Tuple[Optional[float], Optional[float]]] = None
timeout: Optional[Union[float, Tuple[Optional[float], Optional[float]]]] = None


@dataclass
Expand Down Expand Up @@ -189,36 +189,34 @@ def _prepare_request(
@staticmethod
def _get_request_timeout(
options: 'FetchOptions',
) -> Optional[Tuple[Optional[float], Optional[float]]]:
) -> Optional[Union[float, Tuple[Optional[float], Optional[float]]]]:
"""
Derive requests timeout tuple (connect, read) in seconds.
Derive requests timeout in seconds.

Uses `options.network_session.timeout_config` when present.
The timeout config values are expected to be in milliseconds.

Returns a tuple (connect, read) when both timeouts are specified,
a single float when only one is set, or None to use no timeout.
"""
network_session = options.network_session
timeout_config = network_session.timeout_config if network_session else None
if timeout_config is None:
return None

connection_timeout_ms, read_timeout_ms = (
timeout_config.connection_timeout_ms,
timeout_config.read_timeout_ms,
)
connection_timeout_ms = timeout_config.connection_timeout_ms
read_timeout_ms = timeout_config.read_timeout_ms

if connection_timeout_ms is None and read_timeout_ms is None:
return None

connection_timeout_sec = (
connection_timeout_ms / 1000.0
if connection_timeout_ms is not None
else None
)
read_timeout_sec = (
read_timeout_ms / 1000.0 if read_timeout_ms is not None else None
)
if connection_timeout_ms is not None and read_timeout_ms is not None:
return (connection_timeout_ms / 1000.0, read_timeout_ms / 1000.0)

if connection_timeout_ms is not None:
return connection_timeout_ms / 1000.0

return (connection_timeout_sec, read_timeout_sec)
return read_timeout_ms / 1000.0

@staticmethod
def _prepare_headers(
Expand Down
2 changes: 1 addition & 1 deletion box_sdk_gen/networking/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(
data_sanitizer = DataSanitizer()
if timeout_config is None:
timeout_config = TimeoutConfig(
connection_timeout_ms=5000,
connection_timeout_ms=10000,
read_timeout_ms=60000,
)
self.additional_headers = additional_headers
Expand Down
3 changes: 3 additions & 0 deletions box_sdk_gen/schemas/ai_ask.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ def __init__(
The prompt's length is limited to 10000 characters.
:type prompt: str
:param items: The items to be processed by the LLM, often files.
To search across and ask questions about the contents of a Box Hub,
pass a single item with `type` set to `hubs`. See the item `type`
property for details.
:type items: List[AiItemAsk]
:param dialogue_history: The history of prompts and answers previously passed to the LLM. This provides additional context to the LLM in generating the response., defaults to None
:type dialogue_history: Optional[List[AiDialogueHistory]], optional
Expand Down
14 changes: 8 additions & 6 deletions box_sdk_gen/schemas/ai_item_ask.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ def __init__(
**kwargs
):
"""
:param id: The ID of the file.
:type id: str
:param type: The type of the item. A `hubs` item must be used as a single item.
:type type: AiItemAskTypeField
:param content: The content of the item, often the text representation., defaults to None
:type content: Optional[str], optional
:param id: The ID of the file, or the ID of the Box Hub when `type` is `hubs`.
:type id: str
:param type: The type of the item. Use `file` to ask a question about a file, or `hubs` to
search across and ask a question about the entire contents of a Box Hub.
A `hubs` item must be the only item in the request.
:type type: AiItemAskTypeField
:param content: The content of the item, often the text representation., defaults to None
:type content: Optional[str], optional
"""
super().__init__(**kwargs)
self.id = id
Expand Down
5 changes: 5 additions & 0 deletions box_sdk_gen/schemas/sign_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def __init__(
external_id: Optional[str] = None,
template_id: Optional[str] = None,
external_system_name: Optional[str] = None,
request_flow: Optional[str] = None,
**kwargs
):
"""
Expand Down Expand Up @@ -170,6 +171,9 @@ def __init__(
:type template_id: Optional[str], optional
:param external_system_name: Used as an optional system name to appear in the signature log next to the signers who have been assigned the `embed_url_external_id`., defaults to None
:type external_system_name: Optional[str], optional
:param request_flow: The flow type of the sign request. Values can include `standard` or `cfr11`.
When not specified during creation, a default is chosen based on admin settings., defaults to None
:type request_flow: Optional[str], optional
"""
super().__init__(
is_document_preparation_needed=is_document_preparation_needed,
Expand All @@ -185,6 +189,7 @@ def __init__(
external_id=external_id,
template_id=template_id,
external_system_name=external_system_name,
request_flow=request_flow,
**kwargs
)
self.type = type
Expand Down
Loading
Loading