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

@@ -5,7 +5,6 @@ from itertools import chain
5
5
  from inspect import iscoroutinefunction, getfullargspec
6
6
 
7
7
  from opentelemetry import baggage
8
- from opentelemetry.trace import NonRecordingSpan
9
8
  from opentelemetry.context import attach, detach, get_current
10
9
  from opentelemetry.baggage import set_baggage, get_all
11
10
 
@@ -13,7 +12,6 @@ from agenta.sdk.utils.exceptions import suppress
13
12
  from agenta.sdk.context.tracing import tracing_context
14
13
  from agenta.sdk.tracing.conventions import parse_span_kind
15
14
 
16
-
17
15
  from agenta.sdk.utils.logging import get_module_logger
18
16
 
19
17
  import agenta as ag
@@ -62,7 +60,7 @@ class instrument: # pylint: disable=invalid-name
62
60
  name=func.__name__,
63
61
  kind=self.kind,
64
62
  context=ctx,
65
- ) as span:
63
+ ):
66
64
  self._set_link()
67
65
 
68
66
  self._pre_instrument(func, *args, **kwargs)
@@ -90,7 +88,7 @@ class instrument: # pylint: disable=invalid-name
90
88
  name=func.__name__,
91
89
  kind=self.kind,
92
90
  context=ctx,
93
- ) as span:
91
+ ):
94
92
  self._set_link()
95
93
 
96
94
  self._pre_instrument(func, *args, **kwargs)
@@ -34,16 +34,12 @@ class TraceProcessor(SpanProcessor):
34
34
  self.references = references or dict()
35
35
  self.inline = inline is True
36
36
 
37
- # --- INLINE
38
- if self.inline:
39
- self._registry = dict()
40
- self._exporter = span_exporter
41
- self._spans: Dict[int, List[ReadableSpan]] = dict()
42
- # --- INLINE
37
+ self._registry = dict()
38
+ self._exporter = span_exporter
39
+ self._spans: Dict[int, List[ReadableSpan]] = dict()
43
40
 
44
41
  # --- DISTRIBUTED
