22
33from typing import List
44
5- from ai21 .clients .common .assistant .assistant import Assistant
5+ from ai21 .clients .common .assistant .assistants import Assistants
66from ai21 .clients .studio .resources .studio_resource import (
77 AsyncStudioResource ,
88 StudioResource ,
99)
10- from ai21 .models .responses .assistant_response import (
11- AssistantResponse ,
12- Tool ,
13- ToolResources ,
14- ListAssistantResponse ,
15- )
10+ from ai21 .models .assistant .assistant import Tool , ToolResources
11+ from ai21 .models .responses .assistant_response import Assistant , ListAssistant
1612from ai21 .types import NotGiven , NOT_GIVEN
1713
1814
19- class StudioAssistant (StudioResource , Assistant ):
15+ class StudioAssistant (StudioResource , Assistants ):
2016 def create (
2117 self ,
2218 name : str ,
@@ -28,7 +24,7 @@ def create(
2824 tools : List [Tool ] | NotGiven = NOT_GIVEN ,
2925 tool_resources : ToolResources | NotGiven = NOT_GIVEN ,
3026 ** kwargs ,
31- ) -> AssistantResponse :
27+ ) -> Assistant :
3228 body = self ._create_body (
3329 name = name ,
3430 description = description ,
@@ -40,13 +36,13 @@ def create(
4036 ** kwargs ,
4137 )
4238
43- return self ._post (path = f"/{ self ._module_name } " , body = body , response_cls = AssistantResponse )
39+ return self ._post (path = f"/{ self ._module_name } " , body = body , response_cls = Assistant )
4440
45- def get (self , assistant_id : str ) -> AssistantResponse :
46- return self ._get (path = f"/{ self ._module_name } /{ assistant_id } " , response_cls = AssistantResponse )
41+ def get (self , assistant_id : str ) -> Assistant :
42+ return self ._get (path = f"/{ self ._module_name } /{ assistant_id } " , response_cls = Assistant )
4743
48- def list (self ) -> ListAssistantResponse :
49- return self ._get (path = f"/{ self ._module_name } " , response_cls = ListAssistantResponse )
44+ def list (self ) -> ListAssistant :
45+ return self ._get (path = f"/{ self ._module_name } " , response_cls = ListAssistant )
5046
5147 def modify (
5248 self ,
@@ -60,7 +56,7 @@ def modify(
6056 models : List [str ] | NotGiven = NOT_GIVEN ,
6157 tools : List [Tool ] | NotGiven = NOT_GIVEN ,
6258 tool_resources : ToolResources | NotGiven = NOT_GIVEN ,
63- ) -> AssistantResponse :
59+ ) -> Assistant :
6460 body = self ._create_body (
6561 name = name ,
6662 description = description ,
@@ -72,10 +68,10 @@ def modify(
7268 tool_resources = tool_resources ,
7369 )
7470
75- return self ._patch (path = f"/{ self ._module_name } /{ assistant_id } " , body = body , response_cls = AssistantResponse )
71+ return self ._patch (path = f"/{ self ._module_name } /{ assistant_id } " , body = body , response_cls = Assistant )
7672
7773
78- class AsyncStudioAssistant (AsyncStudioResource , Assistant ):
74+ class AsyncStudioAssistant (AsyncStudioResource , Assistants ):
7975 async def create (
8076 self ,
8177 name : str ,
@@ -87,7 +83,7 @@ async def create(
8783 tools : List [Tool ] | NotGiven = NOT_GIVEN ,
8884 tool_resources : ToolResources | NotGiven = NOT_GIVEN ,
8985 ** kwargs ,
90- ) -> AssistantResponse :
86+ ) -> Assistant :
9187 body = self ._create_body (
9288 name = name ,
9389 description = description ,
@@ -99,13 +95,13 @@ async def create(
9995 ** kwargs ,
10096 )
10197
102- return self ._post (path = f"/{ self ._module_name } " , body = body , response_cls = AssistantResponse )
98+ return await self ._post (path = f"/{ self ._module_name } " , body = body , response_cls = Assistant )
10399
104- async def get (self , assistant_id : str ) -> AssistantResponse :
105- return await self ._get (path = f"/{ self ._module_name } /{ assistant_id } " , response_cls = AssistantResponse )
100+ async def get (self , assistant_id : str ) -> Assistant :
101+ return await self ._get (path = f"/{ self ._module_name } /{ assistant_id } " , response_cls = Assistant )
106102
107- async def list (self ) -> ListAssistantResponse :
108- return await self ._get (path = f"/{ self ._module_name } " , response_cls = ListAssistantResponse )
103+ async def list (self ) -> ListAssistant :
104+ return await self ._get (path = f"/{ self ._module_name } " , response_cls = ListAssistant )
109105
110106 async def modify (
111107 self ,
@@ -119,7 +115,7 @@ async def modify(
119115 models : List [str ] | NotGiven = NOT_GIVEN ,
120116 tools : List [Tool ] | NotGiven = NOT_GIVEN ,
121117 tool_resources : ToolResources | NotGiven = NOT_GIVEN ,
122- ) -> AssistantResponse :
118+ ) -> Assistant :
123119 body = self ._create_body (
124120 name = name ,
125121 description = description ,
@@ -131,4 +127,4 @@ async def modify(
131127 tool_resources = tool_resources ,
132128 )
133129
134- return await self ._patch (path = f"/{ self ._module_name } /{ assistant_id } " , body = body , response_cls = AssistantResponse )
130+ return await self ._patch (path = f"/{ self ._module_name } /{ assistant_id } " , body = body , response_cls = Assistant )
0 commit comments