agenta 0.14.6a0__py3-none-any.whl → 0.14.7a0__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.

@@ -104,10 +104,10 @@ def add_variant(
104
104
  )
105
105
 
106
106
  if variant_name in config["variants"] and not overwrite:
107
- overwrite = questionary.confirm(
107
+ overwrite_question = questionary.confirm(
108
108
  "This variant already exists. Do you want to overwrite it?"
109
109
  ).ask()
110
- if not overwrite:
110
+ if not overwrite_question:
111
111
  click.echo("Operation cancelled.")
112
112
  sys.exit(0)
113
113
 
@@ -53,7 +53,7 @@ app.include_router(router, prefix="")
53
53
 
54
54
 
55
55
  class entrypoint(BaseDecorator):
56
- """Decorator class to wrap a function for HTTP POST, and terminal exposure.
56
+ """Decorator class to wrap a function for HTTP POST, terminal exposure and enable tracing.
57
57
 
58
58
  Args:
59
59
  BaseDecorator (object): base decorator class
@@ -62,18 +62,26 @@ class entrypoint(BaseDecorator):
62
62
  ```python
63
63
  import agenta as ag
64
64
 
65
- @ag.entrypoint()
65
+ @ag.entrypoint(enable_tracing=True) # Defaults to False
66
66
  async def chain_of_prompts_llm(prompt: str):
67
67
  return ...
68
68
  ```
69
69
  """
70
70
 
71
- def __call__(self, func: Callable[..., Any]) -> Callable[..., Any]:
71
+ def __init__(self, enable_tracing: bool = False):
72
+ self.enable_tracing = enable_tracing
73
+
74
+ def __call__(self, func: Callable[..., Any]):
72
75
  endpoint_name = "generate"
73
76
  func_signature = inspect.signature(func)
74
77
  config_params = agenta.config.all()
75
78
  ingestible_files = self.extract_ingestible_files(func_signature)
76
79
 
80
+ if self.enable_tracing:
81
+ from .tracing import trace
82
+
83
+ func = trace()(func)
84
+
77
85
  @functools.wraps(func)
78
86
  async def wrapper(*args, **kwargs) -> Any:
79
87
  func_params, api_config_params = self.split_kwargs(kwargs, config_params)
@@ -123,14 +131,13 @@ class entrypoint(BaseDecorator):
123
131
  )
124
132
 
125
133
  if self.is_main_script(func):
126
- self.handle_terminal_run(
134
+ result = self.handle_terminal_run(
127
135
  func,
128
136
  func_signature.parameters, # type: ignore
129
137
  config_params,
130
138
  ingestible_files,
131
139
  )
132
-
133
- return wrapper
140
+ return result
134
141
 
135
142
  def extract_ingestible_files(
136
143
  self,
@@ -325,7 +332,7 @@ class entrypoint(BaseDecorator):
325
332
  func_params: Dict[str, inspect.Parameter],
326
333
  config_params: Dict[str, Any],
327
334
  ingestible_files: Dict,
328
- ) -> None:
335
+ ):
329
336
  """
330
337
  Parses command line arguments and sets configuration when script is run from the terminal.
331
338
 
@@ -384,6 +391,7 @@ class entrypoint(BaseDecorator):
384
391
  print(
385
392
  f"\n========== Result ==========\n\nMessage: {result.message}\nCost: {result.cost}\nToken Usage: {result.usage}"
386
393
  )
394
+ return result
387
395
 
388
396
  def override_schema(
389
397
  self, openapi_schema: dict, func_name: str, endpoint: str, params: dict
@@ -84,7 +84,7 @@ class trace(BaseDecorator):
84
84
  name=func.__name__,
85
85
  inputs=kwargs,
86
86
  config=ag.config.all(),
87
- environment=os.environ.get("AGENTA_LLM_RUN_PLAYGROUND"), # type: ignore
87
+ environment=os.environ.get("AGENTA_LLM_RUN_ENVIRONMENT"), # type: ignore
88
88
  )
89
89
  try:
90
90
  is_coroutine_function = inspect.iscoroutinefunction(func)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: agenta
3
- Version: 0.14.6a0
3
+ Version: 0.14.7a0
4
4
  Summary: The SDK for agenta is an open-source LLMOps platform.
5
5
  Home-page: https://agenta.ai
6
6
  Keywords: LLMOps,LLM,evaluation,prompt engineering
@@ -3,7 +3,7 @@ agenta/cli/evaluation_commands.py,sha256=fs6492tprPId9p8eGO02Xy-NCBm2RZNJLZWcUxu
3
3
  agenta/cli/helper.py,sha256=vRxHyeNaltzNIGrfU2vO0H28_rXDzx9QqIZ_S-W6zL4,6212
4
4
  agenta/cli/main.py,sha256=GgYu6UsrnHbqPV7zPlO14b61IyaDiTIjGMYQS9DlqC4,9551
5
5
  agenta/cli/telemetry.py,sha256=GaFFRsE_NtrcSSJ10r2jhgFs5Sk8gf2C09Ox3gOr3eU,1317
6
- agenta/cli/variant_commands.py,sha256=9Ac2gB_2wokabxEgtY85xbYMt078JFfOXyi6GSkZ3rI,17268
6
+ agenta/cli/variant_commands.py,sha256=clqmv-UL2UKjOSVGn1icOXSEJ3EMf43-OphuHNWknCQ,17286
7
7
  agenta/cli/variant_configs.py,sha256=PLiuMKadVzs6Gi2uYaT0pZzyULNHDXaTMDWboqpwWdU,1293
8
8
  agenta/client/Readme.md,sha256=zWJ6VMYCG124op5RcqgWBdJdlGkGQ2rPLk9F32rWvqo,2756
9
9
  agenta/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -131,8 +131,8 @@ agenta/sdk/agenta_init.py,sha256=r28xgllqHe0Zs3Xz4UU7DoBMLF1tbPEbaqDi5irSiC8,863
131
131
  agenta/sdk/client.py,sha256=trKyBOYFZRk0v5Eptxvh87yPf50Y9CqY6Qgv4Fy-VH4,2142
132
132
  agenta/sdk/context.py,sha256=q-PxL05-I84puunUAs9LGsffEXcYhDxhQxjuOz2vK90,901
133
133
  agenta/sdk/decorators/base.py,sha256=9aNdX5h8a2mFweuhdO-BQPwXGKY9ONPIdLRhSGAGMfY,217
134
- agenta/sdk/decorators/llm_entrypoint.py,sha256=VU41C20ocPWm2pT5RCGpgj4cpT_ZRsgLmVteRgCx0sg,18586
135
- agenta/sdk/decorators/tracing.py,sha256=5Y2Jb0v07BUDlJyBuIDCZ3oIcF1Mp6rNCqQzDIW3Skk,3299
134
+ agenta/sdk/decorators/llm_entrypoint.py,sha256=RU_Se5RcS_JBrpd4Sst54WLrEzxxVHhmkrXwv6nZxW8,18849
135
+ agenta/sdk/decorators/tracing.py,sha256=9-NZPo52pC9i6vbGaoAcmU4J-fFYA1U6eyPWdbm6esU,3300
136
136
  agenta/sdk/router.py,sha256=0sbajvn5C7t18anH6yNo7-oYxldHnYfwcbmQnIXBePw,269
137
137
  agenta/sdk/tracing/context_manager.py,sha256=HskDaiORoOhjeN375gm05wYnieQzh5UnoIsnSAHkAyc,252
138
138
  agenta/sdk/tracing/llm_tracing.py,sha256=s8sHojV1ncYEg1uAWcm3BsfPd_6yaOPvB03Tq1FnEMU,8709
@@ -157,7 +157,7 @@ agenta/templates/simple_prompt/app.py,sha256=kODgF6lhzsaJPdgL5b21bUki6jkvqjWZzWR
157
157
  agenta/templates/simple_prompt/env.example,sha256=g9AE5bYcGPpxawXMJ96gh8oenEPCHTabsiOnfQo3c5k,70
158
158
  agenta/templates/simple_prompt/requirements.txt,sha256=ywRglRy7pPkw8bljmMEJJ4aOOQKrt9FGKULZ-DGkoBU,23
159
159
  agenta/templates/simple_prompt/template.toml,sha256=DQBtRrF4GU8LBEXOZ-GGuINXMQDKGTEG5y37tnvIUIE,60
160
- agenta-0.14.6a0.dist-info/METADATA,sha256=ckpAYSrWyEdhVcfNPPTus0gpwFqU1boT3YslWPUncM4,26472
161
- agenta-0.14.6a0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
162
- agenta-0.14.6a0.dist-info/entry_points.txt,sha256=PDiu8_8AsL7ibU9v4iNoOKR1S7F2rdxjlEprjM9QOgo,46
163
- agenta-0.14.6a0.dist-info/RECORD,,
160
+ agenta-0.14.7a0.dist-info/METADATA,sha256=FZ1CBOL2QI1sj6R650zq7V9fbHfIGSs7zGE79opaooU,26472
161
+ agenta-0.14.7a0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
162
+ agenta-0.14.7a0.dist-info/entry_points.txt,sha256=PDiu8_8AsL7ibU9v4iNoOKR1S7F2rdxjlEprjM9QOgo,46
163
+ agenta-0.14.7a0.dist-info/RECORD,,