agenta 0.15.0a1__py3-none-any.whl → 0.15.0a3__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.

@@ -2,7 +2,7 @@ FROM public.ecr.aws/s2t9a1r1/agentaai/lambda_templates_public:main
2
2
 
3
3
  COPY requirements.txt ${LAMBDA_TASK_ROOT}
4
4
  RUN pip install --no-cache-dir --disable-pip-version-check -U agenta
5
- RUN pip install --no-cache-dir --disable-pip-version-check -r requirements.txt
5
+ RUN pip install --no-cache-dir --disable-pip-version-check -U -r requirements.txt
6
6
  RUN pip install --no-cache-dir --disable-pip-version-check mangum
7
7
  COPY . ${LAMBDA_TASK_ROOT}
8
8
 
agenta/sdk/agenta_init.py CHANGED
@@ -12,6 +12,19 @@ logger = logging.getLogger(__name__)
12
12
  logger.setLevel(logging.DEBUG)
13
13
 
14
14
 
15
+ BACKEND_URL_SUFFIX = os.environ.get("BACKEND_URL_SUFFIX", "api")
16
+ CLIENT_API_KEY = os.environ.get("AGENTA_API_KEY")
17
+ CLIENT_HOST = os.environ.get("AGENTA_HOST", "http://localhost")
18
+
19
+
20
+ # initialize the client with the backend url and api key
21
+ backend_url = f"{CLIENT_HOST}/{BACKEND_URL_SUFFIX}"
22
+ client = AgentaApi(
23
+ base_url=backend_url,
24
+ api_key=CLIENT_API_KEY if CLIENT_API_KEY else "",
25
+ )
26
+
27
+
15
28
  class AgentaSingleton:
16
29
  """Singleton class to save all the "global variables" for the sdk."""
17
30
 
@@ -56,9 +69,6 @@ class AgentaSingleton:
56
69
  ValueError: If `app_name`, `base_name`, or `host` are not specified either as arguments or in the environment variables.
