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": "a87c352", "specHash": "ded99bf", "version": "4.11.0" }
{ "engineHash": "a87c352", "specHash": "dd7f7a9", "version": "4.11.0" }
39 changes: 34 additions & 5 deletions box_sdk_gen/managers/ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

from box_sdk_gen.serialization.json import deserialize

from box_sdk_gen.schemas.ai_extract_sub_field import AiExtractSubField

from box_sdk_gen.schemas.ai_options_rules import AiOptionsRules

from box_sdk_gen.schemas.ai_item_ask import AiItemAsk

from box_sdk_gen.schemas.ai_dialogue_history import AiDialogueHistory
Expand All @@ -40,6 +44,12 @@

from box_sdk_gen.schemas.ai_extract_structured_agent import AiExtractStructuredAgent

from box_sdk_gen.schemas.ai_taxonomy_reference import AiTaxonomyReference

from box_sdk_gen.schemas.ai_taxonomy_file_reference import AiTaxonomyFileReference

from box_sdk_gen.schemas.ai_taxonomy_source import AiTaxonomySource

from box_sdk_gen.schemas.ai_response_full import AiResponseFull

from box_sdk_gen.schemas.client_error import ClientError
Expand Down Expand Up @@ -185,6 +195,10 @@ def __init__(
prompt: Optional[str] = None,
type: Optional[str] = None,
options: Optional[List[CreateAiExtractStructuredFieldsOptionsField]] = None,
fields: Optional[List[AiExtractSubField]] = None,
taxonomy_key: Optional[str] = None,
namespace: Optional[str] = None,
options_rules: Optional[AiOptionsRules] = None,
**kwargs
):
"""
Expand All @@ -196,10 +210,16 @@ def __init__(
:type display_name: Optional[str], optional
:param prompt: The context about the key that may include how to find and format it., defaults to None
:type prompt: Optional[str], optional
:param type: The type of the field. It can include but is not limited to `string`, `float`, `date`, `enum`, and `multiSelect`., defaults to None
:param type: The type of the field. It can include but is not limited to `string`, `float`, `date`, `enum`, `multiSelect`,`taxonomy`, `struct`, and `table`., defaults to None
:type type: Optional[str], optional
:param options: A list of options for this field. This is most often used in combination with the `enum` and `multiSelect` field types., defaults to None
:type options: Optional[List[CreateAiExtractStructuredFieldsOptionsField]], optional
:param fields: The nested fields for this field. Used with `struct` and `table` field types to define the nested structure., defaults to None
:type fields: Optional[List[AiExtractSubField]], optional
:param taxonomy_key: The identifier for a taxonomy, which corresponds to the `key` of the taxonomy source. Required if using `taxonomy` type field., defaults to None
:type taxonomy_key: Optional[str], optional
:param namespace: The namespace of the taxonomy source. Required if using `taxonomy` type field from an existing taxonomy., defaults to None
:type namespace: Optional[str], optional
"""
super().__init__(**kwargs)
self.key = key
Expand All @@ -208,6 +228,10 @@ def __init__(
self.prompt = prompt
self.type = type
self.options = options
self.fields = fields
self.taxonomy_key = taxonomy_key
self.namespace = namespace
self.options_rules = options_rules


class AiManager:
Expand Down Expand Up @@ -235,8 +259,8 @@ 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.
:param mode: Box AI handles text documents with text representations up to 1MB in size, or a maximum of 25 files,
whichever comes first. If the text file size exceeds 1MB, the first 1MB of text representation will be processed.
: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
for multi-page images. If the number of image or image pages exceeds 5, the first 5 images or pages will
be processed. If you set mode parameter to `single_item_qa`, the items array can have one element only.
Expand Down Expand Up @@ -298,8 +322,8 @@ def create_ai_text_gen(
:param items: The items to be processed by the LLM, often files.
The array can include **exactly one** element.

**Note**: Box AI handles documents with text representations up to 1MB in size.
If the file size exceeds 1MB, the first 1MB of text representation will be processed.
**Note**: Box AI handles documents with text representations up to 2MB in size.
If the file size exceeds 2MB, the first 2MB of text representation will be processed.
:type items: List[CreateAiTextGenItems]
:param dialogue_history: The history of prompts and answers previously passed to the LLM. This parameter provides the additional context to the LLM when generating the response., defaults to None
:type dialogue_history: Optional[List[AiDialogueHistory]], optional
Expand Down Expand Up @@ -428,6 +452,7 @@ def create_ai_extract_structured(
ai_agent: Optional[AiExtractStructuredAgent] = None,
include_confidence_score: Optional[bool] = None,
include_reference: Optional[bool] = None,
taxonomy_sources: Optional[List[AiTaxonomySource]] = None,
extra_headers: Optional[Dict[str, Optional[str]]] = None
) -> AiExtractStructuredResponse:
"""
Expand Down Expand Up @@ -456,6 +481,9 @@ def create_ai_extract_structured(
:type include_confidence_score: Optional[bool], optional
:param include_reference: A flag to indicate whether references for every extracted field should be returned., defaults to None
:type include_reference: Optional[bool], optional
:param taxonomy_sources: The taxonomy sources to be used for the structured extraction. They can either be an existing file or a taxonomy.
For your request to work, `fields` must also be provided. `taxonomy_sources` is not supported with `metadata_template`., defaults to None
:type taxonomy_sources: Optional[List[AiTaxonomySource]], 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 @@ -468,6 +496,7 @@ def create_ai_extract_structured(
'ai_agent': ai_agent,
'include_confidence_score': include_confidence_score,
'include_reference': include_reference,
'taxonomy_sources': taxonomy_sources,
}
headers_map: Dict[str, str] = prepare_params({**extra_headers})
response: FetchResponse = self.network_session.network_client.fetch(
Expand Down
38 changes: 38 additions & 0 deletions box_sdk_gen/managers/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class GetEventsEventType(str, Enum):
ADD_DEVICE_ASSOCIATION = 'ADD_DEVICE_ASSOCIATION'
ADD_LOGIN_ACTIVITY_DEVICE = 'ADD_LOGIN_ACTIVITY_DEVICE'
ADMIN_LOGIN = 'ADMIN_LOGIN'
ADVANCED_FOLDER_SETTINGS_UPDATE = 'ADVANCED_FOLDER_SETTINGS_UPDATE'
APPLICATION_CREATED = 'APPLICATION_CREATED'
APPLICATION_PUBLIC_KEY_ADDED = 'APPLICATION_PUBLIC_KEY_ADDED'
APPLICATION_PUBLIC_KEY_DELETED = 'APPLICATION_PUBLIC_KEY_DELETED'
Expand All @@ -69,6 +70,7 @@ class GetEventsEventType(str, Enum):
COLLABORATION_ROLE_CHANGE = 'COLLABORATION_ROLE_CHANGE'
COMMENT_CREATE = 'COMMENT_CREATE'
COMMENT_DELETE = 'COMMENT_DELETE'
COMMENT_EDIT = 'COMMENT_EDIT'
CONTENT_WORKFLOW_ABNORMAL_DOWNLOAD_ACTIVITY = (
'CONTENT_WORKFLOW_ABNORMAL_DOWNLOAD_ACTIVITY'
)
Expand All @@ -91,11 +93,19 @@ class GetEventsEventType(str, Enum):
EDIT = 'EDIT'
EDIT_USER = 'EDIT_USER'
EMAIL_ALIAS_CONFIRM = 'EMAIL_ALIAS_CONFIRM'
EMAIL_ALIAS_PRIMARY = 'EMAIL_ALIAS_PRIMARY'
EMAIL_ALIAS_REMOVE = 'EMAIL_ALIAS_REMOVE'
EMAIL_UPLOAD_DISABLED = 'EMAIL_UPLOAD_DISABLED'
EMAIL_UPLOAD_ENABLED = 'EMAIL_UPLOAD_ENABLED'
ENTERPRISE_APP_AUTHORIZATION_UPDATE = 'ENTERPRISE_APP_AUTHORIZATION_UPDATE'
EXTERNAL_COLLAB_SECURITY_SETTINGS = 'EXTERNAL_COLLAB_SECURITY_SETTINGS'
FAILED_LOGIN = 'FAILED_LOGIN'
FAVORITE = 'FAVORITE'
FILE_MARKED_MALICIOUS = 'FILE_MARKED_MALICIOUS'
FILE_REQUEST_CREATE = 'FILE_REQUEST_CREATE'
FILE_REQUEST_DELETE = 'FILE_REQUEST_DELETE'
FILE_REQUEST_UPDATE = 'FILE_REQUEST_UPDATE'
FILE_VERSION_RESTORE = 'FILE_VERSION_RESTORE'
FILE_WATERMARKED_DOWNLOAD = 'FILE_WATERMARKED_DOWNLOAD'
GROUP_ADD_ITEM = 'GROUP_ADD_ITEM'
GROUP_ADD_USER = 'GROUP_ADD_USER'
Expand All @@ -104,6 +114,7 @@ class GetEventsEventType(str, Enum):
GROUP_EDITED = 'GROUP_EDITED'
GROUP_REMOVE_ITEM = 'GROUP_REMOVE_ITEM'
GROUP_REMOVE_USER = 'GROUP_REMOVE_USER'
ILLEGAL_ITEM_OWNERSHIP_TRANSFER_BY_USER = 'ILLEGAL_ITEM_OWNERSHIP_TRANSFER_BY_USER'
ITEM_EMAIL_SEND = 'ITEM_EMAIL_SEND'
ITEM_MODIFY = 'ITEM_MODIFY'
ITEM_OPEN = 'ITEM_OPEN'
Expand All @@ -117,6 +128,9 @@ class GetEventsEventType(str, Enum):
LEGAL_HOLD_POLICY_UPDATE = 'LEGAL_HOLD_POLICY_UPDATE'
LOCK = 'LOCK'
LOGIN = 'LOGIN'
METADATA_CASCADE_POLICY_APPLY = 'METADATA_CASCADE_POLICY_APPLY'
METADATA_CASCADE_POLICY_CREATE = 'METADATA_CASCADE_POLICY_CREATE'
METADATA_INSTANCE_COPY = 'METADATA_INSTANCE_COPY'
METADATA_INSTANCE_CREATE = 'METADATA_INSTANCE_CREATE'
METADATA_INSTANCE_DELETE = 'METADATA_INSTANCE_DELETE'
METADATA_INSTANCE_UPDATE = 'METADATA_INSTANCE_UPDATE'
Expand All @@ -126,6 +140,7 @@ class GetEventsEventType(str, Enum):
MOVE = 'MOVE'
NEW_USER = 'NEW_USER'
OAUTH2_ACCESS_TOKEN_REVOKE = 'OAUTH2_ACCESS_TOKEN_REVOKE'
OAUTH2_REFRESH_TOKEN_REVOKE = 'OAUTH2_REFRESH_TOKEN_REVOKE'
PREVIEW = 'PREVIEW'
REMOVE_DEVICE_ASSOCIATION = 'REMOVE_DEVICE_ASSOCIATION'
REMOVE_LOGIN_ACTIVITY_DEVICE = 'REMOVE_LOGIN_ACTIVITY_DEVICE'
Expand Down Expand Up @@ -171,6 +186,7 @@ class GetEventsEventType(str, Enum):
TERMS_OF_SERVICE_ACCEPT = 'TERMS_OF_SERVICE_ACCEPT'
TERMS_OF_SERVICE_REJECT = 'TERMS_OF_SERVICE_REJECT'
UNDELETE = 'UNDELETE'
UNFAVORITE = 'UNFAVORITE'
UNLOCK = 'UNLOCK'
UNSHARE = 'UNSHARE'
UPDATE_COLLABORATION_EXPIRATION = 'UPDATE_COLLABORATION_EXPIRATION'
Expand All @@ -181,6 +197,9 @@ class GetEventsEventType(str, Enum):
)
WATERMARK_LABEL_CREATE = 'WATERMARK_LABEL_CREATE'
WATERMARK_LABEL_DELETE = 'WATERMARK_LABEL_DELETE'
WORKFLOW_AUTOMATION_CREATE = 'WORKFLOW_AUTOMATION_CREATE'
WORKFLOW_AUTOMATION_DELETE = 'WORKFLOW_AUTOMATION_DELETE'
WORKFLOW_AUTOMATION_UPDATE = 'WORKFLOW_AUTOMATION_UPDATE'


class GetEventStreamQueryParamsStreamTypeField(str, Enum):
Expand All @@ -197,6 +216,7 @@ class GetEventStreamQueryParamsEventTypeField(str, Enum):
ADD_DEVICE_ASSOCIATION = 'ADD_DEVICE_ASSOCIATION'
ADD_LOGIN_ACTIVITY_DEVICE = 'ADD_LOGIN_ACTIVITY_DEVICE'
ADMIN_LOGIN = 'ADMIN_LOGIN'
ADVANCED_FOLDER_SETTINGS_UPDATE = 'ADVANCED_FOLDER_SETTINGS_UPDATE'
APPLICATION_CREATED = 'APPLICATION_CREATED'
APPLICATION_PUBLIC_KEY_ADDED = 'APPLICATION_PUBLIC_KEY_ADDED'
APPLICATION_PUBLIC_KEY_DELETED = 'APPLICATION_PUBLIC_KEY_DELETED'
Expand All @@ -209,6 +229,7 @@ class GetEventStreamQueryParamsEventTypeField(str, Enum):
COLLABORATION_ROLE_CHANGE = 'COLLABORATION_ROLE_CHANGE'
COMMENT_CREATE = 'COMMENT_CREATE'
COMMENT_DELETE = 'COMMENT_DELETE'
COMMENT_EDIT = 'COMMENT_EDIT'
CONTENT_WORKFLOW_ABNORMAL_DOWNLOAD_ACTIVITY = (
'CONTENT_WORKFLOW_ABNORMAL_DOWNLOAD_ACTIVITY'
)
Expand All @@ -231,11 +252,19 @@ class GetEventStreamQueryParamsEventTypeField(str, Enum):
EDIT = 'EDIT'
EDIT_USER = 'EDIT_USER'
EMAIL_ALIAS_CONFIRM = 'EMAIL_ALIAS_CONFIRM'
EMAIL_ALIAS_PRIMARY = 'EMAIL_ALIAS_PRIMARY'
EMAIL_ALIAS_REMOVE = 'EMAIL_ALIAS_REMOVE'
EMAIL_UPLOAD_DISABLED = 'EMAIL_UPLOAD_DISABLED'
EMAIL_UPLOAD_ENABLED = 'EMAIL_UPLOAD_ENABLED'
ENTERPRISE_APP_AUTHORIZATION_UPDATE = 'ENTERPRISE_APP_AUTHORIZATION_UPDATE'
EXTERNAL_COLLAB_SECURITY_SETTINGS = 'EXTERNAL_COLLAB_SECURITY_SETTINGS'
FAILED_LOGIN = 'FAILED_LOGIN'
FAVORITE = 'FAVORITE'
FILE_MARKED_MALICIOUS = 'FILE_MARKED_MALICIOUS'
FILE_REQUEST_CREATE = 'FILE_REQUEST_CREATE'
FILE_REQUEST_DELETE = 'FILE_REQUEST_DELETE'
FILE_REQUEST_UPDATE = 'FILE_REQUEST_UPDATE'
FILE_VERSION_RESTORE = 'FILE_VERSION_RESTORE'
FILE_WATERMARKED_DOWNLOAD = 'FILE_WATERMARKED_DOWNLOAD'
GROUP_ADD_ITEM = 'GROUP_ADD_ITEM'
GROUP_ADD_USER = 'GROUP_ADD_USER'
Expand All @@ -244,6 +273,7 @@ class GetEventStreamQueryParamsEventTypeField(str, Enum):
GROUP_EDITED = 'GROUP_EDITED'
GROUP_REMOVE_ITEM = 'GROUP_REMOVE_ITEM'
GROUP_REMOVE_USER = 'GROUP_REMOVE_USER'
ILLEGAL_ITEM_OWNERSHIP_TRANSFER_BY_USER = 'ILLEGAL_ITEM_OWNERSHIP_TRANSFER_BY_USER'
ITEM_EMAIL_SEND = 'ITEM_EMAIL_SEND'
ITEM_MODIFY = 'ITEM_MODIFY'
ITEM_OPEN = 'ITEM_OPEN'
Expand All @@ -257,6 +287,9 @@ class GetEventStreamQueryParamsEventTypeField(str, Enum):
LEGAL_HOLD_POLICY_UPDATE = 'LEGAL_HOLD_POLICY_UPDATE'
LOCK = 'LOCK'
LOGIN = 'LOGIN'
METADATA_CASCADE_POLICY_APPLY = 'METADATA_CASCADE_POLICY_APPLY'
METADATA_CASCADE_POLICY_CREATE = 'METADATA_CASCADE_POLICY_CREATE'
METADATA_INSTANCE_COPY = 'METADATA_INSTANCE_COPY'
METADATA_INSTANCE_CREATE = 'METADATA_INSTANCE_CREATE'
METADATA_INSTANCE_DELETE = 'METADATA_INSTANCE_DELETE'
METADATA_INSTANCE_UPDATE = 'METADATA_INSTANCE_UPDATE'
Expand All @@ -266,6 +299,7 @@ class GetEventStreamQueryParamsEventTypeField(str, Enum):
MOVE = 'MOVE'
NEW_USER = 'NEW_USER'
OAUTH2_ACCESS_TOKEN_REVOKE = 'OAUTH2_ACCESS_TOKEN_REVOKE'
OAUTH2_REFRESH_TOKEN_REVOKE = 'OAUTH2_REFRESH_TOKEN_REVOKE'
PREVIEW = 'PREVIEW'
REMOVE_DEVICE_ASSOCIATION = 'REMOVE_DEVICE_ASSOCIATION'
REMOVE_LOGIN_ACTIVITY_DEVICE = 'REMOVE_LOGIN_ACTIVITY_DEVICE'
Expand Down Expand Up @@ -311,6 +345,7 @@ class GetEventStreamQueryParamsEventTypeField(str, Enum):
TERMS_OF_SERVICE_ACCEPT = 'TERMS_OF_SERVICE_ACCEPT'
TERMS_OF_SERVICE_REJECT = 'TERMS_OF_SERVICE_REJECT'
UNDELETE = 'UNDELETE'
UNFAVORITE = 'UNFAVORITE'
UNLOCK = 'UNLOCK'
UNSHARE = 'UNSHARE'
UPDATE_COLLABORATION_EXPIRATION = 'UPDATE_COLLABORATION_EXPIRATION'
Expand All @@ -321,6 +356,9 @@ class GetEventStreamQueryParamsEventTypeField(str, Enum):
)
WATERMARK_LABEL_CREATE = 'WATERMARK_LABEL_CREATE'
WATERMARK_LABEL_DELETE = 'WATERMARK_LABEL_DELETE'
WORKFLOW_AUTOMATION_CREATE = 'WORKFLOW_AUTOMATION_CREATE'
WORKFLOW_AUTOMATION_DELETE = 'WORKFLOW_AUTOMATION_DELETE'
WORKFLOW_AUTOMATION_UPDATE = 'WORKFLOW_AUTOMATION_UPDATE'


class GetEventStreamQueryParams:
Expand Down
12 changes: 3 additions & 9 deletions box_sdk_gen/managers/user_collaborations.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,19 +350,13 @@ def create_collaboration(
this endpoint is dependent on the group's ability to be invited.


If collaboration is in `pending` status, the following fields
If collaboration is in `pending` status, field `name` is redacted when:


are redacted:
- a collaboration was created using `user_id`,


- `login` and `name` are hidden if a collaboration was created


using `user_id`,


- `name` is hidden if a collaboration was created using `login`.
- a collaboration was created using `login`.

:param item: The item to attach the comment to.
:type item: CreateCollaborationItem
Expand Down
16 changes: 14 additions & 2 deletions box_sdk_gen/schemas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

from box_sdk_gen.schemas.ai_dialogue_history import *

from box_sdk_gen.schemas.ai_extract_field_option import *

from box_sdk_gen.schemas.ai_extract_sub_field import *

from box_sdk_gen.schemas.ai_extract_structured_response import *

from box_sdk_gen.schemas.ai_item_base import *
Expand Down Expand Up @@ -78,8 +82,6 @@

from box_sdk_gen.schemas.ai_extract_structured_agent import *

from box_sdk_gen.schemas.ai_extract_structured import *

from box_sdk_gen.schemas.ai_agent_extract import *

from box_sdk_gen.schemas.ai_extract_agent import *
Expand All @@ -94,6 +96,16 @@

from box_sdk_gen.schemas.ai_agent import *

from box_sdk_gen.schemas.ai_options_rules import *

from box_sdk_gen.schemas.ai_taxonomy_file_reference import *

from box_sdk_gen.schemas.ai_taxonomy_reference import *

from box_sdk_gen.schemas.ai_taxonomy_source import *

from box_sdk_gen.schemas.ai_extract_structured import *

from box_sdk_gen.schemas.app_item import *

from box_sdk_gen.schemas.classification import *
Expand Down
4 changes: 2 additions & 2 deletions box_sdk_gen/schemas/ai_ask.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def __init__(
**kwargs
):
"""
:param mode: Box AI handles text documents with text representations up to 1MB in size, or a maximum of 25 files,
whichever comes first. If the text file size exceeds 1MB, the first 1MB of text representation will be processed.
: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
for multi-page images. If the number of image or image pages exceeds 5, the first 5 images or pages will
be processed. If you set mode parameter to `single_item_qa`, the items array can have one element only.
Expand Down
13 changes: 13 additions & 0 deletions box_sdk_gen/schemas/ai_extract_field_option.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from box_sdk_gen.internal.base_object import BaseObject

from box_sdk_gen.box.errors import BoxSDKError


class AiExtractFieldOption(BaseObject):
def __init__(self, key: str, **kwargs):
"""
:param key: A unique identifier for the option.
:type key: str
"""
super().__init__(**kwargs)
self.key = key
Loading
Loading