Skip to content

Commit 66b91fc

Browse files
committed
feat: add AI agents warnings; allow for more types of metadata value (box/box-openapi#520)
1 parent 72e4390 commit 66b91fc

15 files changed

+439
-37
lines changed

.codegen.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "c2a365c", "specHash": "f737b7b", "version": "1.14.0" }
1+
{ "engineHash": "c2a365c", "specHash": "6a332e7", "version": "1.14.0" }

box_sdk_gen/managers/file_metadata.py

+3-11
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
from box_sdk_gen.schemas.metadata_full import MetadataFull
2424

25+
from box_sdk_gen.schemas.metadata_instance_value import MetadataInstanceValue
26+
2527
from box_sdk_gen.box.errors import BoxSDKError
2628

2729
from box_sdk_gen.networking.auth import Authentication
@@ -82,7 +84,7 @@ def __init__(
8284
*,
8385
op: Optional[UpdateFileMetadataByIdRequestBodyOpField] = None,
8486
path: Optional[str] = None,
85-
value: Optional[str] = None,
87+
value: Optional[MetadataInstanceValue] = None,
8688
from_: Optional[str] = None,
8789
**kwargs
8890
):
@@ -98,16 +100,6 @@ def __init__(
98100
of the template. The characters `~` and `/` are reserved
99101
characters and must be escaped in the key., defaults to None
100102
:type path: Optional[str], optional
101-
:param value: The value to be set or tested.
102-
103-
Required for `add`, `replace`, and `test` operations. For `add`,
104-
if the value exists already the previous value will be overwritten
105-
by the new value. For `replace`, the value must exist before
106-
replacing.
107-
108-
For `test`, the existing value at the `path` location must match
109-
the specified value., defaults to None
110-
:type value: Optional[str], optional
111103
:param from_: The location in the metadata JSON object to move or copy a value
112104
from. Required for `move` or `copy` operations and must be in the
113105
format of a [JSON-Pointer](https://tools.ietf.org/html/rfc6901)., defaults to None

box_sdk_gen/managers/folder_metadata.py

+3-11
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
from box_sdk_gen.schemas.metadata_full import MetadataFull
2424

25+
from box_sdk_gen.schemas.metadata_instance_value import MetadataInstanceValue
26+
2527
from box_sdk_gen.box.errors import BoxSDKError
2628

2729
from box_sdk_gen.networking.auth import Authentication
@@ -82,7 +84,7 @@ def __init__(
8284
*,
8385
op: Optional[UpdateFolderMetadataByIdRequestBodyOpField] = None,
8486
path: Optional[str] = None,
85-
value: Optional[str] = None,
87+
value: Optional[MetadataInstanceValue] = None,
8688
from_: Optional[str] = None,
8789
**kwargs
8890
):
@@ -98,16 +100,6 @@ def __init__(
98100
of the template. The characters `~` and `/` are reserved
99101
characters and must be escaped in the key., defaults to None
100102
:type path: Optional[str], optional
101-
:param value: The value to be set or tested.
102-
103-
Required for `add`, `replace`, and `test` operations. For `add`,
104-
if the value exists already the previous value will be overwritten
105-
by the new value. For `replace`, the value must exist before
106-
replacing.
107-
108-
For `test`, the existing value at the `path` location must match
109-
the specified value., defaults to None
110-
:type value: Optional[str], optional
111103
:param from_: The location in the metadata JSON object to move or copy a value
112104
from. Required for `move` or `copy` operations and must be in the
113105
format of a [JSON-Pointer](https://tools.ietf.org/html/rfc6901)., defaults to None

box_sdk_gen/managers/transfer.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,13 @@ def transfer_owned_folder(
9898
deleted when the original user is deleted.
9999
100100
101-
This call will be performed synchronously which might lead to a slow response
101+
If the user has a large number of items across all folders, the call will
102102
103103
104-
when the source user has a large number of items in all of its folders.
104+
be run asynchronously. If the operation is not completed within 10 minutes,
105+
106+
107+
the user will receive a 200 OK response, and the operation will continue running.
105108
106109
107110
If the destination path has a metadata cascade policy attached to any of

box_sdk_gen/schemas/__init__.py

+14
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636

3737
from box_sdk_gen.schemas.ai_studio_agent_text_gen import *
3838

39+
from box_sdk_gen.schemas.ai_studio_agent_basic_gen_tool_response import *
40+
41+
from box_sdk_gen.schemas.ai_studio_agent_text_gen_response import *
42+
3943
from box_sdk_gen.schemas.ai_agent_text_gen import *
4044

4145
from box_sdk_gen.schemas.ai_text_gen import *
@@ -44,10 +48,18 @@
4448

4549
from box_sdk_gen.schemas.ai_studio_agent_basic_text_tool import *
4650

51+
from box_sdk_gen.schemas.ai_studio_agent_basic_text_tool_response import *
52+
4753
from box_sdk_gen.schemas.ai_agent_long_text_tool import *
4854

4955
from box_sdk_gen.schemas.ai_studio_agent_long_text_tool import *
5056

57+
from box_sdk_gen.schemas.ai_studio_agent_long_text_tool_response import *
58+
59+
from box_sdk_gen.schemas.ai_studio_agent_extract_response import *
60+
61+
from box_sdk_gen.schemas.ai_studio_agent_ask_response import *
62+
5163
from box_sdk_gen.schemas.ai_studio_agent_extract import *
5264

5365
from box_sdk_gen.schemas.ai_studio_agent_ask import *
@@ -178,6 +190,8 @@
178190

179191
from box_sdk_gen.schemas.metadata_filter import *
180192

193+
from box_sdk_gen.schemas.metadata_instance_value import *
194+
181195
from box_sdk_gen.schemas.metadata_query import *
182196

183197
from box_sdk_gen.schemas.metadata_query_index import *

box_sdk_gen/schemas/ai_single_agent_response_full.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@
1212

1313
from box_sdk_gen.schemas.ai_single_agent_response import AiSingleAgentResponse
1414

15-
from box_sdk_gen.schemas.ai_studio_agent_ask import AiStudioAgentAsk
15+
from box_sdk_gen.schemas.ai_studio_agent_ask_response import AiStudioAgentAskResponse
1616

17-
from box_sdk_gen.schemas.ai_studio_agent_text_gen import AiStudioAgentTextGen
17+
from box_sdk_gen.schemas.ai_studio_agent_text_gen_response import (
18+
AiStudioAgentTextGenResponse,
19+
)
1820

19-
from box_sdk_gen.schemas.ai_studio_agent_extract import AiStudioAgentExtract
21+
from box_sdk_gen.schemas.ai_studio_agent_extract_response import (
22+
AiStudioAgentExtractResponse,
23+
)
2024

2125
from box_sdk_gen.box.errors import BoxSDKError
2226

@@ -29,9 +33,9 @@ def __init__(
2933
name: str,
3034
access_state: str,
3135
*,
32-
ask: Optional[AiStudioAgentAsk] = None,
33-
text_gen: Optional[AiStudioAgentTextGen] = None,
34-
extract: Optional[AiStudioAgentExtract] = None,
36+
ask: Optional[AiStudioAgentAskResponse] = None,
37+
text_gen: Optional[AiStudioAgentTextGenResponse] = None,
38+
extract: Optional[AiStudioAgentExtractResponse] = None,
3539
type: Optional[AiSingleAgentResponseTypeField] = None,
3640
created_by: Optional[UserBase] = None,
3741
created_at: Optional[DateTime] = None,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
from enum import Enum
2+
3+
from typing import Optional
4+
5+
from box_sdk_gen.internal.base_object import BaseObject
6+
7+
from box_sdk_gen.schemas.ai_studio_agent_long_text_tool_response import (
8+
AiStudioAgentLongTextToolResponse,
9+
)
10+
11+
from box_sdk_gen.schemas.ai_studio_agent_basic_text_tool_response import (
12+
AiStudioAgentBasicTextToolResponse,
13+
)
14+
15+
from box_sdk_gen.box.errors import BoxSDKError
16+
17+
18+
class AiStudioAgentAskResponseTypeField(str, Enum):
19+
AI_AGENT_ASK = 'ai_agent_ask'
20+
21+
22+
class AiStudioAgentAskResponse(BaseObject):
23+
_discriminator = 'type', {'ai_agent_ask'}
24+
25+
def __init__(
26+
self,
27+
access_state: str,
28+
description: str,
29+
*,
30+
type: AiStudioAgentAskResponseTypeField = AiStudioAgentAskResponseTypeField.AI_AGENT_ASK,
31+
custom_instructions: Optional[str] = None,
32+
long_text: Optional[AiStudioAgentLongTextToolResponse] = None,
33+
basic_text: Optional[AiStudioAgentBasicTextToolResponse] = None,
34+
long_text_multi: Optional[AiStudioAgentLongTextToolResponse] = None,
35+
basic_text_multi: Optional[AiStudioAgentBasicTextToolResponse] = None,
36+
**kwargs
37+
):
38+
"""
39+
:param access_state: The state of the AI Agent capability. Possible values are: `enabled` and `disabled`.
40+
:type access_state: str
41+
:param description: The description of the AI Agent.
42+
:type description: str
43+
:param type: The type of AI agent used to handle queries., defaults to AiStudioAgentAskResponseTypeField.AI_AGENT_ASK
44+
:type type: AiStudioAgentAskResponseTypeField, optional
45+
:param custom_instructions: Custom instructions for the agent., defaults to None
46+
:type custom_instructions: Optional[str], optional
47+
"""
48+
super().__init__(**kwargs)
49+
self.access_state = access_state
50+
self.description = description
51+
self.type = type
52+
self.custom_instructions = custom_instructions
53+
self.long_text = long_text
54+
self.basic_text = basic_text
55+
self.long_text_multi = long_text_multi
56+
self.basic_text_multi = basic_text_multi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
from typing import Optional
2+
3+
from typing import List
4+
5+
from typing import Union
6+
7+
from box_sdk_gen.schemas.ai_llm_endpoint_params_open_ai import AiLlmEndpointParamsOpenAi
8+
9+
from box_sdk_gen.schemas.ai_llm_endpoint_params_google import AiLlmEndpointParamsGoogle
10+
11+
from box_sdk_gen.schemas.ai_llm_endpoint_params_aws import AiLlmEndpointParamsAws
12+
13+
from box_sdk_gen.schemas.ai_agent_basic_text_tool_base import AiAgentBasicTextToolBase
14+
15+
from box_sdk_gen.schemas.ai_agent_basic_text_tool_text_gen import (
16+
AiAgentBasicTextToolTextGen,
17+
)
18+
19+
from box_sdk_gen.schemas.ai_agent_long_text_tool_text_gen import (
20+
AiAgentLongTextToolTextGenEmbeddingsField,
21+
)
22+
23+
from box_sdk_gen.schemas.ai_agent_long_text_tool_text_gen import (
24+
AiAgentLongTextToolTextGen,
25+
)
26+
27+
from box_sdk_gen.schemas.ai_agent_basic_gen_tool import AiAgentBasicGenTool
28+
29+
from box_sdk_gen.schemas.ai_studio_agent_basic_gen_tool import AiStudioAgentBasicGenTool
30+
31+
from box_sdk_gen.box.errors import BoxSDKError
32+
33+
34+
class AiStudioAgentBasicGenToolResponse(AiStudioAgentBasicGenTool):
35+
def __init__(
36+
self,
37+
*,
38+
warnings: Optional[List[str]] = None,
39+
is_custom_instructions_included: Optional[bool] = None,
40+
content_template: Optional[str] = None,
41+
embeddings: Optional[AiAgentLongTextToolTextGenEmbeddingsField] = None,
42+
system_message: Optional[str] = None,
43+
prompt_template: Optional[str] = None,
44+
model: Optional[str] = None,
45+
num_tokens_for_completion: Optional[int] = None,
46+
llm_endpoint_params: Optional[
47+
Union[
48+
AiLlmEndpointParamsOpenAi,
49+
AiLlmEndpointParamsGoogle,
50+
AiLlmEndpointParamsAws,
51+
]
52+
] = None,
53+
**kwargs
54+
):
55+
"""
56+
:param warnings: Warnings concerning tool, defaults to None
57+
:type warnings: Optional[List[str]], optional
58+
:param is_custom_instructions_included: True if system message contains custom instructions placeholder, false otherwise, defaults to None
59+
:type is_custom_instructions_included: Optional[bool], optional
60+
:param content_template: How the content should be included in a request to the LLM.
61+
Input for `{content}` is optional, depending on the use., defaults to None
62+
:type content_template: Optional[str], optional
63+
:param system_message: System messages aim at helping the LLM understand its role and what it is supposed to do.
64+
The input for `{current_date}` is optional, depending on the use., defaults to None
65+
:type system_message: Optional[str], optional
66+
:param prompt_template: The prompt template contains contextual information of the request and the user prompt.
67+
68+
When using the `prompt_template` parameter, you **must include** input for `{user_question}`.
69+
Inputs for `{current_date}` and `{content}` are optional, depending on the use., defaults to None
70+
:type prompt_template: Optional[str], optional
71+
:param model: The model used for the AI agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models)., defaults to None
72+
:type model: Optional[str], optional
73+
:param num_tokens_for_completion: The number of tokens for completion., defaults to None
74+
:type num_tokens_for_completion: Optional[int], optional
75+
:param llm_endpoint_params: The parameters for the LLM endpoint specific to OpenAI / Google models., defaults to None
76+
:type llm_endpoint_params: Optional[Union[AiLlmEndpointParamsOpenAi, AiLlmEndpointParamsGoogle, AiLlmEndpointParamsAws]], optional
77+
"""
78+
super().__init__(
79+
is_custom_instructions_included=is_custom_instructions_included,
80+
content_template=content_template,
81+
embeddings=embeddings,
82+
system_message=system_message,
83+
prompt_template=prompt_template,
84+
model=model,
85+
num_tokens_for_completion=num_tokens_for_completion,
86+
llm_endpoint_params=llm_endpoint_params,
87+
**kwargs
88+
)
89+
self.warnings = warnings
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
from typing import Optional
2+
3+
from typing import List
4+
5+
from typing import Union
6+
7+
from box_sdk_gen.schemas.ai_llm_endpoint_params_open_ai import AiLlmEndpointParamsOpenAi
8+
9+
from box_sdk_gen.schemas.ai_llm_endpoint_params_google import AiLlmEndpointParamsGoogle
10+
11+
from box_sdk_gen.schemas.ai_llm_endpoint_params_aws import AiLlmEndpointParamsAws
12+
13+
from box_sdk_gen.schemas.ai_agent_basic_text_tool_base import AiAgentBasicTextToolBase
14+
15+
from box_sdk_gen.schemas.ai_agent_basic_text_tool import AiAgentBasicTextTool
16+
17+
from box_sdk_gen.schemas.ai_studio_agent_basic_text_tool import (
18+
AiStudioAgentBasicTextTool,
19+
)
20+
21+
from box_sdk_gen.box.errors import BoxSDKError
22+
23+
24+
class AiStudioAgentBasicTextToolResponse(AiStudioAgentBasicTextTool):
25+
def __init__(
26+
self,
27+
*,
28+
warnings: Optional[List[str]] = None,
29+
is_custom_instructions_included: Optional[bool] = None,
30+
system_message: Optional[str] = None,
31+
prompt_template: Optional[str] = None,
32+
model: Optional[str] = None,
33+
num_tokens_for_completion: Optional[int] = None,
34+
llm_endpoint_params: Optional[
35+
Union[
36+
AiLlmEndpointParamsOpenAi,
37+
AiLlmEndpointParamsGoogle,
38+
AiLlmEndpointParamsAws,
39+
]
40+
] = None,
41+
**kwargs
42+
):
43+
"""
44+
:param warnings: Warnings concerning tool, defaults to None
45+
:type warnings: Optional[List[str]], optional
46+
:param is_custom_instructions_included: True if system message contains custom instructions placeholder, false otherwise, defaults to None
47+
:type is_custom_instructions_included: Optional[bool], optional
48+
:param system_message: System messages try to help the LLM "understand" its role and what it is supposed to do., defaults to None
49+
:type system_message: Optional[str], optional
50+
:param prompt_template: The prompt template contains contextual information of the request and the user prompt.
51+
When passing `prompt_template` parameters, you **must include** inputs for `{user_question}` and `{content}`.
52+
`{current_date}` is optional, depending on the use., defaults to None
53+
:type prompt_template: Optional[str], optional
54+
:param model: The model used for the AI agent for basic text. For specific model values, see the [available models list](g://box-ai/supported-models)., defaults to None
55+
:type model: Optional[str], optional
56+
:param num_tokens_for_completion: The number of tokens for completion., defaults to None
57+
:type num_tokens_for_completion: Optional[int], optional
58+
:param llm_endpoint_params: The parameters for the LLM endpoint specific to OpenAI / Google models., defaults to None
59+
:type llm_endpoint_params: Optional[Union[AiLlmEndpointParamsOpenAi, AiLlmEndpointParamsGoogle, AiLlmEndpointParamsAws]], optional
60+
"""
61+
super().__init__(
62+
is_custom_instructions_included=is_custom_instructions_included,
63+
system_message=system_message,
64+
prompt_template=prompt_template,
65+
model=model,
66+
num_tokens_for_completion=num_tokens_for_completion,
67+
llm_endpoint_params=llm_endpoint_params,
68+
**kwargs
69+
)
70+
self.warnings = warnings

0 commit comments

Comments
 (0)