Skip to content

Commit f97fd14

Browse files
committed
fix: add variants for box ai (box/box-openapi#446)
1 parent 508e27e commit f97fd14

File tree

7 files changed

+24
-22
lines changed

7 files changed

+24
-22
lines changed

.codegen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "4ca165c", "specHash": "871a814", "version": "1.2.0" }
1+
{ "engineHash": "4ca165c", "specHash": "8d1ca31", "version": "1.2.0" }

box_sdk_gen/managers/ai.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
from box_sdk_gen.schemas.ai_dialogue_history import AiDialogueHistory
2020

21-
from box_sdk_gen.schemas.ai_ask_response import AiAskResponse
21+
from box_sdk_gen.schemas.ai_response_full import AiResponseFull
2222

2323
from box_sdk_gen.schemas.client_error import ClientError
2424

@@ -143,7 +143,7 @@ def create_ai_ask(
143143
include_citations: Optional[bool] = None,
144144
ai_agent: Optional[AiAgentAsk] = None,
145145
extra_headers: Optional[Dict[str, Optional[str]]] = None
146-
) -> AiAskResponse:
146+
) -> AiResponseFull:
147147
"""
148148
Sends an AI request to supported LLMs and returns an answer specifically focused on the user's question given the provided context.
149149
:param mode: The mode specifies if this request is for a single or multiple items. If you select `single_item_qa` the `items` array can have one element only. Selecting `multiple_item_qa` allows you to provide up to 25 items.
@@ -186,7 +186,7 @@ def create_ai_ask(
186186
network_session=self.network_session,
187187
),
188188
)
189-
return deserialize(response.data, AiAskResponse)
189+
return deserialize(response.data, AiResponseFull)
190190

191191
def create_ai_text_gen(
192192
self,

box_sdk_gen/schemas/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@
346346

347347
from box_sdk_gen.schemas.ai_citation import *
348348

349-
from box_sdk_gen.schemas.ai_ask_response import *
349+
from box_sdk_gen.schemas.ai_response_full import *
350350

351351
from box_sdk_gen.schemas.ai_dialogue_history import *
352352

box_sdk_gen/schemas/ai_ask_response.py renamed to box_sdk_gen/schemas/ai_response_full.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,37 @@
22

33
from typing import List
44

5-
from box_sdk_gen.internal.base_object import BaseObject
5+
from box_sdk_gen.internal.utils import DateTime
66

7-
from box_sdk_gen.schemas.ai_citation import AiCitation
7+
from box_sdk_gen.schemas.ai_response import AiResponse
88

9-
from box_sdk_gen.internal.utils import DateTime
9+
from box_sdk_gen.schemas.ai_citation import AiCitation
1010

1111

12-
class AiAskResponse(BaseObject):
12+
class AiResponseFull(AiResponse):
1313
def __init__(
1414
self,
1515
answer: str,
1616
created_at: DateTime,
1717
*,
18-
completion_reason: Optional[str] = None,
1918
citations: Optional[List[AiCitation]] = None,
19+
completion_reason: Optional[str] = None,
2020
**kwargs
2121
):
2222
"""
2323
:param answer: The answer provided by the LLM.
2424
:type answer: str
2525
:param created_at: The ISO date formatted timestamp of when the answer to the prompt was created.
2626
:type created_at: DateTime
27-
:param completion_reason: The reason the response finishes., defaults to None
28-
:type completion_reason: Optional[str], optional
2927
:param citations: The citations of the LLM's answer reference., defaults to None
3028
:type citations: Optional[List[AiCitation]], optional
29+
:param completion_reason: The reason the response finishes., defaults to None
30+
:type completion_reason: Optional[str], optional
3131
"""
32-
super().__init__(**kwargs)
33-
self.answer = answer
34-
self.created_at = created_at
35-
self.completion_reason = completion_reason
32+
super().__init__(
33+
answer=answer,
34+
created_at=created_at,
35+
completion_reason=completion_reason,
36+
**kwargs
37+
)
3638
self.citations = citations

docs/ai.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ client.ai.create_ai_ask(
5353

5454
### Returns
5555

56-
This function returns a value of type `AiAskResponse`.
56+
This function returns a value of type `AiResponseFull`.
5757

5858
A successful response including the answer from the LLM.
5959

docs/integration_mappings.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# IntegrationMappingsManager
22

33
- [List Slack integration mappings](#list-slack-integration-mappings)
4-
- [Create Slack integration mapping](#create-slack-integration-mapping)
4+
- [Create integration mapping](#create-integration-mapping)
55
- [Update Slack integration mapping](#update-slack-integration-mapping)
66
- [Delete Slack integration mapping](#delete-slack-integration-mapping)
77

@@ -48,7 +48,7 @@ This function returns a value of type `IntegrationMappings`.
4848

4949
Returns a collection of integration mappings
5050

51-
## Create Slack integration mapping
51+
## Create integration mapping
5252

5353
Creates a [Slack integration mapping](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack)
5454
by mapping a Slack channel to a Box item.

test/ai.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from box_sdk_gen.schemas.file_full import FileFull
88

9-
from box_sdk_gen.schemas.ai_ask_response import AiAskResponse
9+
from box_sdk_gen.schemas.ai_response_full import AiResponseFull
1010

1111
from box_sdk_gen.managers.ai import CreateAiAskMode
1212

@@ -46,7 +46,7 @@ def testAskAISingleItem():
4646
GetAiAgentDefaultConfigMode.ASK.value, language='en-US'
4747
)
4848
file_to_ask: FileFull = upload_new_file()
49-
response: AiAskResponse = client.ai.create_ai_ask(
49+
response: AiResponseFull = client.ai.create_ai_ask(
5050
CreateAiAskMode.SINGLE_ITEM_QA.value,
5151
'which direction sun rises',
5252
[
@@ -66,7 +66,7 @@ def testAskAISingleItem():
6666
def testAskAIMultipleItems():
6767
file_to_ask_1: FileFull = upload_new_file()
6868
file_to_ask_2: FileFull = upload_new_file()
69-
response: AiAskResponse = client.ai.create_ai_ask(
69+
response: AiResponseFull = client.ai.create_ai_ask(
7070
CreateAiAskMode.MULTIPLE_ITEM_QA.value,
7171
'Which direction sun rises?',
7272
[

0 commit comments

Comments
 (0)