unique_sdk 0.10.19__py3-none-any.whl → 0.10.71__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of unique_sdk might be problematic. Click here for more details.

@@ -0,0 +1,429 @@
1
+ from typing import (
2
+ Any,
3
+ ClassVar,
4
+ Dict,
5
+ List,
6
+ Literal,
7
+ NotRequired,
8
+ Optional,
9
+ TypedDict,
10
+ Unpack,
11
+ cast,
12
+ )
13
+
14
+ from unique_sdk._api_resource import APIResource
15
+ from unique_sdk._request_options import RequestOptions
16
+
17
+
18
+ class Group(APIResource["Group"]):
19
+ OBJECT_NAME: ClassVar[Literal["group"]] = "group"
20
+
21
+ class GetParams(RequestOptions):
22
+ """
23
+ Parameters for getting groups in a company.
24
+ """
25
+
26
+ skip: NotRequired[Optional[int]]
27
+ take: NotRequired[Optional[int]]
28
+ name: NotRequired[Optional[str]]
29
+
30
+ class CreateParams(RequestOptions):
31
+ """
32
+ Parameters for creating a group.
33
+ """
34
+
35
+ name: str
36
+ externalId: NotRequired[Optional[str]]
37
+ parentId: NotRequired[Optional[str]]
38
+
39
+ class UpdateParams(RequestOptions):
40
+ """
41
+ Parameters for updating a group.
42
+ """
43
+
44
+ name: NotRequired[Optional[str]]
45
+
46
+ class AddUsersParams(RequestOptions):
47
+ """
48
+ Parameters for adding users to a group.
49
+ """
50
+
51
+ userIds: List[str]
52
+
53
+ class RemoveUsersParams(RequestOptions):
54
+ """
55
+ Parameters for removing users from a group.
56
+ """
57
+
58
+ userIds: List[str]
59
+
60
+ class UpdateGroupConfigurationParams(RequestOptions):
61
+ """
62
+ Parameters for updating group configuration.
63
+ """
64
+
65
+ configuration: Dict[str, Any]
66
+
67
+ class GroupMember(TypedDict):
68
+ """
69
+ Represents a member of a group.
70
+ """
71
+
72
+ entityId: str
73
+
74
+ class GroupMembership(TypedDict):
75
+ """
76
+ Represents a membership relationship between a user and a group.
77
+ """
78
+
79
+ entityId: str
80
+ groupId: str
81
+ createdAt: str
82
+
83
+ class Group(TypedDict):
84
+ """
85
+ Represents a group in the company.
86
+ """
87
+
88
+ id: str
89
+ name: str
90
+ externalId: str
91
+ parentId: Optional[str]
92
+ members: Optional[List["Group.GroupMember"]]
93
+ createdAt: str
94
+ updatedAt: str
95
+
96
+ class GroupWithConfiguration(Group):
97
+ """
98
+ Represents a group in the company with configuration.
99
+ """
100
+
101
+ configuration: Dict[str, Any]
102
+
103
+ class Groups(TypedDict):
104
+ """
105
+ Response for getting groups.
106
+ """
107
+
108
+ groups: List["Group.Group"]
109
+
110
+ class DeleteResponse(TypedDict):
111
+ """
112
+ Response for deleting a group.
113
+ """
114
+
115
+ id: str
116
+
117
+ class AddUsersToGroupResponse(TypedDict):
118
+ """
119
+ Response for adding users to a group.
120
+ """
121
+
122
+ memberships: List["Group.GroupMembership"]
123
+
124
+ class RemoveUsersFromGroupResponse(TypedDict):
125
+ """
126
+ Response for removing users from a group.
127
+ """
128
+
129
+ success: bool
130
+
131
+ @classmethod
132
+ def create_group(
133
+ cls,
134
+ user_id: str,
135
+ company_id: str,
136
+ **params: Unpack["Group.CreateParams"],
137
+ ) -> "Group.Group":
138
+ """
139
+ Create a group in a company.
140
+ """
141
+ return cast(
142
+ "Group.Group",
143
+ cls._static_request(
144
+ "post",
145
+ "/groups",
146
+ user_id,
147
+ company_id,
148
+ params=params,
149
+ ),
150
+ )
151
+
152
+ @classmethod
153
+ async def create_group_async(
154
+ cls,
155
+ user_id: str,
156
+ company_id: str,
157
+ **params: Unpack["Group.CreateParams"],
158
+ ) -> "Group.Group":
159
+ """
160
+ Async create a group in a company.
161
+ """
162
+ return cast(
163
+ "Group.Group",
164
+ await cls._static_request_async(
165
+ "post",
166
+ "/groups",
167
+ user_id,
168
+ company_id,
169
+ params=params,
170
+ ),
171
+ )
172
+
173
+ @classmethod
174
+ def get_groups(
175
+ cls,
176
+ user_id: str,
177
+ company_id: str,
178
+ **params: Unpack["Group.GetParams"],
179
+ ) -> "Group.Groups":
180
+ """
181
+ Get groups in a company.
182
+ """
183
+ return cast(
184
+ "Group.Groups",
185
+ cls._static_request(
186
+ "get",
187
+ "/groups",
188
+ user_id,
189
+ company_id,
190
+ params=params,
191
+ ),
192
+ )
193
+
194
+ @classmethod
195
+ async def get_groups_async(
196
+ cls,
197
+ user_id: str,
198
+ company_id: str,
199
+ **params: Unpack["Group.GetParams"],
200
+ ) -> "Group.Groups":
201
+ """
202
+ Async get groups in a company.
203
+ """
204
+ return cast(
205
+ "Group.Groups",
206
+ await cls._static_request_async(
207
+ "get",
208
+ "/groups",
209
+ user_id,
210
+ company_id,
211
+ params=params,
212
+ ),
213
+ )
214
+
215
+ @classmethod
216
+ def delete_group(
217
+ cls,
218
+ user_id: str,
219
+ company_id: str,
220
+ group_id: str,
221
+ ) -> "Group.DeleteResponse":
222
+ """
223
+ Delete a group in a company.
224
+ """
225
+ return cast(
226
+ "Group.DeleteResponse",
227
+ cls._static_request(
228
+ "delete",
229
+ f"/groups/{group_id}",
230
+ user_id,
231
+ company_id,
232
+ ),
233
+ )
234
+
235
+ @classmethod
236
+ async def delete_group_async(
237
+ cls,
238
+ user_id: str,
239
+ company_id: str,
240
+ group_id: str,
241
+ ) -> "Group.DeleteResponse":
242
+ """
243
+ Async delete a group in a company.
244
+ """
245
+ return cast(
246
+ "Group.DeleteResponse",
247
+ await cls._static_request_async(
248
+ "delete",
249
+ f"/groups/{group_id}",
250
+ user_id,
251
+ company_id,
252
+ ),
253
+ )
254
+
255
+ @classmethod
256
+ def update_group(
257
+ cls,
258
+ user_id: str,
259
+ company_id: str,
260
+ group_id: str,
261
+ **params: Unpack["Group.UpdateParams"],
262
+ ) -> "Group.Group":
263
+ """
264
+ Update a group in a company.
265
+ """
266
+ return cast(
267
+ "Group.Group",
268
+ cls._static_request(
269
+ "patch",
270
+ f"/groups/{group_id}",
271
+ user_id,
272
+ company_id,
273
+ params=params,
274
+ ),
275
+ )
276
+
277
+ @classmethod
278
+ async def update_group_async(
279
+ cls,
280
+ user_id: str,
281
+ company_id: str,
282
+ group_id: str,
283
+ **params: Unpack["Group.UpdateParams"],
284
+ ) -> "Group.Group":
285
+ """
286
+ Async update a group in a company.
287
+ """
288
+ return cast(
289
+ "Group.Group",
290
+ await cls._static_request_async(
291
+ "patch",
292
+ f"/groups/{group_id}",
293
+ user_id,
294
+ company_id,
295
+ params=params,
296
+ ),
297
+ )
298
+
299
+ @classmethod
300
+ def add_users_to_group(
301
+ cls,
302
+ user_id: str,
303
+ company_id: str,
304
+ group_id: str,
305
+ **params: Unpack["Group.AddUsersParams"],
306
+ ) -> "Group.AddUsersToGroupResponse":
307
+ """
308
+ Add users to a group in a company.
309
+ """
310
+ return cast(
311
+ "Group.AddUsersToGroupResponse",
312
+ cls._static_request(
313
+ "post",
314
+ f"/groups/{group_id}/users",
315
+ user_id,
316
+ company_id,
317
+ params=params,
318
+ ),
319
+ )
320
+
321
+ @classmethod
322
+ async def add_users_to_group_async(
323
+ cls,
324
+ user_id: str,
325
+ company_id: str,
326
+ group_id: str,
327
+ **params: Unpack["Group.AddUsersParams"],
328
+ ) -> "Group.AddUsersToGroupResponse":
329
+ """
330
+ Async add users to a group in a company.
331
+ """
332
+ return cast(
333
+ "Group.AddUsersToGroupResponse",
334
+ await cls._static_request_async(
335
+ "post",
336
+ f"/groups/{group_id}/users",
337
+ user_id,
338
+ company_id,
339
+ params=params,
340
+ ),
341
+ )
342
+
343
+ @classmethod
344
+ def remove_users_from_group(
345
+ cls,
346
+ user_id: str,
347
+ company_id: str,
348
+ group_id: str,
349
+ **params: Unpack["Group.RemoveUsersParams"],
350
+ ) -> "Group.RemoveUsersFromGroupResponse":
351
+ """
352
+ Remove users from a group in a company.
353
+ """
354
+ return cast(
355
+ "Group.RemoveUsersFromGroupResponse",
356
+ cls._static_request(
357
+ "delete",
358
+ f"/groups/{group_id}/users",
359
+ user_id,
360
+ company_id,
361
+ params=params,
362
+ ),
363
+ )
364
+
365
+ @classmethod
366
+ async def remove_users_from_group_async(
367
+ cls,
368
+ user_id: str,
369
+ company_id: str,
370
+ group_id: str,
371
+ **params: Unpack["Group.RemoveUsersParams"],
372
+ ) -> "Group.RemoveUsersFromGroupResponse":
373
+ """
374
+ Async remove users from a group in a company.
375
+ """
376
+ return cast(
377
+ "Group.RemoveUsersFromGroupResponse",
378
+ await cls._static_request_async(
379
+ "delete",
380
+ f"/groups/{group_id}/users",
381
+ user_id,
382
+ company_id,
383
+ params=params,
384
+ ),
385
+ )
386
+
387
+ @classmethod
388
+ def update_group_configuration(
389
+ cls,
390
+ user_id: str,
391
+ company_id: str,
392
+ group_id: str,
393
+ **params: Unpack["Group.UpdateGroupConfigurationParams"],
394
+ ) -> "Group.GroupWithConfiguration":
395
+ """
396
+ Update group configuration for the specified group.
397
+ """
398
+ return cast(
399
+ "Group.GroupWithConfiguration",
400
+ cls._static_request(
401
+ "patch",
402
+ f"/groups/{group_id}/configuration",
403
+ user_id,
404
+ company_id,
405
+ params=params,
406
+ ),
407
+ )
408
+
409
+ @classmethod
410
+ async def update_group_configuration_async(
411
+ cls,
412
+ user_id: str,
413
+ company_id: str,
414
+ group_id: str,
415
+ **params: Unpack["Group.UpdateGroupConfigurationParams"],
416
+ ) -> "Group.GroupWithConfiguration":
417
+ """
418
+ Async update group configuration for the specified group.
419
+ """
420
+ return cast(
421
+ "Group.GroupWithConfiguration",
422
+ await cls._static_request_async(
423
+ "patch",
424
+ f"/groups/{group_id}/configuration",
425
+ user_id,
426
+ company_id,
427
+ params=params,
428
+ ),
429
+ )
@@ -1,15 +1,29 @@
1
1
  from typing import (
2
+ TYPE_CHECKING,
2
3
  Any,
3
4
  ClassVar,
4
- Dict,
5
5
  List,
6
6
  Literal,
7
+ NotRequired,
7
8
  Optional,
8
- TypedDict,
9
+ Union,
10
+ Unpack,
9
11
  cast,
10
12
  )