45
- else:
46
- # Use composition instead of inheritance to avoid relying on BatchSpanProcessor internals
42
+ if not self.inline:
47
43
  self._delegate = BatchSpanProcessor(
48
44
  span_exporter,
49
45
  max_queue_size or _DEFAULT_MAX_QUEUE_SIZE,
@@ -69,48 +65,39 @@ class TraceProcessor(SpanProcessor):
69
65
  if _key in [_.value for _ in Reference.__members__.values()]:
70
66
  span.set_attribute(key, baggage[key])
71
67
 
72
- # --- INLINE
73
- if self.inline:
74
- if span.context.trace_id not in self._registry:
75
- self._registry[span.context.trace_id] = dict()
68
+ trace_id = span.context.trace_id
69
+ span_id = span.context.span_id
76
70
 
77
- self._registry[span.context.trace_id][span.context.span_id] = True
78
- # --- INLINE
71
+ self._registry.setdefault(trace_id, {})
72
+ self._registry[trace_id][span_id] = True
79
73
 
80
74
  def on_end(
81
75
  self,
82
76
  span: ReadableSpan,
83
77
  ):
84
- # --- INLINE
85
- if self.inline:
86
- if span.context.trace_id not in self._spans:
87
- self._spans[span.context.trace_id] = list()
88
-
89
- self._spans[span.context.trace_id].append(span)
78
+ trace_id = span.context.trace_id
79
+ span_id = span.context.span_id
90
80
 
91
- del self._registry[span.context.trace_id][span.context.span_id]
81
+ self._spans.setdefault(trace_id, []).append(span)
82
+ self._registry.setdefault(trace_id, {})
83
+ self._registry[trace_id].pop(span_id, None)
92
84
 
93
- if len(self._registry[span.context.trace_id]) == 0:
94
- self.export(span.context.trace_id)
95
- # --- INLINE
96
-
97
- # --- DISTRIBUTED
98
- else:
99
- self._delegate.on_end(span)
100
- # --- DISTRIBUTED
85
+ if not self._registry[trace_id]:
86
+ spans = self._spans.pop(trace_id, [])
87
+ self._registry.pop(trace_id, None)
101
88
 
102
- def export(
103
- self,
104
- trace_id: int,
105
- ):
106
- # --- INLINE
107
- if self.inline:
108
- spans = self._spans[trace_id]
89
+ # --- INLINE
90
+ if self.inline:
91
+ self._exporter.export(spans)
92
+ # --- INLINE
109
93
 
110
- self._exporter.export(spans)
94
+ # --- DISTRIBUTED
95
+ else:
96
+ for span in spans:
97
+ self._delegate.on_end(span)
111
98
 
112
- del self._spans[trace_id]
113
- # --- INLINE
99
+ self._delegate.force_flush()
100
+ # --- DISTRIBUTED
114
101
 
115
102
  def force_flush(
116
103
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: agenta
3
- Version: 0.48.7
3
+ Version: 0.48.9
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
@@ -177,7 +177,7 @@ git clone https://github.com/Agenta-AI/agenta && cd agenta
177
177
 
178
178
  2. Start Agenta services:
179
179
  ```bash
180
- docker compose -f hosting/docker-compose/oss/docker-compose.gh.yml --env-file hosting/docker-compose/oss/.env.oss.gh --profile with-web up -d
180
+ docker compose -f hosting/docker-compose/oss/docker-compose.gh.yml --env-file hosting/docker-compose/oss/.env.oss.gh --profile with-web --profile with-traefik up -d
181
181
  ```
182
182
 
183
183
  3. Access Agenta at `http://localhost`.
@@ -207,7 +207,7 @@ agenta/sdk/context/routing.py,sha256=FEsjw8EttI1SMyUo96ptcUsvHJnhoKwdr1szlkxxJNU
207
207
  agenta/sdk/context/tracing.py,sha256=xjErrXP1Nq1AfL-Cif1l-lNEfs12eQ3v_VCRgoKe7nY,743
208
208
  agenta/sdk/decorators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
209
209
  agenta/sdk/decorators/routing.py,sha256=L3o0Q9flBfb2UIfCIx0OWzkP0W-45_GQ3-Ri8phwNlU,25678
210
- agenta/sdk/decorators/tracing.py,sha256=pABMVFtqD99W3ErqWDFUmymmXiXdzhdAJG01l-CTLVQ,10110
210
+ agenta/sdk/decorators/tracing.py,sha256=6xwN9AomDND_5wL21NXFoZsdwTBuITw2I39GNqNGD-4,10044
211
211
  agenta/sdk/litellm/__init__.py,sha256=Bpz1gfHQc0MN1yolWcjifLWznv6GjHggvRGQSpxpihM,37
212
212
  agenta/sdk/litellm/litellm.py,sha256=dCjw0H_jD3L3UQ3l9SbLm5dfeIGnel6dPtQYJ78beYM,10202
213
213
  agenta/sdk/litellm/mockllm.py,sha256=PG3DF2ZjWHOtCt8WIU3qcSyXBOZspUX1FIyFMA9HuZM,902
@@ -234,7 +234,7 @@ agenta/sdk/tracing/attributes.py,sha256=DwjjOk3mGOvz0jYu8EYr3hhItvawK5GX80_Mfciq
234
234
  agenta/sdk/tracing/conventions.py,sha256=JBtznBXZ3aRkGKkLl7cPwdMNh3w1G-H2Ta2YrAxbr38,950
235
235
  agenta/sdk/tracing/exporters.py,sha256=Vs1aQLRrWvYgWxjPmlfBWTN4wmUzBREqjTdIV1XcV9o,3251
236
236
  agenta/sdk/tracing/inline.py,sha256=ShPAAjk_26I4hgrmC6y0n-I9gxB3Q4VeEYhhsLHInPU,31454
237
- agenta/sdk/tracing/processors.py,sha256=wweg31mAWiytFPsjPP3zTDqFidjLzyFXNVdXBt1o3Sw,5748
237
+ agenta/sdk/tracing/processors.py,sha256=wZWF8vTEouhbGxbfPGXVQJI53CcXFByqxHiCSIzJV-4,5407
238
238
  agenta/sdk/tracing/propagation.py,sha256=EeOqDMqnh_MoEhGd1do_vy_tQBYUcoC8kpLqVoZeqg0,2561
239
239
  agenta/sdk/tracing/spans.py,sha256=nqUOjjirBxB8Eacv8Qj4Ra_6rknGi3lbJdNyKmk5ODQ,3707
240
240
  agenta/sdk/tracing/tracing.py,sha256=Yv42drWc2tVu4YugHKWYsgTSf1y7Y9boYL8akxKT4eA,9503
@@ -250,6 +250,6 @@ agenta/sdk/utils/logging.py,sha256=j4NzpFk2ilOM10sRBOxCjmansDHSx6HwMV8IAEreRb8,8
250
250
  agenta/sdk/utils/preinit.py,sha256=1TAAHhYyYnLLwvzwnf33Qwkou7tI3iITlVt-1kcyGaM,1186
251
251
  agenta/sdk/utils/singleton.py,sha256=17Ph7LGnnV8HkPjImruKita2ni03Ari5jr0jqm__4sc,312
252
252
  agenta/sdk/utils/timing.py,sha256=nZR-kudVUtKFlHuBhztgSGxj7FVnCB4Uv6sfg-1dkrQ,1556
253
- agenta-0.48.7.dist-info/METADATA,sha256=n5d-_1uPyyt92NsHqNQkuzmCaTqLVeWQKxpG27VBB9M,31433
254
- agenta-0.48.7.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
255
- agenta-0.48.7.dist-info/RECORD,,
253
+ agenta-0.48.9.dist-info/METADATA,sha256=BhII-ix_CJcWaYXCF5aVdHbm9-HlRpqxj3wr6BGavII,31456
254
+ agenta-0.48.9.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
255
+ agenta-0.48.9.dist-info/RECORD,,