unique_toolkit 0.8.33__py3-none-any.whl → 0.8.35__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.
@@ -78,6 +78,30 @@ def get_event_generator(
78
78
  continue
79
79
 
80
80
 
81
+ def get_event_stream(
82
+ event_type: type[T] = BaseEvent,
83
+ settings_config: UniqueSettings | str | None = None,
84
+ ) -> Generator[T, None, None]:
85
+ """
86
+ Get an event stream from the SSE client.
87
+
88
+ Args:
89
+ event_type: The type of event to get
90
+ settings_or_filename: The settings or filename to use to setup the Unique settings object
91
+ """
92
+
93
+ if isinstance(settings_config, str):
94
+ unique_settings = UniqueSettings.from_env_auto_with_sdk_init(
95
+ filename=settings_config
96
+ )
97
+ elif isinstance(settings_config, UniqueSettings):
98
+ unique_settings = settings_config
99
+ else:
100
+ unique_settings = UniqueSettings.from_env_auto_with_sdk_init()
101
+
102
+ return get_event_generator(unique_settings, event_type)
103
+
104
+
81
105
  def run_demo_with_sse_client(
82
106
  unique_settings: UniqueSettings,
83
107
  handler: Callable[[BaseEvent], Awaitable[None] | None],
@@ -158,10 +158,19 @@ class EnvFileNotFoundError(FileNotFoundError):
158
158
 
159
159
 
160
160
  class UniqueSettings:
161
- def __init__(self, auth: UniqueAuth, app: UniqueApp, api: UniqueApi):
161
+ def __init__(
162
+ self,
163
+ auth: UniqueAuth,
164
+ app: UniqueApp,
165
+ api: UniqueApi,
166
+ env_file: Path | None = None,
167
+ ):
162
168
  self.app = app
163
169
  self.auth = auth
164
170
  self.api = api
171
+ self._env_file: Path | None = (
172
+ env_file if (env_file and env_file.exists()) else None
173
+ )
165
174
 
166
175
  @classmethod
167
176
  def _find_env_file(cls, filename: str = "unique.env") -> Path:
@@ -226,7 +235,7 @@ class UniqueSettings:
226
235
  auth = UniqueAuth(_env_file=env_file_str) # type: ignore[call-arg]
227
236
  app = UniqueApp(_env_file=env_file_str) # type: ignore[call-arg]
228
237
  api = UniqueApi(_env_file=env_file_str) # type: ignore[call-arg]
229
- return cls(auth=auth, app=app, api=api)
238
+ return cls(auth=auth, app=app, api=api, env_file=env_file)
230
239
 
231
240
  @classmethod
232
241
  def from_env_auto(cls, filename: str = "unique.env") -> "UniqueSettings":
@@ -243,6 +252,7 @@ class UniqueSettings:
243
252
  """
244
253
  try:
245
254
  env_file = cls._find_env_file(filename)
255
+ logger.info(f"Environment file found at {env_file}")
246
256
  return cls.from_env(env_file=env_file)
247
257
  except EnvFileNotFoundError:
248
258
  logger.warning(
@@ -135,11 +135,19 @@ class ContentService:
135
135
 
136
136
  @classmethod
137
137
  def from_settings(
138
- cls, settings: UniqueSettings, metadata_filter: dict | None = None
138
+ cls,
139
+ settings: UniqueSettings | str | None = None,
140
+ metadata_filter: dict | None = None,
139
141
  ):
140
142
  """
141
- Initialize the ContentService with a settings object.
143
+ Initialize the ContentService with a settings object and metadata filter.
142
144
  """
145
+
146
+ if settings is None:
147
+ settings = UniqueSettings.from_env_auto_with_sdk_init()
148
+ elif isinstance(settings, str):
149
+ settings = UniqueSettings.from_env_auto_with_sdk_init(filename=settings)
150
+
143
151
  return cls(
144
152
  company_id=settings.auth.company_id.get_secret_value(),
145
153
  user_id=settings.auth.user_id.get_secret_value(),
@@ -56,10 +56,16 @@ class EmbeddingService(BaseService):
56
56
  return cls(company_id=event.company_id, user_id=event.user_id)
57
57
 
58
58
  @classmethod
59
- def from_settings(cls, settings: UniqueSettings):
59
+ def from_settings(cls, settings: UniqueSettings | str | None = None):
60
60
  """
61
61
  Initialize the EmbeddingService with a settings object.
62
62
  """
63
+
64
+ if settings is None:
65
+ settings = UniqueSettings.from_env_auto_with_sdk_init()
66
+ elif isinstance(settings, str):
67
+ settings = UniqueSettings.from_env_auto_with_sdk_init(filename=settings)
68
+
63
69
  return cls(
64
70
  company_id=settings.auth.company_id.get_secret_value(),
65
71
  user_id=settings.auth.user_id.get_secret_value(),
@@ -91,10 +91,15 @@ class LanguageModelService:
91
91
  return cls(company_id=event.company_id, user_id=event.user_id)
92
92
 
93
93
  @classmethod
94
- def from_settings(cls, settings: UniqueSettings):
94
+ def from_settings(cls, settings: UniqueSettings | str | None = None):
95
95
  """
96
96
  Initialize the LanguageModelService with a settings object.
97
97
  """
98
+ if settings is None:
99
+ settings = UniqueSettings.from_env_auto_with_sdk_init()
100
+ elif isinstance(settings, str):
101
+ settings = UniqueSettings.from_env_auto_with_sdk_init(filename=settings)
102
+
98
103
  return cls(
99
104
  company_id=settings.auth.company_id.get_secret_value(),
100
105
  user_id=settings.auth.user_id.get_secret_value(),
@@ -2,7 +2,7 @@ from pydantic import Field, create_model
2
2
  from unique_sdk.utils.chat_in_space import send_message_and_wait_for_completion
3
3
 
4
4
  from unique_toolkit.app import ChatEvent
5
- from unique_toolkit.evaluators.schemas import EvaluationMetricName
5
+ from unique_toolkit.evals.schemas import EvaluationMetricName
6
6
  from unique_toolkit.language_model import (
7
7
  LanguageModelFunction,
8
8
  LanguageModelMessage,
@@ -146,7 +146,7 @@ class SubAgentTool(Tool[SubAgentToolConfig]):
146
146
  tool_response: ToolCallResponse,
147
147
  ) -> LanguageModelMessage:
148
148
  return ToolCallResponse(
149
- id=tool_response.id,
149
+ id=tool_response.id, # type: ignore
150
150
  name=tool_response.name,
151
- content=tool_response["content"],
151
+ content=tool_response.content,
152
152
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_toolkit
3
- Version: 0.8.33
3
+ Version: 0.8.35
4
4
  Summary:
5
5
  License: Proprietary
6
6
  Author: Martin Fadler
@@ -115,6 +115,11 @@ All notable changes to this project will be documented in this file.
115
115
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
116
116
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
117
117
 
118
+ ## [0.8.35] - 2025-09-01
119
+ - Initial toolkit documentation (WIP)
120
+
121
+ ## [0.8.34] - 2025-09-01
122
+ - Automatic initializations of services and event generator
118
123
 
119
124
  ## [0.8.33] - 2025-08-31
120
125
 
@@ -16,13 +16,13 @@ unique_toolkit/_common/utils/structured_output/schema.py,sha256=Tp7kDYcmKtnUhcuR
16
16
  unique_toolkit/_common/validate_required_values.py,sha256=Y_M1ub9gIKP9qZ45F6Zq3ZHtuIqhmOjl8Z2Vd3avg8w,588
17
17
  unique_toolkit/_common/validators.py,sha256=aZwbMho7XszN7lT5RtemaiXgC0WJ4u40oeVgsNGhF4U,2803
18
18
  unique_toolkit/app/__init__.py,sha256=ETxYDpEizg_PKmi4JPX_P76ySq-us-xypfAIdKQ1QZU,1284
19
- unique_toolkit/app/dev_util.py,sha256=rN-xSg4OGfmwjaToy8m_hQroehcLYyk9-GCmQJ-f6uY,4302
19
+ unique_toolkit/app/dev_util.py,sha256=1C5aGUQnyO8Kot9i35PPFl4B32Oj9eK22WKTP_BrfwY,5063
20
20
  unique_toolkit/app/init_logging.py,sha256=Sh26SRxOj8i8dzobKhYha2lLrkrMTHfB1V4jR3h23gQ,678
21
21
  unique_toolkit/app/init_sdk.py,sha256=5_oDoETr6akwYyBCb0ivTdMNu3SVgPSkrXcDS6ELyY8,2269
22
22
  unique_toolkit/app/performance/async_tasks.py,sha256=H0l3OAcosLwNHZ8d2pd-Di4wHIXfclEvagi5kfqLFPA,1941
23
23
  unique_toolkit/app/performance/async_wrapper.py,sha256=yVVcRDkcdyfjsxro-N29SBvi-7773wnfDplef6-y8xw,1077
24
24
  unique_toolkit/app/schemas.py,sha256=xHdzMyZ_cgCzxCqzCJYwOCAYWkaQ9zIyZsRhDgSQnEA,8088
25
- unique_toolkit/app/unique_settings.py,sha256=f9Ip1yBhIJqHpuHIo3ihCW2MGyQynBggEKDzlIOIlyg,9976
25
+ unique_toolkit/app/unique_settings.py,sha256=_Ll_GuWYiOIK2w4HQPA_uopTdDDFcjVqDFO3m2F2b-Q,10254
26
26
  unique_toolkit/app/verification.py,sha256=GxFFwcJMy25fCA_Xe89wKW7bgqOu8PAs5y8QpHF0GSc,3861
27
27
  unique_toolkit/chat/__init__.py,sha256=LRs2G-JTVuci4lbtHTkVUiNcZcSR6uqqfnAyo7af6nY,619
28
28
  unique_toolkit/chat/constants.py,sha256=05kq6zjqUVB2d6_P7s-90nbljpB3ryxwCI-CAz0r2O4,83
@@ -35,14 +35,14 @@ unique_toolkit/content/__init__.py,sha256=EdJg_A_7loEtCQf4cah3QARQreJx6pdz89Rm96
35
35
  unique_toolkit/content/constants.py,sha256=1iy4Y67xobl5VTnJB6SxSyuoBWbdLl9244xfVMUZi5o,60
36
36
  unique_toolkit/content/functions.py,sha256=HZtDIAH3ZxWleq5Si_v30n_7vTnNRu6BCxpTHb9TxdA,18635
37
37
  unique_toolkit/content/schemas.py,sha256=KJ604BOx0vBh2AwlTCZkOo55aHsI6yj8vxDAARKKqEo,2995
38
- unique_toolkit/content/service.py,sha256=u4-9hXxali4eSpRtnjK93TunsV0YmB6EDqPY1rpnKQ4,23443
38
+ unique_toolkit/content/service.py,sha256=0g1aWbjKkHRo-ZiVlDICvCtYEO29WDs8R-rGHGg4_QE,23724
39
39
  unique_toolkit/content/utils.py,sha256=qNVmHTuETaPNGqheg7TbgPr1_1jbNHDc09N5RrmUIyo,7901
40
40
  unique_toolkit/debug_info_manager/debug_info_manager.py,sha256=7c2yb3ES0yu-SJy3o7EwpuCBGaq_8IOMEAvD-BQ-eLI,576
41
41
  unique_toolkit/embedding/__init__.py,sha256=uUyzjonPvuDCYsvXCIt7ErQXopLggpzX-MEQd3_e2kE,250
42
42
  unique_toolkit/embedding/constants.py,sha256=Lj8-Lcy1FvuC31PM9Exq7vaFuxQV4pEI1huUMFX-J2M,52
43
43
  unique_toolkit/embedding/functions.py,sha256=3qp-BfuMAbnp8YB04rh3xH8vsJuCBPizoy-JeaBFtoQ,1944
44
44
  unique_toolkit/embedding/schemas.py,sha256=1GvKCaSk4jixzVQ2PKq8yDqwGEVY_hWclYtoAr6CC2g,96
45
- unique_toolkit/embedding/service.py,sha256=2KjYlUKxeh-Je8S1mOPiQ735pqAmdbeztycVNJxcUXA,5039
45
+ unique_toolkit/embedding/service.py,sha256=XViQCbjG9yznIFhWjgBkla_4s7zM2lO12Cqob1FU63k,5283
46
46
  unique_toolkit/embedding/utils.py,sha256=v86lo__bCJbxZBQ3OcLu5SuwT6NbFfWlcq8iyk6BuzQ,279
47
47
  unique_toolkit/evals/config.py,sha256=ywHIrJs5SFdKr1WXfrofWuFfzb0iPQw8iZDpq5oEug4,953
48
48
  unique_toolkit/evals/context_relevancy/prompts.py,sha256=EdHFUOB581yVxcOL8482KUv_LzaRjuiem71EF8udYMc,1331
@@ -92,7 +92,7 @@ unique_toolkit/language_model/infos.py,sha256=fKmpTEvrHotGFo-PHkLpdlmk57UyFLCkuP
92
92
  unique_toolkit/language_model/prompt.py,sha256=JSawaLjQg3VR-E2fK8engFyJnNdk21zaO8pPIodzN4Q,3991
93
93
  unique_toolkit/language_model/reference.py,sha256=nkX2VFz-IrUz8yqyc3G5jUMNwrNpxITBrMEKkbqqYoI,8583
94
94
  unique_toolkit/language_model/schemas.py,sha256=EOgy-p1GRcS46Sq0qEsN8MfOMl-KCcvEd9aCmqm9d08,16497
95
- unique_toolkit/language_model/service.py,sha256=DYvqYlHiI7Bwq65RMGBJ995Wq_zUzRzPPnrpN2843zc,11776
95
+ unique_toolkit/language_model/service.py,sha256=JkYGtCug8POQskTv_aoYkzTMOaPCWRM94y73o3bUttQ,12019
96
96
  unique_toolkit/language_model/utils.py,sha256=bPQ4l6_YO71w-zaIPanUUmtbXC1_hCvLK0tAFc3VCRc,1902
97
97
  unique_toolkit/postprocessor/postprocessor_manager.py,sha256=yf34VMwZfwGjmDbVeMJ5JN3ET4N68V39EF9kiWVUa_Y,4213
98
98
  unique_toolkit/protocols/support.py,sha256=V15WEIFKVMyF1QCnR8vIi4GrJy4dfTCB6d6JlqPZ58o,2341
@@ -111,7 +111,7 @@ unique_toolkit/tools/a2a/config.py,sha256=DKerB7gJ0oUFfqdvVN4I174EZYfYzt7ET2NYGk
111
111
  unique_toolkit/tools/a2a/manager.py,sha256=-Vt0pL886zMaaG4sGQhXmbwOhOL928WbZzm4FRZuZMM,1666
112
112
  unique_toolkit/tools/a2a/memory.py,sha256=F18kUA3m3NqoKdKAJSwDv8JQneHvZTGOkcZTLNMXAYs,1004
113
113
  unique_toolkit/tools/a2a/schema.py,sha256=1R7qIu2l2qnUJDGRuUnZLqPPkHnT3x4d3d4PALoBzcY,296
114
- unique_toolkit/tools/a2a/service.py,sha256=8yiG2zYqHva4fQJX4dfnE9Bm4vDnbK0k6YRyCSQy9RQ,5147
114
+ unique_toolkit/tools/a2a/service.py,sha256=-I-0S35cWl7IFiqEk-0Ph31enJvQS9cuA9sUTrOFAVI,5155
115
115
  unique_toolkit/tools/agent_chunks_hanlder.py,sha256=x32Dp1Z8cVW5i-XzXbaMwX2KHPcNGmqEU-FB4AV9ZGo,1909
116
116
  unique_toolkit/tools/config.py,sha256=nYwglwUSb3fxhqYxI83k-qoecuF5Zcol5FMOxHvTNeE,3827
117
117
  unique_toolkit/tools/factory.py,sha256=w3uNHuYBIJ330Xi8PTdAkr8G3OMbQH2cBgvk5UT16oE,1253
@@ -129,7 +129,7 @@ unique_toolkit/tools/utils/execution/execution.py,sha256=vjG2Y6awsGNtlvyQAGCTthQ
129
129
  unique_toolkit/tools/utils/source_handling/schema.py,sha256=vzAyf6ZWNexjMO0OrnB8y2glGkvAilmGGQXd6zcDaKw,870
130
130
  unique_toolkit/tools/utils/source_handling/source_formatting.py,sha256=C7uayNbdkNVJdEARA5CENnHtNY1SU6etlaqbgHNyxaQ,9152
131
131
  unique_toolkit/tools/utils/source_handling/tests/test_source_formatting.py,sha256=oM5ZxEgzROrnX1229KViCAFjRxl9wCTzWZoinYSHleM,6979
132
- unique_toolkit-0.8.33.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
133
- unique_toolkit-0.8.33.dist-info/METADATA,sha256=6ohnYw35vWjXiiVkqnq3oF0QVINLnuF1GYGZzntACf4,29666
134
- unique_toolkit-0.8.33.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
135
- unique_toolkit-0.8.33.dist-info/RECORD,,
132
+ unique_toolkit-0.8.35.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
133
+ unique_toolkit-0.8.35.dist-info/METADATA,sha256=cVG_CzA5eEzYlQqD31iEZZkwN-O1_xcg9P0gRltLTcs,29815
134
+ unique_toolkit-0.8.35.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
135
+ unique_toolkit-0.8.35.dist-info/RECORD,,