lucidicai 3.4.0__py3-none-any.whl → 3.4.1__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
@@ -41,7 +41,7 @@ from .api.resources.prompt import Prompt
41
41
  from .integrations.livekit import setup_livekit
42
42
 
43
43
  # Version
44
- __version__ = "3.4.0"
44
+ __version__ = "3.4.1"
45
45
 
46
46
  # All exports
47
47
  __all__ = [
@@ -23,6 +23,24 @@ class Prompt:
23
23
  def __str__(self) -> str:
24
24
  return self.content
25
25
 
26
+ def replace_variables(self, variables: Dict[str, Any]) -> "Prompt":
27
+ """Replace template variables in the prompt content.
28
+
29
+ Replaces {{key}} placeholders in raw_content with the provided
30
+ variable values and updates content.
31
+
32
+ Args:
33
+ variables: Dictionary mapping variable names to their values.
34
+
35
+ Returns:
36
+ self, for method chaining.
37
+ """
38
+ content = self.raw_content
39
+ for key, value in variables.items():
40
+ content = content.replace(f"{{{{{key}}}}}", str(value))
41
+ self.content = content
42
+ return self
43
+
26
44
 
27
45
  class PromptResource:
28
46
  """Handle prompt-related API operations."""
@@ -102,13 +120,10 @@ class PromptResource:
102
120
  "timestamp": time.time(),
103
121
  }
104
122
 
105
- # Replace variables
106
- content = raw_content
123
+ prompt = Prompt(raw_content=raw_content, content=raw_content, metadata=metadata)
107
124
  if variables:
108
- for key, value in variables.items():
109
- content = content.replace(f"{{{{{key}}}}}", str(value))
110
-
111
- return Prompt(raw_content=raw_content, content=content, metadata=metadata)
125
+ prompt.replace_variables(variables)
126
+ return prompt
112
127
  except Exception as e:
113
128
  if self._production:
114
129
  logger.error(f"[PromptResource] Failed to get prompt: {e}")
@@ -149,12 +164,10 @@ class PromptResource:
149
164
  "timestamp": time.time(),
150
165
  }
151
166
 
152
- content = raw_content
167
+ prompt = Prompt(raw_content=raw_content, content=raw_content, metadata=metadata)
153
168
  if variables:
154
- for key, value in variables.items():
155
- content = content.replace(f"{{{{{key}}}}}", str(value))
156
-
157
- return Prompt(raw_content=raw_content, content=content, metadata=metadata)
169
+ prompt.replace_variables(variables)
170
+ return prompt
158
171
  except Exception as e:
159
172
  if self._production:
160
173
  logger.error(f"[PromptResource] Failed to get prompt: {e}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lucidicai
3
- Version: 3.4.0
3
+ Version: 3.4.1
4
4
  Summary: Lucidic AI Python SDK
5
5
  Author: Andy Liang
6
6
  Author-email: andy@lucidic.ai
@@ -1,4 +1,4 @@
1
- lucidicai/__init__.py,sha256=F60cdLYiZ2P2xh5B1GXzIUFckj-HUwGZimMOAfepXUk,1376
1
+ lucidicai/__init__.py,sha256=d0jiR0fpY1JbmHuczLu7sni-Qk9zZXe5M8zHxURe4RA,1376
2
2
  lucidicai/action.py,sha256=sPRd1hTIVXDqnvG9ZXWEipUFh0bsXcE0Fm7RVqmVccM,237
3
3
  lucidicai/client.py,sha256=BGKP91_Oj5kHQU0osYf1T_BWakL8KIhs0AgUc5X99sU,15104
4
4
  lucidicai/constants.py,sha256=zN8O7TjoRHRlaGa9CZUWppS73rhzKGwaEkF9XMTV0Cg,1160
@@ -26,7 +26,7 @@ lucidicai/api/resources/evals.py,sha256=_3nLE6dMLht844mWw7kl_hctjv5JIuC6MP06YWUg
26
26
  lucidicai/api/resources/event.py,sha256=GTIU5sIbLNTWAHk4rB120xWTRkhnraz9JNfamEygyNo,14267
27
27
  lucidicai/api/resources/experiment.py,sha256=fOIKJ5d89bHJBVZ3wjbhY_6XF3kLHz9TE3BVPA5pNpA,3563
28
28
  lucidicai/api/resources/feature_flag.py,sha256=ii412DIkZCEAhrXdGydcpQKveqGlFq4NlgdmWQnU83c,2259
29
- lucidicai/api/resources/prompt.py,sha256=KAvpgWuLzo4HhSHy1vSBApNNplNAfMNyjYjv0fsurHM,5637
29
+ lucidicai/api/resources/prompt.py,sha256=M2ZovMX74-ULksMXzXPXVgBziRcTcmz40GnDcJx30Q0,6053
30
30
  lucidicai/api/resources/session.py,sha256=jW_bftHdunhLHl_3-k0nqB5FrtLhlFeCF0tMFE82nNw,20761
31
31
  lucidicai/core/__init__.py,sha256=b0YQkd8190Y_GgwUcmf0tOiSLARd7L4kq4jwfhhGAyI,39
32
32
  lucidicai/core/config.py,sha256=q4h-yR35Ay_3znL7vavri6ScfeM69RjHShNNzjoQthc,10194
@@ -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.4.0.dist-info/METADATA,sha256=8-0BGkaSBc5YCjeVpDV6QFTCgZiCWDnzeY3Y00RcvOg,902
97
- lucidicai-3.4.0.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
98
- lucidicai-3.4.0.dist-info/top_level.txt,sha256=vSSdM3lclF4I5tyVC0xxUk8eIRnnYXMe1hW-eO91HUo,10
99
- lucidicai-3.4.0.dist-info/RECORD,,
96
+ lucidicai-3.4.1.dist-info/METADATA,sha256=oPV8Sh8GPs876yl42Vk7ZyAe2HyD8NW9K_jxO1p8kf4,902
97
+ lucidicai-3.4.1.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
98
+ lucidicai-3.4.1.dist-info/top_level.txt,sha256=vSSdM3lclF4I5tyVC0xxUk8eIRnnYXMe1hW-eO91HUo,10
99
+ lucidicai-3.4.1.dist-info/RECORD,,