11
13
 
12
- from typing_extensions import NotRequired, Unpack
14
+ from typing_extensions import TypedDict
15
+
16
+ # Avoid introducing a dependency on the openai sdk as it's only used for type hints
17
+ if TYPE_CHECKING:
18
+ from openai.types.responses import (
19
+ ResponseIncludable,
20
+ ResponseInputParam,
21
+ ResponseOutputItem,
22
+ ResponseTextConfigParam,
23
+ ToolParam,
24
+ response_create_params,
25
+ )
26
+ from openai.types.shared_params import Metadata, Reasoning
13
27
 
14
28
  from unique_sdk._api_resource import APIResource
15
29
  from unique_sdk._request_options import RequestOptions
@@ -28,6 +42,7 @@ class Integrated(APIResource["Integrated"]):
28
42
  chunkId: str
29
43
  key: str
30
44
  title: NotRequired["str"]
45
+ description: NotRequired["str"]
31
46
  url: NotRequired["str"]
32
47
 
33
48
  class ChatCompletionRequestMessage(TypedDict, total=False):
@@ -35,63 +50,49 @@ class Integrated(APIResource["Integrated"]):
35
50
  content: str
36
51
  name: Optional[str]
37
52
 
38
- class CreateStream(RequestOptions):
39
- model: NotRequired[
40
- Literal[
41
- "AZURE_GPT_4_0613",
42
- "AZURE_GPT_4_32K_0613",
43
- ]
44
- ]
45
- timeout: NotRequired["int"]
46
- messages: List["Integrated.ChatCompletionRequestMessage"]
53
+ class CommonIntegratedParams(RequestOptions):
54
+ model: NotRequired[str]
47
55
  searchContext: NotRequired[List["Integrated.SearchResult"]]
