unique_toolkit 1.3.1__py3-none-any.whl → 1.3.3__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.
@@ -402,8 +402,8 @@ class TestMCPManager:
402
402
  # Should only have the exclusive tool, MCP tools should be ignored
403
403
  tools = tool_manager.get_tools()
404
404
  tool_names = [tool.name for tool in tools]
405
- assert "internal_search" not in tool_names
406
- assert "mcp_test_tool" in tool_names
405
+ assert "internal_search" in tool_names
406
+ assert "mcp_test_tool" not in tool_names
407
407
  assert len(tools) == 1
408
408
 
409
409
  def test_init_tools_with_disabled_tool_config(
@@ -125,11 +125,7 @@ class ToolManager:
125
125
  if len(self._tool_choices) > 0 and t.name not in self._tool_choices:
126
126
  continue
127
127
  # is the tool exclusive and has been choosen by the user?
128
- if (
129
- t.is_exclusive()
130
- and len(tool_choices) > 0
131
- and t.name not in tool_choices
132
- ):
128
+ if t.is_exclusive() and len(tool_choices) > 0 and t.name in tool_choices:
133
129
  self._tools = [t] # override all other tools
134
130
  break
135
131
  # if the tool is exclusive but no tool choices are given, skip it
@@ -46,7 +46,8 @@ def get_event_generator(
46
46
  event_type: type[T],
47
47
  ) -> Generator[T, None, None]:
48
48
  """
49
- Generator that yields only events of the specified type from an SSE stream.
49
+ Generator that updates the unique settings according to the events and
50
+ yields only events of the specified type from an SSE stream.
50
51
 
51
52
  Args:
52
53
  sse_client: The SSE client to read events from
@@ -74,6 +75,8 @@ def get_event_generator(
74
75
  ):
75
76
  continue
76
77
 
78
+ unique_settings.update_from_event(event=parsed_event)
79
+
77
80
  yield parsed_event
78
81
 
79
82
  except Exception as e:
@@ -1,7 +1,7 @@
1
1
  import os
2
2
  from logging import getLogger
3
3
  from pathlib import Path
4
- from typing import Self, TypeVar
4
+ from typing import TYPE_CHECKING, Self, TypeVar
5
5
  from urllib.parse import ParseResult, urlparse, urlunparse
6
6
 
7
7
  import unique_sdk
@@ -9,6 +9,10 @@ from platformdirs import user_config_dir
9
9
  from pydantic import AliasChoices, Field, SecretStr, model_validator
10
10
  from pydantic_settings import BaseSettings, SettingsConfigDict
11
11
 
12
+ if TYPE_CHECKING:
13
+ from unique_toolkit.app.schemas import BaseEvent
14
+
15
+
12
16
  logger = getLogger(__name__)
13
17
 
14
18
  T = TypeVar("T", bound=BaseSettings)
@@ -159,6 +163,13 @@ class UniqueAuth(BaseSettings):
159
163
  def _warn_about_defaults(self) -> Self:
160
164
  return warn_about_defaults(self)
161
165
 
166
+ @classmethod
167
+ def from_event(cls, event: "BaseEvent") -> Self:
168
+ return cls(
169
+ company_id=SecretStr(event.company_id),
170
+ user_id=SecretStr(event.user_id),
171
+ )
172
+
162
173
 
163
174
  class UniqueChatEventFilterOptions(BaseSettings):
164
175
  # Empty string evals to False
@@ -197,10 +208,10 @@ class UniqueSettings:
197
208
  chat_event_filter_options: UniqueChatEventFilterOptions | None = None,
198
209
  env_file: Path | None = None,
199
210
  ):
200
- self.app = app
201
- self.auth = auth
202
- self.api = api
203
- self.chat_event_filter_options = chat_event_filter_options
211
+ self._app = app
212
+ self._auth = auth
213
+ self._api = api
214
+ self._chat_event_filter_options = chat_event_filter_options
204
215
  self._env_file: Path | None = (
205
216
  env_file if (env_file and env_file.exists()) else None
206
217
  )
@@ -310,9 +321,9 @@ class UniqueSettings:
310
321
  This method configures the global unique_sdk module with the API key,
311
322
  app ID, and base URL from these settings.
312
323
  """
313
- unique_sdk.api_key = self.app.key.get_secret_value()
314
- unique_sdk.app_id = self.app.id.get_secret_value()
315
- unique_sdk.api_base = self.api.sdk_url()
324
+ unique_sdk.api_key = self._app.key.get_secret_value()
325
+ unique_sdk.app_id = self._app.id.get_secret_value()
326
+ unique_sdk.api_base = self._api.sdk_url()
316
327
 
317
328
  @classmethod
318
329
  def from_env_auto_with_sdk_init(
@@ -331,3 +342,26 @@ class UniqueSettings:
331
342
  settings = cls.from_env_auto(filename)
332
343
  settings.init_sdk()
333
344
  return settings
345
+
346
+ def update_from_event(self, event: "BaseEvent") -> None:
347
+ self._auth = UniqueAuth.from_event(event)
348
+
349
+ @property
350
+ def api(self) -> UniqueApi:
351
+ return self._api
352
+
353
+ @property
354
+ def app(self) -> UniqueApp:
355
+ return self._app
356
+
357
+ @property
358
+ def auth(self) -> UniqueAuth:
359
+ return self._auth
360
+
361
+ @auth.setter
362
+ def auth(self, value: UniqueAuth) -> None:
363
+ self._auth = value
364
+
365
+ @property
366
+ def chat_event_filter_options(self) -> UniqueChatEventFilterOptions | None:
367
+ return self._chat_event_filter_options
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_toolkit
3
- Version: 1.3.1
3
+ Version: 1.3.3
4
4
  Summary:
5
5
  License: Proprietary
6
6
  Author: Cedric Klinkert
@@ -118,6 +118,11 @@ All notable changes to this project will be documented in this file.
118
118
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
119
119
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
120
120
 
121
+ ## [1.3.3] - 2025-09-30
122
+ - fix bug in exclusive tools not making them selectable
123
+
124
+ ## [1.3.2] - 2025-09-29
125
+ - Auto-update unique settings on event arrival in SSE client
121
126
 
122
127
  ## [1.3.1] - 2025-09-29
123
128
  - More documentation on referencing
@@ -68,10 +68,10 @@ unique_toolkit/agentic/tools/mcp/manager.py,sha256=DPYwwDe6RSZyuPaxn-je49fP_qOOs
68
68
  unique_toolkit/agentic/tools/mcp/models.py,sha256=OyCCb7Vwv1ftzC_OCpFkf3TX9Aeb74ZZagG-qK5peIU,722
69
69
  unique_toolkit/agentic/tools/mcp/tool_wrapper.py,sha256=5UdtqFtZ0aqjae2eL3zVacDMfr1hu5KiQkaoI7VkhqA,9972
70
70
  unique_toolkit/agentic/tools/schemas.py,sha256=0ZR8xCdGj1sEdPE0lfTIG2uSR5zqWoprUa3Seqez4C8,4837
71
- unique_toolkit/agentic/tools/test/test_mcp_manager.py,sha256=9F7FjpYKeOkg2Z4bt2H1WGaxu9fzB-1iiE-b7g3KzQk,15724
71
+ unique_toolkit/agentic/tools/test/test_mcp_manager.py,sha256=PVRvkK3M21rzONpy5VE_i3vEbAGIz1haW_VPVwiPDI0,15724
72
72
  unique_toolkit/agentic/tools/test/test_tool_progress_reporter.py,sha256=dod5QPqgGUInVAGXAbsAKNTEypIi6pUEWhDbJr9YfUU,6307
73
73
  unique_toolkit/agentic/tools/tool.py,sha256=m56VLxiHuKU2_J5foZp00xhm5lTxWEW7zRLGbIE9ssU,6744
74
- unique_toolkit/agentic/tools/tool_manager.py,sha256=l8OGQiSeMWqesnFQ4vmgnrSU4e6ipAbB2pq0HmQM4AE,11140
74
+ unique_toolkit/agentic/tools/tool_manager.py,sha256=Ct8AMtJNwVIY8CGz62R4_Dahc-6Op7tkLURkZMxKuqk,11072
75
75
  unique_toolkit/agentic/tools/tool_progress_reporter.py,sha256=ixud9VoHey1vlU1t86cW0-WTvyTwMxNSWBon8I11SUk,7955
76
76
  unique_toolkit/agentic/tools/utils/__init__.py,sha256=iD1YYzf9LcJFv95Z8BqCAFSewNBabybZRZyvPKGfvro,27
77
77
  unique_toolkit/agentic/tools/utils/execution/__init__.py,sha256=OHiKpqBnfhBiEQagKVWJsZlHv8smPp5OI4dFIexzibw,37
@@ -81,13 +81,13 @@ unique_toolkit/agentic/tools/utils/source_handling/schema.py,sha256=l4B6kA6grbL-
81
81
  unique_toolkit/agentic/tools/utils/source_handling/source_formatting.py,sha256=uZ0QXqrPWgId3ZA67dvjHQ6xrW491LK1xxx_sVJmFHg,9160
82
82
  unique_toolkit/agentic/tools/utils/source_handling/tests/test_source_formatting.py,sha256=EA8iVvb3L91OFk2XMbGcFuhe2etqm3Sx9QCYDGiOSOM,6995
83
83
  unique_toolkit/app/__init__.py,sha256=ETxYDpEizg_PKmi4JPX_P76ySq-us-xypfAIdKQ1QZU,1284
84
- unique_toolkit/app/dev_util.py,sha256=BmrVpZ86_X3NCd9irNPvT5VFL9-7tF7muZeaCL53j4M,5185
84
+ unique_toolkit/app/dev_util.py,sha256=5tkGEcjHZ1u4kY0yUOhTWLjhXLvAcEMutY3h8j1bBJE,5312
85
85
  unique_toolkit/app/init_logging.py,sha256=Sh26SRxOj8i8dzobKhYha2lLrkrMTHfB1V4jR3h23gQ,678
86
86
  unique_toolkit/app/init_sdk.py,sha256=5_oDoETr6akwYyBCb0ivTdMNu3SVgPSkrXcDS6ELyY8,2269
87
87
  unique_toolkit/app/performance/async_tasks.py,sha256=H0l3OAcosLwNHZ8d2pd-Di4wHIXfclEvagi5kfqLFPA,1941
88
88
  unique_toolkit/app/performance/async_wrapper.py,sha256=yVVcRDkcdyfjsxro-N29SBvi-7773wnfDplef6-y8xw,1077
89
89
  unique_toolkit/app/schemas.py,sha256=UE1UaL_N2o48O-mLb_rF3Sp9MrVkfdDE6f_dm7WTOO4,9137
90
- unique_toolkit/app/unique_settings.py,sha256=JNU0LrlldVx1GUeSS0Mr1tqT67934KWU2OeVWkNUu28,11510
90
+ unique_toolkit/app/unique_settings.py,sha256=849pbASOu8QbHu9QfCJhYTisjKRet34J-fRs0gNKZ0Q,12369
91
91
  unique_toolkit/app/verification.py,sha256=GxFFwcJMy25fCA_Xe89wKW7bgqOu8PAs5y8QpHF0GSc,3861
92
92
  unique_toolkit/chat/__init__.py,sha256=LRs2G-JTVuci4lbtHTkVUiNcZcSR6uqqfnAyo7af6nY,619
93
93
  unique_toolkit/chat/constants.py,sha256=05kq6zjqUVB2d6_P7s-90nbljpB3ryxwCI-CAz0r2O4,83
@@ -133,7 +133,7 @@ unique_toolkit/short_term_memory/schemas.py,sha256=OhfcXyF6ACdwIXW45sKzjtZX_gkcJ
133
133
  unique_toolkit/short_term_memory/service.py,sha256=5PeVBu1ZCAfyDb2HLVvlmqSbyzBBuE9sI2o9Aajqjxg,8884
134
134
  unique_toolkit/smart_rules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
135
135
  unique_toolkit/smart_rules/compile.py,sha256=cxWjb2dxEI2HGsakKdVCkSNi7VK9mr08w5sDcFCQyWI,9553
136
- unique_toolkit-1.3.1.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
137
- unique_toolkit-1.3.1.dist-info/METADATA,sha256=rLo_XrmExigQ1oQ6KFaUy6EWiMmwO7uj-u7SH55nsq4,33610
138
- unique_toolkit-1.3.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
139
- unique_toolkit-1.3.1.dist-info/RECORD,,
136
+ unique_toolkit-1.3.3.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
137
+ unique_toolkit-1.3.3.dist-info/METADATA,sha256=FY2iBzcDa6mneFLi2qOfuttrXjCBDkW1TM11UoBbGus,33776
138
+ unique_toolkit-1.3.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
139
+ unique_toolkit-1.3.3.dist-info/RECORD,,