agenta 0.59.3__py3-none-any.whl → 0.59.4__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.

Potentially problematic release.


This version of agenta might be problematic. Click here for more details.

agenta/sdk/types.py CHANGED
@@ -521,13 +521,26 @@ class PromptTemplate(BaseModel):
521
521
  elif self.template_format == "curly":
522
522
  import re
523
523
 
524
+ # Extract variables that exist in the original template before replacement
525
+ # This allows us to distinguish template variables from {{}} in user input values
526
+ original_variables = set(re.findall(r"\{\{(.*?)\}\}", content))
527
+
524
528
  result = content
525
529
  for key, value in kwargs.items():
526
- result = re.sub(r"\{\{" + key + r"\}\}", str(value), result)
527
- if re.search(r"\{\{.*?\}\}", result):
528
- unreplaced = re.findall(r"\{\{(.*?)\}\}", result)
530
+ # Escape backslashes in the replacement string to prevent regex interpretation
531
+ escaped_value = str(value).replace("\\", "\\\\")
532
+ result = re.sub(
533
+ r"\{\{" + re.escape(key) + r"\}\}", escaped_value, result
534
+ )
535
+
536
+ # Only check if ORIGINAL template variables remain unreplaced
537
+ # Don't error on {{}} that came from user input values
538
+ unreplaced_matches = set(re.findall(r"\{\{(.*?)\}\}", result))
539
+ truly_unreplaced = original_variables & unreplaced_matches
540
+
541
+ if truly_unreplaced:
529
542
  raise TemplateFormatError(
530
- f"Unreplaced variables in curly template: {unreplaced}"
543
+ f"Unreplaced variables in curly template: {sorted(truly_unreplaced)}"
531
544
  )
532
545
  return result
533
546
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agenta
3
- Version: 0.59.3
3
+ Version: 0.59.4
4
4
  Summary: The SDK for agenta is an open-source LLMOps platform.
5
5
  Keywords: LLMOps,LLM,evaluation,prompt engineering
6
6
  Author: Mahmoud Mabrouk
@@ -349,7 +349,7 @@ agenta/sdk/tracing/processors.py,sha256=ZE6baO2U3ER73rckvXhdbNmLgs3jn6le7iAUQc6o
349
349
  agenta/sdk/tracing/propagation.py,sha256=EeOqDMqnh_MoEhGd1do_vy_tQBYUcoC8kpLqVoZeqg0,2561
350
350
  agenta/sdk/tracing/spans.py,sha256=nqUOjjirBxB8Eacv8Qj4Ra_6rknGi3lbJdNyKmk5ODQ,3707
351
351
  agenta/sdk/tracing/tracing.py,sha256=mHsmlp19PKJsd80JPqsvpHsNX_rr9rQz-Fepv4PNqz8,9233
352
- agenta/sdk/types.py,sha256=SaFXHuySHgdoP2ueKPgZCq8_Jhkq8e1FY5A7QaVFPYE,22015
352
+ agenta/sdk/types.py,sha256=J_xtNHzbMoGcG69prMHqlm0khzWwaV67zks-G2J1Pvo,22745
353
353
  agenta/sdk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
354
354
  agenta/sdk/utils/cache.py,sha256=q6SYVzHW9RCwtZ7z4Ue3uMwXroroLlko5AvQ1MouvFM,1429
355
355
  agenta/sdk/utils/constants.py,sha256=zW3R4rjXOo2L5lz6q84l_zYuOM9u4mpPRHw_B1Dr_hI,67
@@ -366,6 +366,6 @@ agenta/sdk/workflows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
366
366
  agenta/sdk/workflows/registry.py,sha256=4FRSeU4njMmP6xFCIteF5f_W6NVlqFTx1AM7hsaGAQk,975
367
367
  agenta/sdk/workflows/types.py,sha256=SjYeT8FWVgwaIIC8sI3fRjKERLEA_oxuBGvYSaFqNg8,11720
368
368
  agenta/sdk/workflows/utils.py,sha256=ILfY8DSBWLrdWIuKg6mq7rANwKiiY6sxEeFiBFhjLYM,413
369
- agenta-0.59.3.dist-info/METADATA,sha256=Hu2dgwepEuNfoe2vYi7rkofEjpvPwFGYKkVaJA5VmLs,31753
370
- agenta-0.59.3.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
371
- agenta-0.59.3.dist-info/RECORD,,
369
+ agenta-0.59.4.dist-info/METADATA,sha256=6LfvmyprrbhUV-NvpII5fsdjKsYYAwhWg18KqctUeDU,31753
370
+ agenta-0.59.4.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
371
+ agenta-0.59.4.dist-info/RECORD,,