48
56
  chatId: str
49
57
  assistantId: str
50
58
  assistantMessageId: str
51
59
  userMessageId: str
52
60
  startText: NotRequired["str"]
53
- debugInfo: NotRequired[Dict[str, Any]]
61
+ debugInfo: NotRequired[dict[str, Any]]
62
+
63
+ class CreateStream(CommonIntegratedParams):
64
+ timeout: NotRequired["int"]
65
+ messages: List["Integrated.ChatCompletionRequestMessage"]
54
66
 
55
67
  # For further details about the responses parameters, see the OpenAI API documentation.
56
- class CreateStreamResponseParams(TypedDict):
57
- debugInfo: Optional[Dict[str, Any]] = None
58
- input: Any
59
- model: str
60
- searchContext: Optional[List["Integrated.SearchResult"]] = None
61
- chatId: str
62
- assistantMessageId: str
63
- userMessageId: str
64
- startText: str | None = None
65
- include: Optional[
66
- list[
67
- Literal[
68
- "computer_call_output.output.image_url",
69
- "file_search_call.results",
70
- "message.input_image.image_url",
71
- "reasoning.encrypted_content",
72
- ]
73
- ]
74
- ] = None
75
- instructions: str | None = None
76
- max_output_tokens: int | None = None
77
- metadata: Optional[Dict[str, str]] = None
78
- parallel_tool_calls: float | None = None
79
- temperature: float | None = None
80
- text: Any
81
- tool_choice: Any
82
- tools: Any
83
- top_p: float | None = None
84
- reasoning: Any
68
+ # Note that other parameters from openai.resources.responses.Response.create can be passed
69
+ class CreateStreamResponsesOpenaiParams(TypedDict):
70
+ include: NotRequired[list["ResponseIncludable"] | None]
71
+ instructions: NotRequired[str | None]
72
+ max_output_tokens: NotRequired[int | None]
73
+ metadata: NotRequired[Union["Metadata", None]]
74
+ parallel_tool_calls: NotRequired[bool | None]
75
+ temperature: NotRequired[float | None]
76
+ text: NotRequired["ResponseTextConfigParam"]
77
+ tool_choice: NotRequired["response_create_params.ToolChoice"]
78
+ tools: NotRequired[list["ToolParam"]]
79
+ top_p: NotRequired[float | None]
80
+ reasoning: NotRequired["Reasoning"]
81
+
82
+ class CreateStreamResponsesParams(CommonIntegratedParams):
83
+ input: Union[str, "ResponseInputParam"]
84
+ options: NotRequired["Integrated.CreateStreamResponsesOpenaiParams"]
85
85
 
