agenta 0.59.7__py3-none-any.whl → 0.59.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.

@@ -119,11 +119,16 @@ class SecretsManager:
119
119
  # The reason is that custom providers are in fact openai compatible providers
120
120
  # They need to be passed in litellm as openai/modelname
121
121
 
122
- if "custom" in model:
123
- modified_model = model.replace(f"{provider_slug}/custom/", "openai/")
124
- return modified_model.replace(f"{provider_slug}/", "")
122
+ modified_model = model
125
123
 
126
- return model.replace(f"{provider_slug}/", "")
124
+ if "custom" in modified_model:
125
+ modified_model = modified_model.replace(
126
+ f"{provider_slug}/custom/", "openai/"
127
+ )
128
+
129
+ modified_model = modified_model.replace(f"{provider_slug}/", "")
130
+
131
+ return modified_model
127
132
 
128
133
  @staticmethod
129
134
  def get_provider_settings(model: str) -> Optional[Dict]:
@@ -137,6 +142,8 @@ class SecretsManager:
137
142
  Dict: A dictionary containing all parameters needed for litellm.completion
138
143
  """
139
144
 
145
+ request_provider_model = model
146
+
140
147
  # STEP 1: get vault secrets from route context and transform it
141
148
  secrets = SecretsManager.get_from_route()
142
149
  if not secrets:
@@ -146,11 +153,11 @@ class SecretsManager:
146
153
  secrets = SecretsManager._parse_secrets(secrets=secrets)
147
154
 
148
155
  # STEP 2: check model exists in supported standard models
149
- provider = _standard_providers.get(model)
156
+ provider = _standard_providers.get(request_provider_model)
150
157
  if not provider:
151
158
  # check and get provider kind if model exists in custom provider models
152
159
  provider = SecretsManager._custom_providers_get(
153
- model=model,
160
+ model=request_provider_model,
154
161
  secrets=secrets,
155
162
  )
156
163
 
@@ -159,16 +166,19 @@ class SecretsManager:
159
166
  return None
160
167
 
161
168
  # STEP 2c: get litellm compatible model
162
- provider_slug = SecretsManager._custom_provider_slug_get(
163
- model=model, secrets=secrets
169
+ request_provider_slug = (
170
+ SecretsManager._custom_provider_slug_get(
171
+ model=request_provider_model, secrets=secrets
172
+ )
173
+ or ""
164
174
  )
165
- model = SecretsManager._get_compatible_model(
166
- model=model, provider_slug=provider_slug
175
+ compatible_provider_model = SecretsManager._get_compatible_model(
176
+ model=request_provider_model, provider_slug=request_provider_slug
167
177
  )
168
178
 
169
179
  # STEP 3: initialize provider settings and simplify provider name
170
- provider_settings = {"model": model}
171
- provider_name = re.sub(
180
+ provider_settings = dict(model=compatible_provider_model)
181
+ request_provider_kind = re.sub(
172
182
  r"[\s-]+", "", provider.lower()
173
183
  ) # normalizing other special characters too (azure-openai)
174
184
 
@@ -180,9 +190,9 @@ class SecretsManager:
180
190
  # i). Extract API key if present
181
191
  # (for standard models -- openai/anthropic/gemini, etc)
182
192
  if secret.get("kind") == "provider_key":
183
- provider_kind = secret_data.get("kind", "")
193
+ secret_provider_kind = secret_data.get("kind", "")
184
194
 
185
- if provider_kind == provider_name:
195
+ if request_provider_kind == secret_provider_kind:
186
196
  if "key" in provider_info:
187
197
  provider_settings["api_key"] = provider_info["key"]
188
198
  continue
@@ -190,13 +200,20 @@ class SecretsManager:
190
200
  # ii). Extract Credentials if present
191
201
  # (for custom providers -- aws bedrock/sagemaker, vertex_ai, etc)
192
202
  elif secret.get("kind") == "custom_provider":
193
- provider_kind = provider_info.get("kind", "").lower().replace(" ", "")
194
- provider_slug = secret_data.get("provider_slug", "")
195
- provider_extras = provider_info.get("extras", {})
196
-
197
- if provider_kind == provider_name or provider_slug == provider_name:
198
- if provider_extras:
199
- provider_settings.update(provider_extras)
203
+ secret_provider_kind = (
204
+ provider_info.get("kind", "").lower().replace(" ", "")
205
+ )
206
+ secret_provider_slug = secret_data.get("provider_slug", "")
207
+ secret_provider_models = secret_data.get("models", "")
208
+ secret_provider_extras = provider_info.get("extras", {})
209
+
210
+ if (
211
+ request_provider_kind == secret_provider_kind
212
+ and request_provider_slug == secret_provider_slug
213
+ and request_provider_model in secret_provider_models
214
+ ):
215
+ if secret_provider_extras:
216
+ provider_settings.update(secret_provider_extras)
200
217
  continue
201
218
 
202
219
  return provider_settings
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agenta
3
- Version: 0.59.7
3
+ Version: 0.59.8
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
@@ -324,7 +324,7 @@ agenta/sdk/managers/__init__.py,sha256=SN-LRwG0pRRDV3u2Q4JiiSTigN3-mYpzGNM35RzT4
324
324
  agenta/sdk/managers/apps.py,sha256=BeAlTJlOOM0Wh_XWgjve65Mt-LwFgib_swu-1wvGQi4,2250
325
325
  agenta/sdk/managers/config.py,sha256=yyFxjZVf3_XfNAkZpl-qWzljYz4XB8LgPYc55JXEwG0,7494
326
326
  agenta/sdk/managers/deployment.py,sha256=SEokjZeh6n7HRKZ92Y0WncdG49hIFx-Z3B3HAl2kmUg,1174
327
- agenta/sdk/managers/secrets.py,sha256=3fd-WKJo2vs8dA_Nk4NLqf8RYG9FcvFTrnSmKBQqSm0,7459
327
+ agenta/sdk/managers/secrets.py,sha256=WgMAdWIagGntQrjj1A6_fcZxyFxfL2SaQOxnfdtGceE,8077
328
328
  agenta/sdk/managers/shared.py,sha256=kI3w74E4rS3YDORG2e-_r0Pz5KslTRzRBK7vgyOeaJA,21559
329
329
  agenta/sdk/managers/variant.py,sha256=A5ga3mq3b0weUTXa9HO72MGaspthGcu1uK9K5OnP738,4172
330
330
  agenta/sdk/managers/vault.py,sha256=tOJsRWSEpmNT_ysWVcK5KQMdQO4pwiK90H3rsr9BUbg,337
@@ -366,6 +366,6 @@ agenta/sdk/workflows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
366
366
  agenta/sdk/workflows/registry.py,sha256=4FRSeU4njMmP6xFCIteF5f_W6NVlqFTx1AM7hsaGAQk,975
367
367
  agenta/sdk/workflows/types.py,sha256=SjYeT8FWVgwaIIC8sI3fRjKERLEA_oxuBGvYSaFqNg8,11720
368
368
  agenta/sdk/workflows/utils.py,sha256=ILfY8DSBWLrdWIuKg6mq7rANwKiiY6sxEeFiBFhjLYM,413
369
- agenta-0.59.7.dist-info/METADATA,sha256=2uIEfhZCpN4AKWkMHiku3SLW64jWheVmOmjuO26_x4Q,31792
370
- agenta-0.59.7.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
371
- agenta-0.59.7.dist-info/RECORD,,
369
+ agenta-0.59.8.dist-info/METADATA,sha256=5HTX5B2fD64ORR-vZcNjBmxxWkVIWoItZG0eqZRIo_c,31792
370
+ agenta-0.59.8.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
371
+ agenta-0.59.8.dist-info/RECORD,,