57
70
  """
58
71
 
59
- self.api_key = api_key or os.environ.get("AGENTA_API_KEY")
60
- self.host = host or os.environ.get("AGENTA_HOST", "http://localhost")
61
-
62
72
  app_id = app_id or os.environ.get("AGENTA_APP_ID")
63
73
  if not app_id:
64
74
  raise ValueError("App ID must be specified.")
@@ -79,12 +89,14 @@ class AgentaSingleton:
79
89
 
80
90
  self.app_id = app_id
81
91
  self.base_id = base_id
92
+ self.host = host
93
+ self.api_key = api_key or ""
82
94
  self.variant_id = os.environ.get("AGENTA_VARIANT_ID")
83
95
  self.variant_name = os.environ.get("AGENTA_VARIANT_NAME")
84
- self.config = Config(base_id=self.base_id, host=self.host, api_key=self.api_key) # type: ignore
96
+ self.config = Config(base_id=self.base_id, host=self.host) # type: ignore
85
97
 
86
98
  def get_app_base(self, app_id: str, base_name: str) -> str:
87
- bases = self.client.bases.list_bases(app_id=app_id, base_name=base_name)
99
+ bases = client.bases.list_bases(app_id=app_id, base_name=base_name)
88
100
  if len(bases) == 0:
89
101
  raise APIRequestError(f"No base was found for the app {app_id}")
90
102
  return bases[0].base_id
@@ -100,26 +112,15 @@ class AgentaSingleton:
100
112
 
101
113
 
102
114
  class Config:
103
- def __init__(self, base_id: str, host: str, api_key: str):
115
+ def __init__(self, base_id: str, host: str):
104
116
  self.base_id = base_id
105
117
  self.host = host
106
- self.api_key = api_key
107
118
 
108
119
  if base_id is None or host is None:
109
120
  self.persist = False
110
121
  else:
111
122
  self.persist = True
112
123
 
113
- @property
114
- def client(self):
115
- """API Backend client.
116
-
117
- Returns:
118
- AgentaAPI: instance of agenta api backend
119
- """
120
-
121
- return AgentaApi(base_url=self.host + "/api", api_key=self.api_key)
122
-
123
124
  def register_default(self, overwrite=False, **kwargs):
124
125
  """alias for default"""
125
126
  return self.default(overwrite=overwrite, **kwargs)
@@ -150,7 +151,7 @@ class Config:
150
151
  if not self.persist:
151
152
  return
152
153
  try:
153
- self.client.configs.save_config(
154
+ client.configs.save_config(
154
155
  base_id=self.base_id,
155
156
  config_name=config_name,
156
157
  parameters=kwargs,
@@ -174,12 +175,12 @@ class Config:
174
175
  if self.persist:
175
176
  try:
176
177
  if environment_name:
177
- config = self.client.configs.get_config(
178
+ config = client.configs.get_config(
178
179
  base_id=self.base_id, environment_name=environment_name
179
180
  )
180
181
 
181
182
  else:
182
- config = self.client.configs.get_config(
183
+ config = client.configs.get_config(
183
184
  base_id=self.base_id,
184
185
  config_name=config_name,
185
186
  )
@@ -244,7 +245,7 @@ def init(
244
245
  app_id=singleton.app_id, # type: ignore
245
246
  variant_id=singleton.variant_id, # type: ignore
246
247
  variant_name=singleton.variant_name,
247
- api_key=singleton.api_key,
248
+ api_key=api_key,
248
249
  max_workers=max_workers,
249
250
  )
250
251
  set_global(setup=singleton.setup, config=singleton.config, tracing=tracing)
@@ -82,7 +82,7 @@ class entrypoint(BaseDecorator):
82
82
 
83
83
  # Set the configuration and environment of the LLM app parent span at run-time
84
84
  agenta.tracing.set_span_attribute(
85
- {"config": config_params, "environment": "playground"}
85
+ {"config": config_params, "environment": "playground"}
86
86
  )
87
87
 
88
88
  llm_result = await self.execute_function(
@@ -105,7 +105,7 @@ class entrypoint(BaseDecorator):
105
105
 
106
106
  # Set the configuration and environment of the LLM app parent span at run-time
107
107
  agenta.tracing.set_span_attribute(
108
- {"config": config_params, "environment": kwargs["environment"]}
108
+ {"config": config_params, "environment": kwargs["environment"]}
109
109
  )
110
110
 
111
111
  llm_result = await self.execute_function(
@@ -391,8 +391,8 @@ class entrypoint(BaseDecorator):
391
391
 
392
392
  # Set the configuration and environment of the LLM app parent span at run-time
393
393
  agenta.tracing.set_span_attribute(
394
- {"config": agenta.config.all(), "environment": "bash"}
395
- )
394
+ {"config": agenta.config.all(), "environment": "bash"}
395
+ )
396
396
 
397
397
  loop = asyncio.get_event_loop()
398
398
  result = loop.run_until_complete(
@@ -76,7 +76,9 @@ class Tracing(metaclass=SingletonMeta):
76
76
  self.active_trace_id: Optional[str] = None
77
77
  self.pending_spans: List[CreateSpan] = []
78
78
  self.tags: List[str] = []
79
- self.trace_config_cache: Dict[str, Any] = {} # used to save the trace configuration before starting the first span
79
+ self.trace_config_cache: Dict[
80
+ str, Any
81
+ ] = {} # used to save the trace configuration before starting the first span
80
82
  self.span_dict: Dict[str, CreateSpan] = {} # type: ignore
81
83
 
82
84
  @property
@@ -95,7 +97,9 @@ class Tracing(metaclass=SingletonMeta):
95
97
  self,
96
98
  attributes: Dict[str, Any] = {},
97
99
  ):
98
- if self.active_span is None: # This is the case where entrypoint wants to save the trace information but the parent span has not been initialized yet
100
+ if (
101
+ self.active_span is None
102
+ ): # This is the case where entrypoint wants to save the trace information but the parent span has not been initialized yet
99
103
  for key, value in attributes.items():
100
104
  self.trace_config_cache[key] = value
101
105
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: agenta
3
- Version: 0.15.0a1
3
+ Version: 0.15.0a3
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
@@ -119,7 +119,7 @@ agenta/client/client.py,sha256=DWOGS9A8u4wu28s9jGOR4eRhf7vo4zT7GyDvrIGu59Y,19648
119
119
  agenta/client/exceptions.py,sha256=cxLjjKvZKlUgBxt4Vn9J_SsezJPPNHvrZxnoq-D6zmw,94
120
120
  agenta/config.py,sha256=Id-Ie1yf9QRP1YPhRYaYSOruRe6RBrsCXkG9rAa-ZtA,732
121
121
  agenta/config.toml,sha256=ptE0P49bwsu3Luyn7OLFmk2buPhj5D-MA-O_ErOGoLg,223
122
- agenta/docker/docker-assets/Dockerfile.cloud.template,sha256=uJuXKvtkMY6f4KaOh3XE5pmuJR7mfZEXJk_8hj2uatc,386
122
+ agenta/docker/docker-assets/Dockerfile.cloud.template,sha256=Mn9g7bTQSnPXcCLZo-iVirV3cveCQHC_F7IECQufmME,389
123
123
  agenta/docker/docker-assets/Dockerfile.template,sha256=aVA_okx0xXalcTvdQGhSfzSjNpQZVoLJCGYA39-2Nwk,280
124
124
  agenta/docker/docker-assets/README.md,sha256=XHxwh2ks_ozrtAU7SLbL3J14SB2holG6buoTxwmMiZM,102
125
125
  agenta/docker/docker-assets/entrypoint.sh,sha256=29XK8VQjQsx4hN2j-4JDy-6kQb5y4LCqZEa7PD4eqCQ,74
@@ -127,15 +127,15 @@ 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=o1Dn2oCr7qpg7SYk9l9RlZHwxfpWNzJpdpj8IGE0lz0,3508
129
129
  agenta/sdk/__init__.py,sha256=oHgl-qoEyi3d2VI_Kv-rIMSx9zgs6b5MP62PLq5GqYI,762
130
- agenta/sdk/agenta_init.py,sha256=2iU8POiedmWL34_DgeXk38n0kN3MWlrGOruRsvd66Yw,8843
130
+ agenta/sdk/agenta_init.py,sha256=CGttzScnB64IgyUQ-atz9RgWyWcAiKx5FXfowVuRsmg,8827
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=aW78CMpAVQ5YWQuDAgfjlqyXY5LHUmS4LQukJqhxNB0,19531
134
+ agenta/sdk/decorators/llm_entrypoint.py,sha256=rdtehr_OmLz-fIZqHWfKxir6GhwkDeI1Of3BcQlkzpc,19526
135
135
  agenta/sdk/decorators/tracing.py,sha256=-QrchKPjFjYbIau5bw1hlUyOcX4kdOzjVQ79KE4iwmw,2800
136
136
  agenta/sdk/router.py,sha256=0sbajvn5C7t18anH6yNo7-oYxldHnYfwcbmQnIXBePw,269
137
137
  agenta/sdk/tracing/context_manager.py,sha256=HskDaiORoOhjeN375gm05wYnieQzh5UnoIsnSAHkAyc,252
138
- agenta/sdk/tracing/llm_tracing.py,sha256=RxMVO5xynk3FWpl5CFAQFEohUlhb1WoUqSze1BgtL-4,8140
138
+ agenta/sdk/tracing/llm_tracing.py,sha256=JbrcHBwmHA_7EVgWGM3fatz4jYeKJJDXyu8qH3Q2LUE,8186
139
139
  agenta/sdk/tracing/logger.py,sha256=4zG9c51p8xPdKA5SL8MOgBfkpCnBSuV6JfWiXO0A7oc,473
140
140
  agenta/sdk/tracing/tasks_manager.py,sha256=ROrWIaqS2J2HHiJtRWiHKlLY8CCsqToP5VeXu7mamck,3748
141
141
  agenta/sdk/types.py,sha256=Mn0yBlHh_Yr_5oQXUfsYI3V7sJAVWkJgkxEOBDOOMS0,5852
@@ -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.15.0a1.dist-info/METADATA,sha256=MVIjIlEt-YrAzqRdO5mg7JzGx_R9BD-60QkNmiK39Rw,26465
161
- agenta-0.15.0a1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
162
- agenta-0.15.0a1.dist-info/entry_points.txt,sha256=PDiu8_8AsL7ibU9v4iNoOKR1S7F2rdxjlEprjM9QOgo,46
163
- agenta-0.15.0a1.dist-info/RECORD,,
160
+ agenta-0.15.0a3.dist-info/METADATA,sha256=f8bhz2NNW-TAfzwpy9mEMSPYA9UX2M3Sm9D43woToM4,26465
161
+ agenta-0.15.0a3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
162
+ agenta-0.15.0a3.dist-info/entry_points.txt,sha256=PDiu8_8AsL7ibU9v4iNoOKR1S7F2rdxjlEprjM9QOgo,46
163
+ agenta-0.15.0a3.dist-info/RECORD,,