86
86
  class ToolCall(TypedDict):
87
87
  id: str
88
- name: str | None = None
89
- arguments: str | None = None
88
+ name: str | None
89
+ arguments: str | None
90
90
 
91
91
  class ResponsesStreamResult(TypedDict):
92
92
  id: str
93
93
  message: Message
94
94
  toolCalls: List["Integrated.ToolCall"]
95
+ output: list["ResponseOutputItem"]
95
96
 
96
97
  @classmethod
97
98
  def chat_stream_completion(
@@ -146,7 +147,7 @@ class Integrated(APIResource["Integrated"]):
146
147
  cls,
147
148
  user_id: str,
148
149
  company_id: str,
149
- **params: Unpack["Integrated.CreateStreamResponseParams"],
150
+ **params: Unpack["Integrated.CreateStreamResponsesParams"],
150
151
  ) -> "Integrated.ResponsesStreamResult":
151
152
  """
152
153
  Executes a call to the language model and streams to the chat in real-time.
@@ -154,7 +155,7 @@ class Integrated(APIResource["Integrated"]):
154
155
  In the form of [sourceX]. The reference documents must be given as a list in searchContext.
155
156
  """
156
157
  return cast(
157
- "Integrated.Responses",
158
+ "Integrated.ResponsesStreamResult",
158
159
  cls._static_request(
159
160
  "post",
160
161
  "/integrated/chat/stream-responses",
@@ -169,7 +170,7 @@ class Integrated(APIResource["Integrated"]):
169
170
  cls,
170
171
  user_id: str,
171
172
  company_id: str,
172
- **params: Unpack["Integrated.CreateStreamResponseParams"],
173
+ **params: Unpack["Integrated.CreateStreamResponsesParams"],
173
174
  ) -> "Integrated.ResponsesStreamResult":
174
175
  """
175
176
  Executes a call to the language model and streams to the chat in real-time.
@@ -177,7 +178,7 @@ class Integrated(APIResource["Integrated"]):
177
178
  In the form of [sourceX]. The reference documents must be given as a list in searchContext.
178
179
  """
179
180
  return cast(
180
- "Integrated.Responses",
181
+ "Integrated.ResponsesStreamResult",
181
182
  cls._static_request(
182
183
  "post",
183
184
  "/integrated/chat/stream-responses",
@@ -0,0 +1,64 @@
1
+ from typing import ClassVar, List, Literal, NotRequired, TypedDict, Unpack, cast
2
+
3
+ from unique_sdk._api_resource import APIResource
4
+ from unique_sdk._request_options import RequestOptions
5
+
6
+
7
+ class LLMModels(APIResource["LLMModels"]):
8
+ OBJECT_NAME: ClassVar[Literal["llm-models"]] = "llm-models"
9
+
10
+ class GetParams(RequestOptions):
11
+ """
12
+ Parameters for getting available LLM models.
13
+ """
14
+
15
+ module: NotRequired[str | None]
16
+
17
+ class LLMModelsResponse(TypedDict):
18
+ """
19
+ Response for getting available LLM models.
20
+ """
21
+
22
+ models: List[str]
23
+
24
+ @classmethod
25
+ def get_models(
26
+ cls,
27
+ user_id: str,
28
+ company_id: str,
29
+ **params: Unpack["LLMModels.GetParams"],
30
+ ) -> "LLMModels.LLMModelsResponse":
31
+ """
32
+ Get available LLM models.
33
+ """
34
+ return cast(
35
+ "LLMModels.LLMModelsResponse",
36
+ cls._static_request(
37
+ "get",
38
+ "/openai/models",
39
+ user_id,
40
+ company_id,
41
+ params=params,
42
+ ),
43
+ )
44
+
45
+ @classmethod
46
+ async def get_models_async(
47
+ cls,
48
+ user_id: str,
49
+ company_id: str,
50
+ **params: Unpack["LLMModels.GetParams"],
51
+ ) -> "LLMModels.LLMModelsResponse":
52
+ """
53
+ Async get available LLM models.
54
+ """
55
+ return cast(
56
+ "LLMModels.LLMModelsResponse",
57
+ await cls._static_request_async(
58
+ "get",
59
+ "/openai/models",
60
+ user_id,
61
+ company_id,
62
+ params=params,
63
+ ),
64
+ )
@@ -59,6 +59,8 @@ class MCP(APIResource["MCP"]):
59
59
  """Parameters for calling an MCP tool."""
60
60
 
61
61
  name: str
62
+ messageId: str
63
+ chatId: str
62
64
  arguments: Dict[str, Any]
63
65
 
64
66
  # Response fields