agenta 0.19.6a0__py3-none-any.whl → 0.19.8__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.

@@ -139,7 +139,7 @@ def add_variant(
139
139
 
140
140
  except Exception as ex:
141
141
  click.echo(click.style(f"Error while building image: {ex}", fg="red"))
142
- return None
142
+ raise
143
143
  try:
144
144
  if overwrite:
145
145
  click.echo(
@@ -166,7 +166,7 @@ def add_variant(
166
166
  click.echo(click.style(f"Error while updating variant: {ex}", fg="red"))
167
167
  else:
168
168
  click.echo(click.style(f"Error while adding variant: {ex}", fg="red"))
169
- return None
169
+ raise
170
170
 
171
171
  agenta_dir = Path.home() / ".agenta"
172
172
  global_toml_file = toml.load(agenta_dir / "config.toml")
@@ -461,28 +461,28 @@ def serve_cli(ctx, app_folder: str, file_name: str, overwrite: bool):
461
461
  error_msg += "or\n"
462
462
  error_msg += ">>> agenta variant serve <filename>.py"
463
463
  click.echo(click.style(f"{error_msg}", fg="red"))
464
- sys.exit(0)
464
+ sys.exit(1)
465
465
 
466
466
  try:
467
467
  config_check(app_folder)
468
468
  except Exception as e:
469
469
  click.echo(click.style("Failed during configuration check.", fg="red"))
470
470
  click.echo(click.style(f"Error message: {str(e)}", fg="red"))
471
- return
471
+ sys.exit(1)
472
472
 
473
473
  try:
474
474
  host = get_host(app_folder)
475
475
  except Exception as e:
476
476
  click.echo(click.style("Failed to retrieve the host.", fg="red"))
477
477
  click.echo(click.style(f"Error message: {str(e)}", fg="red"))
478
- return
478
+ sys.exit(1)
479
479
 
480
480
  try:
481
481
  api_key = helper.get_global_config("api_key")
482
482
  except Exception as e:
483
483
  click.echo(click.style("Failed to retrieve the api key.", fg="red"))
484
484
  click.echo(click.style(f"Error message: {str(e)}", fg="red"))
485
- return
485
+ sys.exit(1)
486
486
 
487
487
  try:
488
488
  variant_id = add_variant(
@@ -491,7 +491,7 @@ def serve_cli(ctx, app_folder: str, file_name: str, overwrite: bool):
491
491
  except Exception as e:
492
492
  click.echo(click.style("Failed to add variant.", fg="red"))
493
493
  click.echo(click.style(f"Error message: {str(e)}", fg="red"))
494
- return
494
+ sys.exit(1)
495
495
 
496
496
  if variant_id:
497
497
  try:
@@ -503,9 +503,11 @@ def serve_cli(ctx, app_folder: str, file_name: str, overwrite: bool):
503
503
  "- Second, try restarting the containers (if using Docker Compose)."
504
504
  )
505
505
  click.echo(click.style(f"{error_msg}", fg="red"))
506
+ sys.exit(1)
506
507
  except Exception as e:
507
508
  click.echo(click.style("Failed to start container with LLM app.", fg="red"))
508
509
  click.echo(click.style(f"Error message: {str(e)}", fg="red"))
510
+ sys.exit(1)
509
511
 
510
512
 
511
513
  @variant.command(name="list")
agenta/sdk/agenta_init.py CHANGED
@@ -240,11 +240,6 @@ def init(
240
240
 
241
241
  singleton.init(app_id=app_id, host=host, api_key=api_key, config_fname=config_fname)
242
242
 
243
- if os.environ.get("AGENTA_LOCAL", False):
244
- singleton.host = singleton.host.replace(
245
- "http://localhost", "http://host.docker.internal"
246
- )
247
-
248
243
  tracing = Tracing(
249
244
  host=singleton.host, # type: ignore
250
245
  app_id=singleton.app_id, # type: ignore
@@ -56,7 +56,6 @@ class instrument(BaseDecorator):
56
56
  input_dict.update(kwargs)
57
57
 
58
58
  async def wrapped_func(*args, **kwargs):
59
-
60
59
  # logging.debug(" ".join([">..", str(tracing_context.get())]))
61
60
 
62
61
  token = None
@@ -124,7 +123,6 @@ class instrument(BaseDecorator):
124
123
  input_dict.update(kwargs)
125
124
 
126
125
  def wrapped_func(*args, **kwargs):
127
-
128
126
  # logging.debug(" ".join([">..", str(tracing_context.get())]))
129
127
 
130
128
  token = None
@@ -32,12 +32,13 @@ def litellm_handler():
32
32
  span_kind = (
33
33
  "llm" if call_type in ["completion", "acompletion"] else "embedding"
34
34
  )
35
- self._trace.start_span(
35
+
36
+ ag.tracing.start_span(
36
37
  name=f"{span_kind}_call",
37
38
  input={"messages": kwargs["messages"]},
38
39
  spankind=span_kind,
39
40
  )
40
- self._trace.set_span_attribute(
41
+ ag.tracing.set_attributes(
41
42
  {
42
43
  "model_config": {
43
44
  "model": kwargs.get("model"),
@@ -49,15 +50,17 @@ def litellm_handler():
49
50
  )
50
51
 
51
52
  def log_stream_event(self, kwargs, response_obj, start_time, end_time):
52
- self._trace.update_span_status(span=self._trace.active_span, value="OK")
53
- self._trace.end_span(
53
+ ag.tracing.set_status(status="OK")
54
+ ag.tracing.end_span(
54
55
  outputs={
55
56
  "message": kwargs.get(
56
57
  "complete_streaming_response"
57
58
  ), # the complete streamed response (only set if `completion(..stream=True)`)
58
- "usage": response_obj.usage.dict()
59
- if hasattr(response_obj, "usage")
60
- else None, # litellm calculates usage
59
+ "usage": (
60
+ response_obj.usage.dict()
61
+ if hasattr(response_obj, "usage")
62
+ else None
63
+ ), # litellm calculates usage
61
64
  "cost": kwargs.get(
62
65
  "response_cost"
63
66
  ), # litellm calculates response cost
@@ -67,13 +70,15 @@ def litellm_handler():
67
70
  def log_success_event(
68
71
  self, kwargs, response_obj: ModelResponse, start_time, end_time
69
72
  ):
70
- self._trace.update_span_status(span=self._trace.active_span, value="OK")
71
- self._trace.end_span(
73
+ ag.tracing.set_status(status="OK")
74
+ ag.tracing.end_span(
72
75
  outputs={
73
76
  "message": response_obj.choices[0].message.content,
74
- "usage": response_obj.usage.dict()
75
- if hasattr(response_obj, "usage")
76
- else None, # litellm calculates usage
77
+ "usage": (
78
+ response_obj.usage.dict()
79
+ if hasattr(response_obj, "usage")
80
+ else None
81
+ ), # litellm calculates usage
77
82
  "cost": kwargs.get(
78
83
  "response_cost"
79
84
  ), # litellm calculates response cost
@@ -83,23 +88,25 @@ def litellm_handler():
83
88
  def log_failure_event(
84
89
  self, kwargs, response_obj: ModelResponse, start_time, end_time
85
90
  ):
86
- self._trace.update_span_status(span=self._trace.active_span, value="ERROR")
87
- self._trace.set_span_attribute(
91
+ ag.tracing.set_status(status="ERROR")
92
+ ag.tracing.set_attributes(
88
93
  {
89
- "traceback_exception": kwargs[
90
- "traceback_exception"
91
- ], # the traceback generated via `traceback.format_exc()`
94
+ "traceback_exception": repr(
95
+ kwargs["traceback_exception"]
96
+ ), # the traceback generated via `traceback.format_exc()`
92
97
  "call_end_time": kwargs[
93
98
  "end_time"
94
99
  ], # datetime object of when call was completed
95
100
  },
96
101
  )
97
- self._trace.end_span(
102
+ ag.tracing.end_span(
98
103
  outputs={
99
104
  "message": kwargs["exception"], # the Exception raised
100
- "usage": response_obj.usage.dict()
101
- if hasattr(response_obj, "usage")
102
- else None, # litellm calculates usage
105
+ "usage": (
106
+ response_obj.usage.dict()
107
+ if hasattr(response_obj, "usage")
108
+ else None
109
+ ), # litellm calculates usage
103
110
  "cost": kwargs.get(
104
111
  "response_cost"
105
112
  ), # litellm calculates response cost
@@ -109,15 +116,17 @@ def litellm_handler():
109
116
  async def async_log_stream_event(
110
117
  self, kwargs, response_obj, start_time, end_time
111
118
  ):
112
- self._trace.update_span_status(span=self._trace.active_span, value="OK")
113
- self._trace.end_span(
119
+ ag.tracing.set_status(status="OK")
120
+ ag.tracing.end_span(
114
121
  outputs={
115
122
  "message": kwargs.get(
116
123
  "complete_streaming_response"
117
124
  ), # the complete streamed response (only set if `completion(..stream=True)`)
118
- "usage": response_obj.usage.dict()
119
- if hasattr(response_obj, "usage")
120
- else None, # litellm calculates usage
125
+ "usage": (
126
+ response_obj.usage.dict()
127
+ if hasattr(response_obj, "usage")
128
+ else None
129
+ ), # litellm calculates usage
121
130
  "cost": kwargs.get(
122
131
  "response_cost"
123
132
  ), # litellm calculates response cost
@@ -127,13 +136,15 @@ def litellm_handler():
127
136
  async def async_log_success_event(
128
137
  self, kwargs, response_obj, start_time, end_time
129
138
  ):
130
- self._trace.update_span_status(span=self._trace.active_span, value="OK")
131
- self._trace.end_span(
139
+ ag.tracing.set_status(status="OK")
140
+ ag.tracing.end_span(
132
141
  outputs={
133
142
  "message": response_obj.choices[0].message.content,
134
- "usage": response_obj.usage.dict()
135
- if hasattr(response_obj, "usage")
136
- else None, # litellm calculates usage
143
+ "usage": (
144
+ response_obj.usage.dict()
145
+ if hasattr(response_obj, "usage")
146
+ else None
147
+ ), # litellm calculates usage
137
148
  "cost": kwargs.get(
138
149
  "response_cost"
139
150
  ), # litellm calculates response cost
@@ -143,8 +154,8 @@ def litellm_handler():
143
154
  async def async_log_failure_event(
144
155
  self, kwargs, response_obj, start_time, end_time
145
156
  ):
146
- self._trace.update_span_status(span=self._trace.active_span, value="ERROR")
147
- self._trace.set_span_attribute(
157
+ ag.tracing.set_status(status="ERROR")
158
+ ag.tracing.set_attributes(
148
159
  {
149
160
  "traceback_exception": kwargs[
150
161
  "traceback_exception"
@@ -154,12 +165,14 @@ def litellm_handler():
154
165
  ], # datetime object of when call was completed
155
166
  },
156
167
  )
157
- self._trace.end_span(
168
+ ag.tracing.end_span(
158
169
  outputs={
159
- "message": kwargs["exception"], # the Exception raised
160
- "usage": response_obj.usage.dict()
161
- if hasattr(response_obj, "usage")
162
- else None, # litellm calculates usage
170
+ "message": repr(kwargs["exception"]), # the Exception raised
171
+ "usage": (
172
+ response_obj.usage.dict()
173
+ if hasattr(response_obj, "usage")
174
+ else None
175
+ ), # litellm calculates usage
163
176
  "cost": kwargs.get(
164
177
  "response_cost"
165
178
  ), # litellm calculates response cost
@@ -196,7 +196,6 @@ class Tracing(metaclass=SingletonMeta):
196
196
  config: Optional[Dict[str, Any]] = None,
197
197
  **kwargs,
198
198
  ) -> CreateSpan:
199
-
200
199
  tracing = tracing_context.get()
201
200
 
202
201
  span_id = self._create_span_id()
@@ -415,7 +414,8 @@ class Tracing(metaclass=SingletonMeta):
415
414
  "trace",
416
415
  # mock_create_traces(
417
416
  self.client.create_traces(
418
- trace=tracing.trace_id, spans=tracing.closed_spans # type: ignore
417
+ trace=tracing.trace_id,
418
+ spans=tracing.closed_spans, # type: ignore
419
419
  ),
420
420
  self.client,
421
421
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: agenta
3
- Version: 0.19.6a0
3
+ Version: 0.19.8
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=Wz0ODhoeKK3Qg_CFUhu6D909szk05tc8ZVBB6H1-w7k,9763
5
5
  agenta/cli/telemetry.py,sha256=GaFFRsE_NtrcSSJ10r2jhgFs5Sk8gf2C09Ox3gOr3eU,1317
6
- agenta/cli/variant_commands.py,sha256=NjTXOMaJWyZtwtJiU7Ldl47jTYeC7-vktar1GNO6FVY,17294
6
+ agenta/cli/variant_commands.py,sha256=u2ThjbnE6qnNxNm1vZIXWHfHc-0JPmYnJ-AqpwtM8Ns,17350
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
@@ -127,17 +127,17 @@ agenta/docker/docker-assets/lambda_function.py,sha256=h4UZSSfqwpfsCgERv6frqwm_4J
127
127
  agenta/docker/docker-assets/main.py,sha256=7MI-21n81U7N7A0GxebNi0cmGWtJKcR2sPB6FcH2QfA,251
128
128
  agenta/docker/docker_utils.py,sha256=5uHMCzXkCvIsDdEiwbnnn97KkzsFbBvyMwogCsv_Z5U,3509
129
129
  agenta/sdk/__init__.py,sha256=cF0de6DiH-NZWEm0XvPN8_TeC1whPBnDf1WYYE1qK2g,762
130
- agenta/sdk/agenta_init.py,sha256=xZEuuSnKm1zgG7YFpMCMXxabbgVyPqnW6am0Qu3n3TU,9958
130
+ agenta/sdk/agenta_init.py,sha256=8MfDuypxohd0qRTdtGjX7L17KW-1UGmzNVdiqF15_ak,9790
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
134
  agenta/sdk/decorators/llm_entrypoint.py,sha256=umcniOOQfKVdPgHVb_jRhoGKei14Yc3PIZmEC8CU2Wg,22996
135
- agenta/sdk/decorators/tracing.py,sha256=_RCiT6VqOshUtFm7rZhv5mQGl5PioXPDJxb3N8EDOUY,6174
135
+ agenta/sdk/decorators/tracing.py,sha256=c9LwQJkhJcyO7Uq-sNpDSwfwOUTAmlqNuJjz4bSx-k0,6172
136
136
  agenta/sdk/router.py,sha256=0sbajvn5C7t18anH6yNo7-oYxldHnYfwcbmQnIXBePw,269
137
137
  agenta/sdk/tracing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
138
- agenta/sdk/tracing/callbacks.py,sha256=8XYcGC4EZQ0lBn2IWmtPH_yC5Hu6Yu-NkdZRuY7CoTw,6816
138
+ agenta/sdk/tracing/callbacks.py,sha256=0rqkW-PGZSaNSMp_t4bGI7R9HQRgTyIy0gxmpGVJWpE,6915
139
139
  agenta/sdk/tracing/context_manager.py,sha256=HskDaiORoOhjeN375gm05wYnieQzh5UnoIsnSAHkAyc,252
140
- agenta/sdk/tracing/llm_tracing.py,sha256=k8SfZ7mo2oDUijne00lGkHh1AryzWydZEefT4RtnnWU,13690
140
+ agenta/sdk/tracing/llm_tracing.py,sha256=OL9OZ9sKv58hAsSxf33E-VYFx2ZeJpr9jqe3Hvz1CX8,13706
141
141
  agenta/sdk/tracing/logger.py,sha256=GfH7V-jBHcn7h5dbdrnkDMe_ml3wkXFBeoQiqR4KVRc,474
142
142
  agenta/sdk/tracing/tasks_manager.py,sha256=ROrWIaqS2J2HHiJtRWiHKlLY8CCsqToP5VeXu7mamck,3748
143
143
  agenta/sdk/tracing/tracing_context.py,sha256=EOi1zfqpb2cBjhBtHIphUkVHi4jiWes-RRNdbgk1kMc,906
@@ -161,7 +161,7 @@ agenta/templates/simple_prompt/app.py,sha256=kODgF6lhzsaJPdgL5b21bUki6jkvqjWZzWR
161
161
  agenta/templates/simple_prompt/env.example,sha256=g9AE5bYcGPpxawXMJ96gh8oenEPCHTabsiOnfQo3c5k,70
162
162
  agenta/templates/simple_prompt/requirements.txt,sha256=ywRglRy7pPkw8bljmMEJJ4aOOQKrt9FGKULZ-DGkoBU,23
163
163
  agenta/templates/simple_prompt/template.toml,sha256=DQBtRrF4GU8LBEXOZ-GGuINXMQDKGTEG5y37tnvIUIE,60
164
- agenta-0.19.6a0.dist-info/METADATA,sha256=0uvnsMgJUeCyZC51VbA-_C67WR4gpzEYNfKQ5onan1E,26462
165
- agenta-0.19.6a0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
166
- agenta-0.19.6a0.dist-info/entry_points.txt,sha256=PDiu8_8AsL7ibU9v4iNoOKR1S7F2rdxjlEprjM9QOgo,46
167
- agenta-0.19.6a0.dist-info/RECORD,,
164
+ agenta-0.19.8.dist-info/METADATA,sha256=OAjZGmsi3_b62yrLWwmmtJqRMi_wa9d1vGBRuN_6NRg,26460
165
+ agenta-0.19.8.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
166
+ agenta-0.19.8.dist-info/entry_points.txt,sha256=PDiu8_8AsL7ibU9v4iNoOKR1S7F2rdxjlEprjM9QOgo,46
167
+ agenta-0.19.8.dist-info/RECORD,,