agenta 0.27.0a6__py3-none-any.whl → 0.27.0a8__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/cli/helper.py CHANGED
@@ -15,6 +15,9 @@ import toml
15
15
  from agenta.client.backend.client import AgentaApi
16
16
 
17
17
  BACKEND_URL_SUFFIX = os.environ.get("BACKEND_URL_SUFFIX", "api")
18
+ POSTHOG_KEY = os.environ.get(
19
+ "POSTHOG_KEY", "phc_hmVSxIjTW1REBHXgj2aw4HW9X6CXb6FzerBgP9XenC7"
20
+ )
18
21
 
19
22
 
20
23
  def get_global_config(var_name: str) -> Optional[Any]:
@@ -111,7 +114,8 @@ def init_telemetry_config() -> None:
111
114
  ):
112
115
  set_global_config("telemetry_tracking_enabled", True)
113
116
  set_global_config(
114
- "telemetry_api_key", "phc_hmVSxIjTW1REBHXgj2aw4HW9X6CXb6FzerBgP9XenC7"
117
+ "telemetry_api_key",
118
+ POSTHOG_KEY,
115
119
  )
116
120
 
117
121
 
agenta/sdk/agenta_init.py CHANGED
@@ -31,7 +31,6 @@ class AgentaSingleton:
31
31
  self,
32
32
  *,
33
33
  host: Optional[str] = None,
34
- project_id: Optional[str] = None,
35
34
  api_key: Optional[str] = None,
36
35
  config_fname: Optional[str] = None,
37
36
  #
@@ -84,24 +83,17 @@ class AgentaSingleton:
84
83
  "3. As an environment variable 'AGENTA_APP_ID'."
85
84
  )
86
85
 
87
- self.project_id = (
88
- project_id
89
- or os.environ.get("AGENTA_PROJECT_ID")
90
- or config.get("project_id")
91
- )
92
-
93
86
  self.api_key = (
94
87
  api_key or os.environ.get("AGENTA_API_KEY") or config.get("api_key")
95
88
  )
96
89
 
97
90
  self.tracing = Tracing(
98
- url=f"{self.host}/api/observability/v1/traces", # type: ignore
91
+ url=f"{self.host}/api/observability/v1/otlp/traces", # type: ignore
99
92
  )
100
93
 
101
94
  self.tracing.configure(
102
- project_id=self.project_id,
103
95
  api_key=self.api_key,
104
- # DEPRECATED
96
+ # DEPRECATING
105
97
  app_id=self.app_id,
106
98
  )
107
99
 
@@ -252,7 +244,6 @@ class Config:
252
244
 
