unique_toolkit 0.7.36__py3-none-any.whl → 0.7.38__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_toolkit/app/sse_client.py +3 -5
- unique_toolkit/app/unique_settings.py +47 -14
- {unique_toolkit-0.7.36.dist-info → unique_toolkit-0.7.38.dist-info}/METADATA +8 -4
- {unique_toolkit-0.7.36.dist-info → unique_toolkit-0.7.38.dist-info}/RECORD +6 -6
- {unique_toolkit-0.7.36.dist-info → unique_toolkit-0.7.38.dist-info}/LICENSE +0 -0
- {unique_toolkit-0.7.36.dist-info → unique_toolkit-0.7.38.dist-info}/WHEEL +0 -0
unique_toolkit/app/sse_client.py
CHANGED
|
@@ -13,10 +13,8 @@ def get_sse_client(
|
|
|
13
13
|
) -> SSEClient:
|
|
14
14
|
url = f"{unique_settings.app.base_url}/public/event-socket/events/stream?subscriptions={','.join(subscriptions)}"
|
|
15
15
|
headers = {
|
|
16
|
-
"Authorization": f"Bearer {unique_settings.app.key}",
|
|
17
|
-
"x-app-id": unique_settings.app.id,
|
|
18
|
-
"x-company-id": unique_settings.auth.company_id,
|
|
16
|
+
"Authorization": f"Bearer {unique_settings.app.key.get_secret_value()}",
|
|
17
|
+
"x-app-id": unique_settings.app.id.get_secret_value(),
|
|
18
|
+
"x-company-id": unique_settings.auth.company_id.get_secret_value(),
|
|
19
19
|
}
|
|
20
|
-
LOGGER.info(f"SSEheaders: {headers}")
|
|
21
|
-
LOGGER.info(f"SSE Url: {url}")
|
|
22
20
|
return SSEClient(url=url, headers=headers)
|
|
@@ -1,28 +1,61 @@
|
|
|
1
|
-
from
|
|
1
|
+
from pathlib import Path
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
extra="ignore",
|
|
6
|
-
)
|
|
3
|
+
from pydantic import SecretStr
|
|
4
|
+
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
7
5
|
|
|
8
6
|
|
|
9
7
|
class UniqueApp(BaseSettings):
|
|
10
|
-
id:
|
|
11
|
-
key:
|
|
8
|
+
id: SecretStr
|
|
9
|
+
key: SecretStr
|
|
12
10
|
base_url: str
|
|
13
11
|
endpoint: str
|
|
14
|
-
endpoint_secret:
|
|
12
|
+
endpoint_secret: SecretStr
|
|
15
13
|
|
|
16
|
-
model_config = SettingsConfigDict(
|
|
14
|
+
model_config = SettingsConfigDict(
|
|
15
|
+
env_prefix="unique_app_",
|
|
16
|
+
env_file_encoding="utf-8",
|
|
17
|
+
case_sensitive=False,
|
|
18
|
+
extra="ignore",
|
|
19
|
+
)
|
|
17
20
|
|
|
18
21
|
|
|
19
22
|
class UniqueAuth(BaseSettings):
|
|
20
|
-
company_id:
|
|
21
|
-
user_id:
|
|
23
|
+
company_id: SecretStr
|
|
24
|
+
user_id: SecretStr
|
|
22
25
|
|
|
23
|
-
model_config = SettingsConfigDict(
|
|
26
|
+
model_config = SettingsConfigDict(
|
|
27
|
+
env_prefix="unique_auth_",
|
|
28
|
+
env_file_encoding="utf-8",
|
|
29
|
+
case_sensitive=False,
|
|
30
|
+
extra="ignore",
|
|
31
|
+
)
|
|
24
32
|
|
|
25
33
|
|
|
26
34
|
class UniqueSettings:
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
def __init__(self, auth: UniqueAuth, app: UniqueApp):
|
|
36
|
+
self.app = app
|
|
37
|
+
self.auth = auth
|
|
38
|
+
|
|
39
|
+
@classmethod
|
|
40
|
+
def from_env(cls, env_file: Path | None = None) -> "UniqueSettings":
|
|
41
|
+
"""Initialize settings from environment variables and/or env file.
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
env_file: Optional path to environment file. If provided, will load variables from this file.
|
|
45
|
+
|
|
46
|
+
Returns:
|
|
47
|
+
UniqueSettings instance with values loaded from environment/env file.
|
|
48
|
+
|
|
49
|
+
Raises:
|
|
50
|
+
FileNotFoundError: If env_file is provided but does not exist.
|
|
51
|
+
ValidationError: If required environment variables are missing.
|
|
52
|
+
"""
|
|
53
|
+
if env_file and not env_file.exists():
|
|
54
|
+
raise FileNotFoundError(f"Environment file not found: {env_file}")
|
|
55
|
+
|
|
56
|
+
# Initialize settings with environment file if provided
|
|
57
|
+
env_file_str = str(env_file) if env_file else None
|
|
58
|
+
auth = UniqueAuth(_env_file=env_file_str, _env_file_encoding="utf-8")
|
|
59
|
+
app = UniqueApp(_env_file=env_file_str, _env_file_encoding="utf-8")
|
|
60
|
+
|
|
61
|
+
return cls(auth=auth, app=app)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: unique_toolkit
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.38
|
|
4
4
|
Summary:
|
|
5
5
|
License: Proprietary
|
|
6
6
|
Author: Martin Fadler
|
|
@@ -16,6 +16,7 @@ Requires-Dist: pydantic-settings (>=2.10.1,<3.0.0)
|
|
|
16
16
|
Requires-Dist: pyhumps (>=3.8.0,<4.0.0)
|
|
17
17
|
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
|
|
18
18
|
Requires-Dist: regex (>=2024.5.15,<2025.0.0)
|
|
19
|
+
Requires-Dist: sseclient (>=0.0.27,<0.0.28)
|
|
19
20
|
Requires-Dist: tiktoken (>=0.7.0,<0.8.0)
|
|
20
21
|
Requires-Dist: typing-extensions (>=4.9.0,<5.0.0)
|
|
21
22
|
Requires-Dist: unique-sdk (>=0.9.40,<0.10.0)
|
|
@@ -112,9 +113,12 @@ All notable changes to this project will be documented in this file.
|
|
|
112
113
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
113
114
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
114
115
|
|
|
115
|
-
## [0.7.
|
|
116
|
-
-
|
|
117
|
-
|
|
116
|
+
## [0.7.38] - 2025-07-25
|
|
117
|
+
- Fix issues with secret strings in settings
|
|
118
|
+
|
|
119
|
+
## [0.7.36] - 2025-07-25
|
|
120
|
+
- Fix issues with settings
|
|
121
|
+
- Add testing to unique settings
|
|
118
122
|
|
|
119
123
|
## [0.7.35] - 2025-07-23
|
|
120
124
|
- Bump version of SDK to have access to the latest features and fixes
|
|
@@ -11,8 +11,8 @@ unique_toolkit/app/init_sdk.py,sha256=Nv4Now4pMfM0AgRhbtatLpm_39rKxn0WmRLwmPhRl-
|
|
|
11
11
|
unique_toolkit/app/performance/async_tasks.py,sha256=H0l3OAcosLwNHZ8d2pd-Di4wHIXfclEvagi5kfqLFPA,1941
|
|
12
12
|
unique_toolkit/app/performance/async_wrapper.py,sha256=yVVcRDkcdyfjsxro-N29SBvi-7773wnfDplef6-y8xw,1077
|
|
13
13
|
unique_toolkit/app/schemas.py,sha256=f1WHnEqSMX2C_c9vtOOVNSdlSH--jK22GDbtRAKPVjc,5044
|
|
14
|
-
unique_toolkit/app/sse_client.py,sha256=
|
|
15
|
-
unique_toolkit/app/unique_settings.py,sha256=
|
|
14
|
+
unique_toolkit/app/sse_client.py,sha256=jtOhB2g_oE-vJBqtVuWnWyYUJYv3oOhN2U8j8wuHJ5Y,668
|
|
15
|
+
unique_toolkit/app/unique_settings.py,sha256=fi3V9Dru1G1YK7Pxju_KBGiNJHkHdx7JzpDglcvMZro,1820
|
|
16
16
|
unique_toolkit/app/verification.py,sha256=GxFFwcJMy25fCA_Xe89wKW7bgqOu8PAs5y8QpHF0GSc,3861
|
|
17
17
|
unique_toolkit/chat/__init__.py,sha256=LRs2G-JTVuci4lbtHTkVUiNcZcSR6uqqfnAyo7af6nY,619
|
|
18
18
|
unique_toolkit/chat/constants.py,sha256=05kq6zjqUVB2d6_P7s-90nbljpB3ryxwCI-CAz0r2O4,83
|
|
@@ -66,7 +66,7 @@ unique_toolkit/short_term_memory/schemas.py,sha256=OhfcXyF6ACdwIXW45sKzjtZX_gkcJ
|
|
|
66
66
|
unique_toolkit/short_term_memory/service.py,sha256=8sW7cFJRd4vcRfotJSWb0uHZYl-e5hQWp3G1SddL5Bg,8110
|
|
67
67
|
unique_toolkit/smart_rules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
68
68
|
unique_toolkit/smart_rules/compile.py,sha256=cxWjb2dxEI2HGsakKdVCkSNi7VK9mr08w5sDcFCQyWI,9553
|
|
69
|
-
unique_toolkit-0.7.
|
|
70
|
-
unique_toolkit-0.7.
|
|
71
|
-
unique_toolkit-0.7.
|
|
72
|
-
unique_toolkit-0.7.
|
|
69
|
+
unique_toolkit-0.7.38.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
|
|
70
|
+
unique_toolkit-0.7.38.dist-info/METADATA,sha256=owlyNWn4pHKXlaJae2J3Vyt7ttIgQjrDGTsfaNjOrTg,25266
|
|
71
|
+
unique_toolkit-0.7.38.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
72
|
+
unique_toolkit-0.7.38.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|