unique_toolkit 0.7.36__py3-none-any.whl → 0.7.37__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.
@@ -17,6 +17,4 @@ def get_sse_client(
17
17
  "x-app-id": unique_settings.app.id,
18
18
  "x-company-id": unique_settings.auth.company_id,
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 pydantic_settings import BaseSettings, SettingsConfigDict
1
+ from pathlib import Path
2
2
 
3
- config_dict = SettingsConfigDict(
4
- env_file_encoding="utf-8",
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: str
11
- key: str
8
+ id: SecretStr
9
+ key: SecretStr
12
10
  base_url: str
13
11
  endpoint: str
14
- endpoint_secret: str
12
+ endpoint_secret: SecretStr
15
13
 
16
- model_config = SettingsConfigDict(env_prefix="unique_app_", **config_dict)
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: str
21
- user_id: str
23
+ company_id: SecretStr
24
+ user_id: SecretStr
22
25
 
23
- model_config = SettingsConfigDict(env_prefix="unique_auth_", **config_dict)
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
- app: UniqueApp = UniqueApp()
28
- auth: UniqueAuth = UniqueAuth()
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.36
3
+ Version: 0.7.37
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,9 @@ 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.36] - 2025-07-24
116
- - Add utilities for SSE client and secrets
117
- - Helper function to convert unique history to langchain history
116
+ ## [0.7.36] - 2025-07-25
117
+ - Fix issues with settings
118
+ - Add testing to unique settings
118
119
 
119
120
  ## [0.7.35] - 2025-07-23
120
121
  - 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=gx20U1W27yEZCLx5yJrD1lRRTF4q2_jA-i646-cUQqY,688
15
- unique_toolkit/app/unique_settings.py,sha256=QFtMFKSx5pj-eRUmcNM0oWwQAcC27utEJcjJA6w0SW0,595
14
+ unique_toolkit/app/sse_client.py,sha256=UrX41CIbw0DDBn8mOx_3rT1X8GCjqqYQcxhasoT0C-Q,611
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.36.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
70
- unique_toolkit-0.7.36.dist-info/METADATA,sha256=03dgWfJhc27m3hoKMhLVurINFaPVw7oM9_yRdk5iGdY,25199
71
- unique_toolkit-0.7.36.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
72
- unique_toolkit-0.7.36.dist-info/RECORD,,
69
+ unique_toolkit-0.7.37.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
70
+ unique_toolkit-0.7.37.dist-info/METADATA,sha256=Do_KkEttqekSmZCpzHCZGApVgYB-6ho6XegupsPtn6s,25195
71
+ unique_toolkit-0.7.37.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
72
+ unique_toolkit-0.7.37.dist-info/RECORD,,