253
245
  def init(
254
246
  host: Optional[str] = None,
255
- project_id: Optional[str] = None,
256
247
  api_key: Optional[str] = None,
257
248
  config_fname: Optional[str] = None,
258
249
  # DEPRECATED
@@ -284,7 +275,6 @@ def init(
284
275
 
285
276
  singleton.init(
286
277
  host=host,
287
- project_id=project_id,
288
278
  api_key=api_key,
289
279
  config_fname=config_fname,
290
280
  # DEPRECATED
@@ -161,7 +161,7 @@ class OTelExtraDTO(BaseModel):
161
161
 
162
162
 
163
163
  class SpanDTO(BaseModel):
164
- scope: ProjectScopeDTO
164
+ scope: Optional[ProjectScopeDTO] = None
165
165
 
166
166
  lifecycle: Optional[LifecycleDTO] = None
167
167
 
@@ -755,11 +755,8 @@ def _parse_from_attributes(
755
755
 
756
756
 
757
757
  def parse_from_otel_span_dto(
758
- project_id: str,
759
758
  otel_span_dto: OTelSpanDTO,
760
759
  ) -> SpanDTO:
761
- scope = ProjectScopeDTO(project_id=UUID(project_id))
762
-
763
760
  lifecyle = LifecycleDTO(
764
761
  created_at=datetime.now(),
765
762
  )
@@ -831,7 +828,6 @@ def parse_from_otel_span_dto(
831
828
  )
832
829
 
833
830
  span_dto = SpanDTO(
834
- scope=scope,
835
831
  lifecycle=lifecyle,
836
832
  root=root,
837
833
  tree=tree,
@@ -902,7 +898,6 @@ from opentelemetry.sdk.trace import ReadableSpan
902
898
 
903
899
 
904
900
  def parse_inline_trace(
905
- project_id: str,
906
901
  spans: Dict[str, ReadableSpan],
907
902
  ):
908
903
  otel_span_dtos = _parse_readable_spans(spans)
@@ -911,8 +906,7 @@ def parse_inline_trace(
911
906
  ### apis.fastapi.observability.api.otlp_collect_traces() ###
912
907
  ### ---------------------------------------------------- ###
913
908
  span_dtos = [
914
- parse_from_otel_span_dto(project_id, otel_span_dto)
915
- for otel_span_dto in otel_span_dtos
909
+ parse_from_otel_span_dto(otel_span_dto) for otel_span_dto in otel_span_dtos
916
910
  ]
917
911
  ### ---------------------------------------------------- ###
918
912
  ### apis.fastapi.observability.api.otlp_collect_traces() ###
@@ -2,8 +2,6 @@ from typing import Optional, Any, Dict
2
2
  from enum import Enum
3
3
  from uuid import UUID
4
4
 
5
- # from traceback import format_exc
6
-
7
5
  from httpx import get as check
8
6
 
9
7
  from opentelemetry.trace import (
@@ -38,9 +36,7 @@ class Tracing(metaclass=Singleton):
38
36
  ) -> None:
39
37
  # ENDPOINT (OTLP)
40
38
  self.otlp_url = url
41
- # AUTHENTICATION (OTLP)
42
- self.project_id: Optional[str] = None
43
- # AUTHORIZATION (OTLP)
39
+ # AITH (OTLP)
44
40
  self.api_key: Optional[str] = None
45
41
  # HEADERS (OTLP)
46
42
  self.headers: Dict[str, str] = dict()
@@ -49,6 +45,8 @@ class Tracing(metaclass=Singleton):
49
45
 
50
46
  # TRACER PROVIDER
51
47
  self.tracer_provider: Optional[TracerProvider] = None
48
+ # TRACE PROCESSORS -- INLINE
49
+ self.inline: Optional[TraceProcessor] = None
52
50
  # TRACER
53
51
  self.tracer: Optional[Tracer] = None
54
52
  # INLINE SPANS for INLINE TRACES (INLINE PROCESSOR)
@@ -58,25 +56,18 @@ class Tracing(metaclass=Singleton):
58
56
 
59
57
  def configure(
60
58
  self,
61
- project_id: Optional[str] = None,
62
59
  api_key: Optional[str] = None,
63
60
  # DEPRECATING
64
61
  app_id: Optional[str] = None,
65
62
  ):
66
- # AUTHENTICATION (OTLP)
67
- self.project_id = project_id # "f7943e42-ec69-498e-bf58-8db034b9286e"
68
- self.app_id = app_id
69
- # AUTHORIZATION (OTLP)
63
+ # AUTH (OTLP)
70
64
  self.api_key = api_key
71
65
  # HEADERS (OTLP)
72
66
  self.headers = {}
73
- if project_id:
74
- self.headers.update(**{"AG-PROJECT-ID": project_id})
75
67
  if app_id:
76
68
  self.headers.update(**{"AG-APP-ID": app_id})
77
69
  if api_key:
78
70
  self.headers.update(**{"Authorization": self.api_key})
79
-
80
71
  # REFERENCES
81
72
  self.references["application.id"] = app_id
82
73
 
@@ -95,7 +86,10 @@ class Tracing(metaclass=Singleton):
95
86
  # TRACE PROCESSORS -- OTLP
96
87
  try:
97
88
  log.info("--------------------------------------------")
98
- log.info(f"Agenta SDK - connecting to otlp receiver at: {self.otlp_url}")
89
+ log.info(
90
+ "Agenta SDK - connecting to otlp receiver at: %s",
91
+ self.otlp_url,
92
+ )
99
93
  log.info("--------------------------------------------")
100
94
 
101
95
  check(
@@ -114,13 +108,11 @@ class Tracing(metaclass=Singleton):
114
108
 
115
109
  self.tracer_provider.add_span_processor(_otlp)
116
110
 
117
- log.info(f"Success: traces will be exported.")
111
+ log.info("Success: traces will be exported.")
118
112
  log.info("--------------------------------------------")
119
113
 
120
- except:
121
- # log.warning(format_exc().strip("\n"))
122
- # log.warning("--------------------------------------------")
123
- log.warning(f"Failure: traces will not be exported.")
114
+ except: # pylint: disable=bare-except
115
+ log.warning("Failure: traces will not be exported.")
124
116
  log.warning("--------------------------------------------")
125
117
 
126
118
  # GLOBAL TRACER PROVIDER -- INSTRUMENTATION LIBRARIES
@@ -163,12 +155,12 @@ class Tracing(metaclass=Singleton):
163
155
  span = self.get_current_span()
164
156
 
165
157
  for key in refs.keys():
166
- if key in Reference:
158
+ if key in [_.value for _ in Reference.__members__.values()]:
167
159
  # TYPE AND FORMAT CHECKING
168
160
  if key.endswith(".id"):
169
161
  try:
170
162
  refs[key] = str(UUID(refs[key]))
171
- except:
163
+ except: # pylint: disable=bare-except
172
164
  refs[key] = None
173
165
 
174
166
  refs[key] = str(refs[key])
@@ -243,14 +235,14 @@ class Tracing(metaclass=Singleton):
243
235
  otel_spans = self.inline.fetch(trace_id)
244
236
 
245
237
  if otel_spans:
246
- _inline_trace = parse_inline_trace(
247
- self.project_id or self.app_id, otel_spans
248
- )
238
+ _inline_trace = parse_inline_trace(otel_spans)
249
239
 
250
240
  return _inline_trace
251
241
 
252
242
 
253
- def get_tracer(tracing: Tracing) -> Tracer:
243
+ def get_tracer(
244
+ tracing: Tracing,
245
+ ) -> Tracer:
254
246
  if tracing is None or tracing.tracer is None or tracing.tracer_provider is None:
255
247
  return get_tracer_provider().get_tracer("default.tracer")
256
248
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: agenta
3
- Version: 0.27.0a6
3
+ Version: 0.27.0a8
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
@@ -1,6 +1,6 @@
1
1
  agenta/__init__.py,sha256=6NgtqH14bL5M25Kqy2F8KueChz1snciKiIxho__i_UI,970
2
2
  agenta/cli/evaluation_commands.py,sha256=fs6492tprPId9p8eGO02Xy-NCBm2RZNJLZWcUxugwd8,474
3
- agenta/cli/helper.py,sha256=vRxHyeNaltzNIGrfU2vO0H28_rXDzx9QqIZ_S-W6zL4,6212
3
+ agenta/cli/helper.py,sha256=P97HbNb_qzOyl5CM_MjAqWEBCdgebU6M81G_4UCmF1A,6288
4
4
  agenta/cli/main.py,sha256=Wz0ODhoeKK3Qg_CFUhu6D909szk05tc8ZVBB6H1-w7k,9763
5
5
  agenta/cli/telemetry.py,sha256=GaFFRsE_NtrcSSJ10r2jhgFs5Sk8gf2C09Ox3gOr3eU,1317
6
6
  agenta/cli/variant_commands.py,sha256=HfKRZsajKOXwZD2OyzjSfNtSx1yI01wI1cfqpvoHETI,17400
@@ -133,7 +133,7 @@ agenta/docker/docker-assets/lambda_function.py,sha256=h4UZSSfqwpfsCgERv6frqwm_4J
133
133
  agenta/docker/docker-assets/main.py,sha256=7MI-21n81U7N7A0GxebNi0cmGWtJKcR2sPB6FcH2QfA,251
134
134
  agenta/docker/docker_utils.py,sha256=kO1q2_IR0fEAo4M-2Pt_v-zC7GxxnkLogjKFhU869Ps,3555
135
135
  agenta/sdk/__init__.py,sha256=IopYEonqvpdGXsAYh2wQ4Ai_2YzsY7aF88wTzrclV4M,1208
136
- agenta/sdk/agenta_init.py,sha256=hBE78BIu6QFfvaxWY2x7Y7EXAFKx6TSPEtEj2S6qWNU,10606
136
+ agenta/sdk/agenta_init.py,sha256=vQcaWvvrMR6xMNJvX6V-9eNIvx3_JsjPA6xcxiahX30,10308
137
137
  agenta/sdk/assets.py,sha256=Zv4i8MVUSB3jMODQon1mzJtYxuntmrCNjLGk8f-2fls,2856
138
138
  agenta/sdk/client.py,sha256=trKyBOYFZRk0v5Eptxvh87yPf50Y9CqY6Qgv4Fy-VH4,2142
139
139
  agenta/sdk/config_manager.py,sha256=HFOJpJKBkhlA0C-KPuxb4-bHNZeZqdpmx_beoX4lQw8,7997
@@ -151,10 +151,10 @@ agenta/sdk/tracing/attributes.py,sha256=zh8JQZSeYCLBeIRSopKJx6QQ-WEgw08Cr64DS_WO
151
151
  agenta/sdk/tracing/context.py,sha256=PSJdhcaOXSMAuGUBySpLKPKyx8duF3TJzhUEk2ufqPc,777
152
152
  agenta/sdk/tracing/conventions.py,sha256=JBtznBXZ3aRkGKkLl7cPwdMNh3w1G-H2Ta2YrAxbr38,950
153
153
  agenta/sdk/tracing/exporters.py,sha256=LzNGjOARwRrJ5gTFjdG9ziZlqnA0WeMjpkUfpsl8BSs,1383
154
- agenta/sdk/tracing/inline.py,sha256=imtlQ0rqfX1rD-SYo1YVAZCctRjxZskdfeA1Pm__wcw,32980
154
+ agenta/sdk/tracing/inline.py,sha256=0ZLy89k5wkmTUaz69vqc3vP51ZdqmLGMj3Qz2o3hieE,32856
155
155
  agenta/sdk/tracing/processors.py,sha256=uqH8AKdRJkv-MY5FcTD-Qrrr0ARMlAAsImPPKolteQ0,2444
156
156
  agenta/sdk/tracing/spans.py,sha256=nqUOjjirBxB8Eacv8Qj4Ra_6rknGi3lbJdNyKmk5ODQ,3707
157
- agenta/sdk/tracing/tracing.py,sha256=g8LKWOLdeEM6HifrmZAdVYi31-sNFAamioaVwUQ-qrs,7712
157
+ agenta/sdk/tracing/tracing.py,sha256=S-7rt1LMHCF3YzV1XzAnhdkeocCffj9CCwlHScU7mqU,7350
158
158
  agenta/sdk/types.py,sha256=B7C7Jpeq0CpmLwmN1dmpggJsZX8WpxyyM42PkdSsx3s,5669
159
159
  agenta/sdk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
160
160
  agenta/sdk/utils/costs.py,sha256=i8C7ud__pThLS55XkN4YW8czXtGeXr2mx7jjcOFeiXg,5955
@@ -179,7 +179,7 @@ agenta/templates/simple_prompt/app.py,sha256=kODgF6lhzsaJPdgL5b21bUki6jkvqjWZzWR
179
179
  agenta/templates/simple_prompt/env.example,sha256=g9AE5bYcGPpxawXMJ96gh8oenEPCHTabsiOnfQo3c5k,70
180
180
  agenta/templates/simple_prompt/requirements.txt,sha256=ywRglRy7pPkw8bljmMEJJ4aOOQKrt9FGKULZ-DGkoBU,23
181
181
  agenta/templates/simple_prompt/template.toml,sha256=DQBtRrF4GU8LBEXOZ-GGuINXMQDKGTEG5y37tnvIUIE,60
182
- agenta-0.27.0a6.dist-info/METADATA,sha256=P8n7lccwkGHLB_YYeKmr_mpCr41oqW4eC_QRJC8PrXs,31738
183
- agenta-0.27.0a6.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
184
- agenta-0.27.0a6.dist-info/entry_points.txt,sha256=PDiu8_8AsL7ibU9v4iNoOKR1S7F2rdxjlEprjM9QOgo,46
185
- agenta-0.27.0a6.dist-info/RECORD,,
182
+ agenta-0.27.0a8.dist-info/METADATA,sha256=HDnjYrKr75LSj7gY05n9EzkuNi_y7wqCR8I7Tscm44o,31738
183
+ agenta-0.27.0a8.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
184
+ agenta-0.27.0a8.dist-info/entry_points.txt,sha256=PDiu8_8AsL7ibU9v4iNoOKR1S7F2rdxjlEprjM9QOgo,46
185
+ agenta-0.27.0a8.dist-info/RECORD,,