unique_sdk 0.9.41__py3-none-any.whl → 0.10.0__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.
unique_sdk/__init__.py CHANGED
@@ -87,6 +87,7 @@ from unique_sdk.api_resources._message_assessment import (
87
87
  MessageAssessment as MessageAssessment,
88
88
  )
89
89
  from unique_sdk.api_resources._space import Space as Space
90
+ from unique_sdk.api_resources._mcp import MCP as MCP
90
91
 
91
92
  # Unique QL
92
93
  from unique_sdk._unique_ql import UQLOperator as UQLOperator
@@ -0,0 +1,118 @@
1
+ from typing import (
2
+ Any,
3
+ ClassVar,
4
+ Dict,
5
+ List,
6
+ Literal,
7
+ Optional,
8
+ TypedDict,
9
+ Union,
10
+ Unpack,
11
+ cast,
12
+ )
13
+
14
+ from typing_extensions import NotRequired
15
+
16
+ from unique_sdk._api_resource import APIResource
17
+ from unique_sdk._request_options import RequestOptions
18
+
19
+
20
+ class CallToolTextResourceDto(TypedDict):
21
+ """Text resource containing URI, optional MIME type, and text content."""
22
+ uri: str
23
+ mimeType: Optional[str]
24
+ text: str
25
+
26
+
27
+ class CallToolBlobResourceDto(TypedDict):
28
+ """Blob resource containing URI, optional MIME type, and base64-encoded content."""
29
+ uri: str
30
+ mimeType: Optional[str]
31
+ blob: str
32
+
33
+
34
+ class CallToolContentDto(TypedDict):
35
+ """Content returned by an MCP tool call."""
36
+ type: Literal["text", "image", "audio", "resource_link", "resource"]
37
+
38
+ # Optional fields for different content types
39
+ text: NotRequired[Optional[str]] # For type: "text"
40
+ data: NotRequired[Optional[str]] # Base64 data for type: "image" or "audio"
41
+ mimeType: NotRequired[Optional[str]] # For type: "image", "audio", or "resource_link"
42
+ uri: NotRequired[Optional[str]] # For type: "resource_link"
43
+ name: NotRequired[Optional[str]] # For type: "resource_link"
44
+ description: NotRequired[Optional[str]] # For type: "resource_link"
45
+ resource: NotRequired[Optional[Union[CallToolTextResourceDto, CallToolBlobResourceDto]]] # For type: "resource"
46
+
47
+
48
+ class MCP(APIResource["MCP"]):
49
+ OBJECT_NAME: ClassVar[Literal["mcp.call_tool"]] = "mcp.call_tool"
50
+
51
+ class CallToolParams(RequestOptions):
52
+ """Parameters for calling an MCP tool."""
53
+ name: str
54
+ arguments: Dict[str, Any]
55
+
56
+ # Response fields
57
+ content: List[CallToolContentDto]
58
+ isError: bool
59
+ mcpServerId: str
60
+ name: str
61
+
62
+ @classmethod
63
+ def call_tool(
64
+ cls,
65
+ user_id: str,
66
+ company_id: str,
67
+ **params: Unpack["MCP.CallToolParams"],
68
+ ) -> "MCP":
69
+ """
70
+ Call an MCP tool with the specified name and arguments.
71
+
72
+ Args:
73
+ user_id: The ID of the user making the request
74
+ company_id: The ID of the company
75
+ **params: Tool parameters including name and arguments
76
+
77
+ Returns:
78
+ MCP: The response from the MCP tool call
79
+ """
80
+ return cast(
81
+ "MCP",
82
+ cls._static_request(
83
+ "post",
84
+ "/mcp/call-tool",
85
+ user_id,
86
+ company_id,
87
+ params=params,
88
+ ),
89
+ )
90
+
91
+ @classmethod
92
+ async def call_tool_async(
93
+ cls,
94
+ user_id: str,
95
+ company_id: str,
96
+ **params: Unpack["MCP.CallToolParams"],
97
+ ) -> "MCP":
98
+ """
99
+ Asynchronously call an MCP tool with the specified name and arguments.
100
+
101
+ Args:
102
+ user_id: The ID of the user making the request
103
+ company_id: The ID of the company
104
+ **params: Tool parameters including name and arguments
105
+
106
+ Returns:
107
+ MCP: The response from the MCP tool call
108
+ """
109
+ return cast(
110
+ "MCP",
111
+ await cls._static_request_async(
112
+ "post",
113
+ "/mcp/call-tool",
114
+ user_id,
115
+ company_id,
116
+ params=params,
117
+ ),
118
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_sdk
3
- Version: 0.9.41
3
+ Version: 0.10.0
4
4
  Summary:
5
5
  License: MIT
6
6
  Author: Martin Fadler
@@ -905,7 +905,7 @@ unique_sdk.Folder.add_access(
905
905
 
906
906
  #### `unique_sdk.Folder.remove_access`
907
907
 
908
- Allows you to delete access from a folder and apply to the subfolders or not: `
908
+ Allows you to delete access from a folder and apply to the subfolders or not:
909
909
 
910
910
  - `scopeAccesses`
911
911
  - `applyToSubScopes`
@@ -1227,8 +1227,8 @@ The following script enables you to chat within a space using an assistant. You
1227
1227
  The script sends a prompt asynchronously and continuously polls for completion, which is determined when the `stoppedStreamingAt` field of the message becomes non-null.
1228
1228
 
1229
1229
  **Optional parameters:**
1230
- - `tool_choices`: A list of tool names to be used for the message (e.g., `["WebSearch"]`). If not provided, no tools will be used.
1231
- - `scope_rules`: A dictionary specifying scope rules for the message, allowing you to restrict the context or data sources available to the assistant.
1230
+ - `tool_choices`: A list of tool names to be used for the message (e.g., `["WebSearch"]`). If not provided, no tools will be used. The tools supported right now are `WebSearch` and `InternalSearch`.
1231
+ - `scope_rules`: A filter to specify the scope rules for the message, allowing you to restrict the context or data sources available to the assistant. The filter is written in UniqueQL language. Find out more about the language in the UniqueQL section.
1232
1232
  - `chat_id`: The ID of the chat where the message should be sent. If omitted, a new chat will be created.
1233
1233
  - `poll_interval`: The number of seconds to wait between polling attempts (default: `1` second).
1234
1234
  - `max_wait`: The maximum number of seconds to wait for the message to complete (default: `60` seconds).
@@ -1236,12 +1236,12 @@ The script sends a prompt asynchronously and continuously polls for completion,
1236
1236
  The script ensures you can flexibly interact with spaces in new or ongoing chats, with fine-grained control over tools, context, and polling behavior.
1237
1237
 
1238
1238
  ```python
1239
- latest_message = unique_sdk.utils.send_message_and_wait_for_completion(
1239
+ latest_message = await unique_sdk.utils.chat_in_space.send_message_and_wait_for_completion(
1240
1240
  user_id=user_id,
1241
1241
  company_id=company_id,
1242
1242
  assistant_id=assistant_id,
1243
1243
  text="Tell me a short story.",
1244
- chat_id=chat_id, # Optional - if no chat id is specified, a new chat will be created
1244
+ chat_id=chat_id, # Optional - if no chat id is specified, a new chat will be created
1245
1245
  tool_choices=["WebSearch"],
1246
1246
  scope_rules={
1247
1247
  "or": [
@@ -1253,6 +1253,13 @@ latest_message = unique_sdk.utils.send_message_and_wait_for_completion(
1253
1253
  "value": [
1254
1254
  "cont_u888z7cazxxm4lugfdjq7pks"
1255
1255
  ]
1256
+ },
1257
+ {
1258
+ "operator": "contains",
1259
+ "path": [
1260
+ "folderIdPath"
1261
+ ],
1262
+ "value": "uniquepathid://scope_btfo28b3eeelwh5obwgea71bl/scope_fn56ta67knd6w4medgq3028fx"
1256
1263
  }
1257
1264
  ]
1258
1265
  },
@@ -1276,6 +1283,12 @@ All notable changes to this project will be documented in this file.
1276
1283
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1277
1284
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1278
1285
 
1286
+ ## [0.10.0] - 2025-08-04
1287
+ - Add MCP support
1288
+
1289
+ ## [0.9.42] - 2025-07-31
1290
+ - Fix wrong chat in space example.
1291
+
1279
1292
  ## [0.9.41] - 2025-07-31
1280
1293
  - Fix double-slash error in open ai proxy script.
1281
1294
 
@@ -1,4 +1,4 @@
1
- unique_sdk/__init__.py,sha256=myJ5su7qQEGDqSDi1Mv37bbWvP7JnJ0E30tVwYMlbLM,3297
1
+ unique_sdk/__init__.py,sha256=n_drdw9PkmJpQUt-7DjeUFinRl95gBSks2xsMLEeE9M,3350
2
2
  unique_sdk/_api_requestor.py,sha256=i4gCpzx8zP95sv-AhJfpQxKvWR0U-I6lclHyV55RPtg,14397
3
3
  unique_sdk/_api_resource.py,sha256=ytjomI-IVJwsbvdPyuZCfF-bl-Abgf66bu1D34YxCu8,6244
4
4
  unique_sdk/_api_version.py,sha256=Ku4JPdeyJtnX5eJJvRCEc1_u44UObdVrvrL1T-WwWCs,46
@@ -21,6 +21,7 @@ unique_sdk/api_resources/_embedding.py,sha256=C6qak7cCUBMBINfPhgH8taCJZ9n6w1MUEl
21
21
  unique_sdk/api_resources/_event.py,sha256=bpWF9vstdoAWbUzr-iiGP713ceP0zPk77GJXiImf9zg,374
22
22
  unique_sdk/api_resources/_folder.py,sha256=dmPorUoOJSe-hcxlJq3RnkQeZg3gPqGF37ZsLgnloT0,8335
23
23
  unique_sdk/api_resources/_integrated.py,sha256=l1vS8kJiSLie61mqDO3KI2MNmYwFydmCIoJpP_tPhSI,2956
24
+ unique_sdk/api_resources/_mcp.py,sha256=jBHf89LrjdYKoMeKJHyzKWih870VvXvGIl7hpf8dGIU,3353
24
25
  unique_sdk/api_resources/_message.py,sha256=gEDIzg3METZU2k7m69meAuf0IWmZxnYOjbBKPRMwPYE,7688
25
26
  unique_sdk/api_resources/_message_assessment.py,sha256=SSfx6eW7zb_GKe8cFJzCqW-t-_eWEXxKP5cnIb0DhIc,2276
26
27
  unique_sdk/api_resources/_search.py,sha256=pAVMXL2AdJNP5JG-7LlaU2Uw1152iUaMZ2YO7fHnNWc,1906
@@ -32,7 +33,7 @@ unique_sdk/utils/chat_in_space.py,sha256=kQA43P9XZ6Kdf05JZiLhVJ5ejVtrgzZSb8osyNH
32
33
  unique_sdk/utils/file_io.py,sha256=YY8B7VJcTLOPmCXByiOfNerXGlAtjCC5EVNmAbQJ3dQ,4306
33
34
  unique_sdk/utils/sources.py,sha256=wfboE-neMKa0Wuq9QzfAEFMkNLrIrmm0v-QF33sLo6k,4952
34
35
  unique_sdk/utils/token.py,sha256=AzKuAA1AwBtnvSFxGcsHLpxXr_wWE5Mj4jYBbOz2ljA,1740
35
- unique_sdk-0.9.41.dist-info/LICENSE,sha256=EJCWoHgrXVBUb47PnjeV4MFIEOR71MAdCOIgv61J-4k,1065
36
- unique_sdk-0.9.41.dist-info/METADATA,sha256=8J_euAc4TB8g-_DiNQze6uEYQGUis7UBdZbrMwe0GaI,42281
37
- unique_sdk-0.9.41.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
38
- unique_sdk-0.9.41.dist-info/RECORD,,
36
+ unique_sdk-0.10.0.dist-info/LICENSE,sha256=EJCWoHgrXVBUb47PnjeV4MFIEOR71MAdCOIgv61J-4k,1065
37
+ unique_sdk-0.10.0.dist-info/METADATA,sha256=VcwHI6WA3JGiFekfjs411NWLxE3lj22a7FmReyJv_Xw,42872
38
+ unique_sdk-0.10.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
39
+ unique_sdk-0.10.0.dist-info/RECORD,,