lucidicai 3.2.0__py3-none-any.whl → 3.3.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.
lucidicai/__init__.py CHANGED
@@ -38,7 +38,7 @@ from .core.errors import (
38
38
  from .integrations.livekit import setup_livekit
39
39
 
40
40
  # Version
41
- __version__ = "3.2.0"
41
+ __version__ = "3.3.0"
42
42
 
43
43
  # All exports
44
44
  __all__ = [
lucidicai/client.py CHANGED
@@ -64,6 +64,8 @@ class LucidicAI:
64
64
  auto_end: Whether sessions auto-end on context exit or process shutdown.
65
65
  production: If True, suppress SDK errors. If None, checks LUCIDIC_PRODUCTION env var.
66
66
  region: Deployment region ("us", "india"). Falls back to LUCIDIC_REGION env var.
67
+ base_url: Custom base URL for API requests. Takes precedence over region.
68
+ Falls back to LUCIDIC_BASE_URL env var.
67
69
  **kwargs: Additional configuration options passed to SDKConfig.
68
70
 
69
71
  Raises:
@@ -93,6 +95,13 @@ class LucidicAI:
93
95
  agent_id="...",
94
96
  region="india"
95
97
  )
98
+
99
+ # Custom base URL (e.g., self-hosted deployment)
100
+ client = LucidicAI(
101
+ api_key="...",
102
+ agent_id="...",
103
+ base_url="https://custom.example.com/api"
104
+ )
96
105
  """
97
106
 
98
107
  def __init__(
@@ -103,6 +112,7 @@ class LucidicAI:
103
112
  auto_end: bool = True,
104
113
  production: Optional[bool] = None,
105
114
  region: Optional[str] = None,
115
+ base_url: Optional[str] = None,
106
116
  **kwargs,
107
117
  ):
108
118
  # Generate unique client ID for telemetry routing
@@ -119,6 +129,7 @@ class LucidicAI:
119
129
  agent_id=agent_id,
120
130
  auto_end=auto_end,
121
131
  region=region,
132
+ base_url=base_url,
122
133
  **kwargs,
123
134
  )
124
135
 
lucidicai/core/config.py CHANGED
@@ -53,16 +53,20 @@ class NetworkConfig:
53
53
  connection_pool_maxsize: int = 100
54
54
 
55
55
  @classmethod
56
- def from_env(cls, region: Optional[str] = None, debug: bool = False) -> 'NetworkConfig':
56
+ def from_env(cls, region: Optional[str] = None, base_url: Optional[str] = None, debug: bool = False) -> 'NetworkConfig':
57
57
  """Load network configuration from environment variables.
58
58
 
59
- Priority: debug > region argument > LUCIDIC_REGION env var > default
59
+ Priority: debug > base_url argument > LUCIDIC_BASE_URL > region argument > LUCIDIC_REGION > default
60
60
 
61
61
  Args:
62
62
  region: Region string override (e.g., "us", "india")
63
- debug: If True, use localhost URL regardless of region
63
+ base_url: Custom base URL override (takes precedence over region)
64
+ debug: If True, use localhost URL regardless of other settings
64
65
  """
65
- # If debug mode, use localhost (ignores region)
66
+ import logging
67
+ logger = logging.getLogger("Lucidic")
68
+
69
+ # If debug mode, use localhost (highest priority)
66
70
  if debug:
67
71
  return cls(
68
72
  base_url=DEBUG_URL,
@@ -74,7 +78,28 @@ class NetworkConfig:
74
78
  connection_pool_maxsize=int(os.getenv("LUCIDIC_CONNECTION_POOL_MAXSIZE", "100"))
75
79
  )
76
80
 
77
- # Resolve region: argument > env var > default
81
+ # Resolve base_url: argument > env var
82
+ resolved_base_url = base_url or os.getenv("LUCIDIC_BASE_URL")
83
+
84
+ if resolved_base_url:
85
+ # base_url takes precedence over region
86
+ region_str = region or os.getenv("LUCIDIC_REGION")
87
+ if region_str:
88
+ logger.warning(
89
+ f"[LucidicAI] Both base_url and region specified. "
90
+ f"Using base_url '{resolved_base_url}', ignoring region '{region_str}'."
91
+ )
92
+ return cls(
93
+ base_url=resolved_base_url,
94
+ region=None, # Custom deployment, no region
95
+ timeout=int(os.getenv("LUCIDIC_TIMEOUT", "30")),
96
+ max_retries=int(os.getenv("LUCIDIC_MAX_RETRIES", "3")),
97
+ backoff_factor=float(os.getenv("LUCIDIC_BACKOFF_FACTOR", "0.5")),
98
+ connection_pool_size=int(os.getenv("LUCIDIC_CONNECTION_POOL_SIZE", "20")),
99
+ connection_pool_maxsize=int(os.getenv("LUCIDIC_CONNECTION_POOL_MAXSIZE", "100"))
100
+ )
101
+
102
+ # Fall back to region-based URL resolution
78
103
  region_str = region or os.getenv("LUCIDIC_REGION")
79
104
  resolved_region = Region.from_string(region_str) if region_str else DEFAULT_REGION
80
105
 
@@ -147,11 +172,13 @@ class SDKConfig:
147
172
  debug: bool = False
148
173
 
149
174
  @classmethod
150
- def from_env(cls, region: Optional[str] = None, **overrides) -> 'SDKConfig':
175
+ def from_env(cls, region: Optional[str] = None, base_url: Optional[str] = None, **overrides) -> 'SDKConfig':
151
176
  """Create configuration from environment variables with optional overrides.
152
177
 
153
178
  Args:
154
179
  region: Region string (e.g., "us", "india"). Priority: arg > env var > default
180
+ base_url: Custom base URL override. Takes precedence over region.
181
+ Falls back to LUCIDIC_BASE_URL env var.
155
182
  **overrides: Additional configuration overrides
156
183
  """
157
184
  from dotenv import load_dotenv
@@ -165,7 +192,7 @@ class SDKConfig:
165
192
  auto_end=os.getenv("LUCIDIC_AUTO_END", "true").lower() == "true",
166
193
  production_monitoring=False,
167
194
  blob_threshold=int(os.getenv("LUCIDIC_BLOB_THRESHOLD", "65536")),
168
- network=NetworkConfig.from_env(region=region, debug=debug),
195
+ network=NetworkConfig.from_env(region=region, base_url=base_url, debug=debug),
169
196
  error_handling=ErrorHandlingConfig.from_env(),
170
197
  telemetry=TelemetryConfig.from_env(),
171
198
  environment=Environment.DEBUG if debug else Environment.PRODUCTION,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lucidicai
3
- Version: 3.2.0
3
+ Version: 3.3.0
4
4
  Summary: Lucidic AI Python SDK
5
5
  Author: Andy Liang
6
6
  Author-email: andy@lucidic.ai
@@ -1,6 +1,6 @@
1
- lucidicai/__init__.py,sha256=L5Zy-XJVTIqJAi3nrh8lAp8J4ii4yaEudaQxB94tXQM,1284
1
+ lucidicai/__init__.py,sha256=gdk3Y-cq-RaTbhBcBE77saBwHSbIvqaScU9gNoTi7_g,1284
2
2
  lucidicai/action.py,sha256=sPRd1hTIVXDqnvG9ZXWEipUFh0bsXcE0Fm7RVqmVccM,237
3
- lucidicai/client.py,sha256=WnkUeo_Z0uP4xh66gNC6MJhYdyhRpjC61OBjHEJLHq4,14674
3
+ lucidicai/client.py,sha256=LC9KPhZgTnt5klntHoyCQWWpRUE-X58lM80uAaWBNiU,15090
4
4
  lucidicai/constants.py,sha256=zN8O7TjoRHRlaGa9CZUWppS73rhzKGwaEkF9XMTV0Cg,1160
5
5
  lucidicai/context.py,sha256=ruEXAndSv0gQ-YEXLlC4Fx6NNbaylfp_dZxbpwmLZSA,4622
6
6
  lucidicai/dataset.py,sha256=wu25X02JyWkht_yQabgQpGZFfzbNTxG6tf5k9ol8Amo,4005
@@ -29,7 +29,7 @@ lucidicai/api/resources/feature_flag.py,sha256=ii412DIkZCEAhrXdGydcpQKveqGlFq4Nl
29
29
  lucidicai/api/resources/prompt.py,sha256=tdMVTaLc3DDRbd_R8Xd5mkvpdwQONfr8OwkJRTE0atE,2495
30
30
  lucidicai/api/resources/session.py,sha256=jW_bftHdunhLHl_3-k0nqB5FrtLhlFeCF0tMFE82nNw,20761
31
31
  lucidicai/core/__init__.py,sha256=b0YQkd8190Y_GgwUcmf0tOiSLARd7L4kq4jwfhhGAyI,39
32
- lucidicai/core/config.py,sha256=06XZPOCpB8YY9nzqt7deR3CP6MAQIKCTZYdSzscAPDY,8730
32
+ lucidicai/core/config.py,sha256=q4h-yR35Ay_3znL7vavri6ScfeM69RjHShNNzjoQthc,10194
33
33
  lucidicai/core/errors.py,sha256=bYSRPqadXUCPadVLb-2fj63CB6jlAnfDeu2azHB2z8M,2137
34
34
  lucidicai/core/types.py,sha256=KabcTBQe7SemigccKfJSDiJmjSJDJJvvtefSd8pfrJI,702
35
35
  lucidicai/integrations/__init__.py,sha256=9eJxdcw9C_zLXLQGdKK-uwCYhjdnEelrXbYYNo48ewk,292
@@ -93,7 +93,7 @@ lucidicai/utils/images.py,sha256=z8mlIKgFfrIbuk-l4L2rB62uw_uPO79sHPXPY7eLu2A,128
93
93
  lucidicai/utils/logger.py,sha256=R3B3gSee64F6UVHUrShihBq_O7W7bgfrBiVDXTO3Isg,4777
94
94
  lucidicai/utils/queue.py,sha256=8DQwnGw7pINEJ0dNSkB0PhdPW-iBQQ-YZg23poe4umE,17323
95
95
  lucidicai/utils/serialization.py,sha256=KdOREZd7XBxFBAZ86DePMfYPzSVyKr4RcgUa82aFxrs,820
96
- lucidicai-3.2.0.dist-info/METADATA,sha256=4H-66e1GD2248FpoRJBLUb1oW3ICnJhIYXcngIirq6Q,902
97
- lucidicai-3.2.0.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
98
- lucidicai-3.2.0.dist-info/top_level.txt,sha256=vSSdM3lclF4I5tyVC0xxUk8eIRnnYXMe1hW-eO91HUo,10
99
- lucidicai-3.2.0.dist-info/RECORD,,
96
+ lucidicai-3.3.0.dist-info/METADATA,sha256=p8D3cXfEzfEC4HnYYz68keBQwzNDOkSqifh8H13m1t4,902
97
+ lucidicai-3.3.0.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
98
+ lucidicai-3.3.0.dist-info/top_level.txt,sha256=vSSdM3lclF4I5tyVC0xxUk8eIRnnYXMe1hW-eO91HUo,10
99
+ lucidicai-3.3.0.dist-info/RECORD,,