mojentic 0.5.1__py3-none-any.whl → 0.5.2__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.
@@ -253,7 +253,7 @@ class MessageBuilder():
253
253
 
254
254
  return self
255
255
 
256
- def load_content(self, file_path: Union[str, Path], template_values: Optional[Dict[str, str]] = None) -> "MessageBuilder":
256
+ def load_content(self, file_path: Union[str, Path], template_values: Optional[Dict[str, Union[str, Path]]] = None) -> "MessageBuilder":
257
257
  """
258
258
  Load content from a file into the content field of the MessageBuilder.
259
259
 
@@ -265,11 +265,14 @@ class MessageBuilder():
265
265
  ----------
266
266
  file_path : Union[str, Path]
267
267
  Path to the file to load content from. Can be a string or Path object.
268
- template_values : Optional[Dict[str, str]], optional
268
+ template_values : Optional[Dict[str, Union[str, Path]]], optional
269
269
  Dictionary of values used to replace placeholders in the content.
270
270
  For example, if the content contains "{greeting}" and template_values is
271
271
  {"greeting": "Hello, World!"}, then "{greeting}" will be replaced with
272
- "Hello, World!". Default is None.
272
+ "Hello, World!".
273
+ If a value is a Path object, it will be treated as a file reference and the
274
+ content of that file will be used to replace the placeholder.
275
+ Default is None.
273
276
 
274
277
  Returns
275
278
  -------
@@ -290,7 +293,15 @@ class MessageBuilder():
290
293
  # Replace placeholders with template values if provided
291
294
  if template_values:
292
295
  for key, value in template_values.items():
293
- self.content = self.content.replace(f"{{{key}}}", value)
296
+ if isinstance(value, Path):
297
+ # If value is a Path, read the content of the file
298
+ if not self.file_gateway.exists(value):
299
+ raise FileNotFoundError(f"Template file not found: {value}")
300
+ file_content = self.file_gateway.read(value).strip()
301
+ self.content = self.content.replace(f"{{{key}}}", file_content)
302
+ else:
303
+ # If value is a string, use it directly
304
+ self.content = self.content.replace(f"{{{key}}}", value)
294
305
 
295
306
  return self
296
307
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mojentic
3
- Version: 0.5.1
3
+ Version: 0.5.2
4
4
  Summary: Mojentic is an agentic framework that aims to provide a simple and flexible way to assemble teams of agents to solve complex problems.
5
5
  Author-email: Stacey Vetzal <stacey@vetzal.com>
6
6
  Project-URL: Homepage, https://github.com/mojility/mojentic
@@ -59,7 +59,7 @@ mojentic/llm/chat_session.py,sha256=H2gY0mZYVym8jC69VHsmKaRZ9T87Suyw0-TW5r850nA,
59
59
  mojentic/llm/chat_session_spec.py,sha256=8-jj-EHV2WwWuvo3t8I75kSEAYiG1nR-OEwkkLTi_z0,3872
60
60
  mojentic/llm/llm_broker.py,sha256=8dEgqU-cPesPk4-jx36oPnvKxB34bLONbpyAW_2L-es,5884
61
61
  mojentic/llm/llm_broker_spec.py,sha256=zxOf3n8lXmUsowzlMcC-fRcOj_6wwDf7xIqLIV278nM,6979
62
- mojentic/llm/message_composers.py,sha256=IrTK6HrwAQtJRMW5spMRZmX4yKHl2SJdOkFYvhVXZYg,11305
62
+ mojentic/llm/message_composers.py,sha256=afUcoM-JL4iTMCQDy_Ge9zhrZkisVkzBH09K93kgvn4,12008
63
63
  mojentic/llm/message_composers_spec.py,sha256=IXZ-Gl--1MGbmRkFNxucWTE7OZgLQHDDgw1WqMiZnF0,14762
64
64
  mojentic/llm/gateways/__init__.py,sha256=u7hXzngoRw_qbsJeiCH2NQ8vC2hF5DnqcXsfLVVPSSw,104
65
65
  mojentic/llm/gateways/anthropic.py,sha256=SsyNjq9QaXaqiMM43C9fwLp57hpgFtwNPJUnOAYVrtc,1788
@@ -91,8 +91,8 @@ mojentic/llm/tools/tool_wrapper_spec.py,sha256=LGqtre-g8SzOy3xtpbMdgTnw2EdYutmFO
91
91
  mojentic/llm/tools/web_search.py,sha256=L1accST2xMhGAkwHCLlIvKihTLiaYxl0NI6IqCJWGCw,1102
92
92
  mojentic/utils/__init__.py,sha256=lqECkkoFvHFttDnafRE1vvh0Dmna_lwupMToP5VvX5k,115
93
93
  mojentic/utils/formatting.py,sha256=bPrwwdluXdQ8TsFxfWtHNOeMWKNvAfABSoUnnA1g7c8,947
94
- mojentic-0.5.1.dist-info/licenses/LICENSE.md,sha256=txSgV8n5zY1W3NiF5HHsCwlaW0e8We1cSC6TuJUqxXA,1060
95
- mojentic-0.5.1.dist-info/METADATA,sha256=YIXg6guNrmTF3fBI225OEvBGuFro2uPOdmnGl5xi1Xc,4935
96
- mojentic-0.5.1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
97
- mojentic-0.5.1.dist-info/top_level.txt,sha256=Q-BvPQ8Eu1jnEqK8Xkr6A9C8Xa1z38oPZRHuA5MCTqg,19
98
- mojentic-0.5.1.dist-info/RECORD,,
94
+ mojentic-0.5.2.dist-info/licenses/LICENSE.md,sha256=txSgV8n5zY1W3NiF5HHsCwlaW0e8We1cSC6TuJUqxXA,1060
95
+ mojentic-0.5.2.dist-info/METADATA,sha256=JGFNKLO5RCVPfhLNAJA9teZfUJaErWpSmxukYLnkPz4,4935
96
+ mojentic-0.5.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
97
+ mojentic-0.5.2.dist-info/top_level.txt,sha256=Q-BvPQ8Eu1jnEqK8Xkr6A9C8Xa1z38oPZRHuA5MCTqg,19
98
+ mojentic-0.5.2.dist-info/RECORD,,