agenta 0.12.6__py3-none-any.whl → 0.12.7__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/__init__.py CHANGED
@@ -7,6 +7,7 @@ from .sdk.types import (
7
7
  InFile,
8
8
  IntParam,
9
9
  MultipleChoiceParam,
10
+ GroupedMultipleChoiceParam,
10
11
  MessagesInput,
11
12
  TextParam,
12
13
  FileInputURL,
agenta/sdk/__init__.py CHANGED
@@ -9,6 +9,7 @@ from .types import (
9
9
  InFile,
10
10
  IntParam,
11
11
  MultipleChoiceParam,
12
+ GroupedMultipleChoiceParam,
12
13
  TextParam,
13
14
  MessagesInput,
14
15
  FileInputURL,
@@ -25,6 +25,7 @@ from .types import (
25
25
  InFile,
26
26
  IntParam,
27
27
  MultipleChoiceParam,
28
+ GroupedMultipleChoiceParam,
28
29
  TextParam,
29
30
  MessagesInput,
30
31
  FileInputURL,
@@ -396,6 +397,13 @@ def override_schema(openapi_schema: dict, func_name: str, endpoint: str, params:
396
397
  f"Body_{func_name}_{endpoint}_post"
397
398
  ]["properties"]
398
399
  for param_name, param_val in params.items():
400
+ if isinstance(param_val, GroupedMultipleChoiceParam):
401
+ subschema = find_in_schema(schema_to_override, param_name, "grouped_choice")
402
+ assert (
403
+ subschema
404
+ ), f"GroupedMultipleChoiceParam '{param_name}' is in the parameters but could not be found in the openapi.json"
405
+ subschema["choices"] = param_val.choices
406
+ subschema["default"] = param_val.default
399
407
  if isinstance(param_val, MultipleChoiceParam):
400
408
  subschema = find_in_schema(schema_to_override, param_name, "choice")
401
409
  default = str(param_val)
agenta/sdk/types.py CHANGED
@@ -127,6 +127,44 @@ class MultipleChoiceParam(str):
127
127
  )
128
128
 
129
129
 
130
+ class GroupedMultipleChoiceParam(str):
131
+ def __new__(cls, default: str = None, choices: Dict[str, List[str]] = None):
132
+ if choices is None:
133
+ choices = {}
134
+
135
+ if default and not any(default in choices for choices in choices.values()):
136
+ if not choices:
137
+ print(
138
+ f"Warning: Default value {default} provided but choices are empty."
139
+ )
140
+ else:
141
+ raise ValueError(
142
+ f"Default value {default} is not in the provided choices"
143
+ )
144
+
145
+ if not default:
146
+ for choices in choices.values():
147
+ if choices:
148
+ default = choices[0]
149
+ break
150
+
151
+ instance = super().__new__(cls, default)
152
+ instance.choices = choices
153
+ instance.default = default
154
+ return instance
155
+
156
+ @classmethod
157
+ def __modify_schema__(cls, field_schema: dict[str, Any], **kwargs):
158
+ choices = kwargs.get("choices", {})
159
+ field_schema.update(
160
+ {
161
+ "x-parameter": "grouped_choice",
162
+ "type": "string",
163
+ "choices": choices,
164
+ }
165
+ )
166
+
167
+
130
168
  class Message(BaseModel):
131
169
  role: str
132
170
  content: str
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: agenta
3
- Version: 0.12.6
3
+ Version: 0.12.7
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,4 +1,4 @@
1
- agenta/__init__.py,sha256=Sg_4PW8MM-r9p96FeqTdu1h7fcQzN4nF7KPuQD7lgIc,493
1
+ agenta/__init__.py,sha256=o3aVn9zE9mtZtxZi8xAA98OuHg-Jd7yth4yK5dsR-hA,525
2
2
  agenta/cli/evaluation_commands.py,sha256=fs6492tprPId9p8eGO02Xy-NCBm2RZNJLZWcUxugwd8,474
3
3
  agenta/cli/helper.py,sha256=X_0GtjugLQiM_f53_l3AF3uPS8if96ejTh2nThYqLuE,6199
4
4
  agenta/cli/main.py,sha256=jeTI0U1xeRwFv3QkJRwOXWVK13V9t3JEoApAk5VbAtA,9487
@@ -84,12 +84,12 @@ agenta/docker/docker-assets/entrypoint.sh,sha256=29XK8VQjQsx4hN2j-4JDy-6kQb5y4LC
84
84
  agenta/docker/docker-assets/lambda_function.py,sha256=h4UZSSfqwpfsCgERv6frqwm_4JrYu9rLz3I-LxCfeEg,83
85
85
  agenta/docker/docker-assets/main.py,sha256=7MI-21n81U7N7A0GxebNi0cmGWtJKcR2sPB6FcH2QfA,251
86
86
  agenta/docker/docker_utils.py,sha256=gtwD0XZ_1Vk-rzNUYctlnRjZPpn01mX7tYvaNK7o7OQ,3542
87
- agenta/sdk/__init__.py,sha256=TUTEndClnM2SKeQsC7Swv_K3uWkBZTd7jYKvp2-tQeY,565
88
- agenta/sdk/agenta_decorator.py,sha256=B0tQCBsbSUFfdo1Ibadd0MPQCN7xdGtBcTurmsclL6U,15429
87
+ agenta/sdk/__init__.py,sha256=xTh1aVoSGPFBgSf_lnALaE1rt-G3eomxF5ijB3DdobM,597
88
+ agenta/sdk/agenta_decorator.py,sha256=ARCTFmzOvvRXPE_fSK_4JRDxyfF91NxEX2Kf-KwH9hI,15889
89
89
  agenta/sdk/agenta_init.py,sha256=67THCATEW_oC8juCzdS-AouirksuXouyrRPyuUkLFxw,8025
90
90
  agenta/sdk/context.py,sha256=q-PxL05-I84puunUAs9LGsffEXcYhDxhQxjuOz2vK90,901
91
91
  agenta/sdk/router.py,sha256=0sbajvn5C7t18anH6yNo7-oYxldHnYfwcbmQnIXBePw,269
92
- agenta/sdk/types.py,sha256=GiUiXDkbM2pMx1-mldzQT8uDUcm9sRqVUytThEkbjj4,4658
92
+ agenta/sdk/types.py,sha256=Mn0yBlHh_Yr_5oQXUfsYI3V7sJAVWkJgkxEOBDOOMS0,5852
93
93
  agenta/sdk/utils/globals.py,sha256=lpgflY8xovZJtHfJf41dbNCZGwx07YNkG9ldruv6xoI,360
94
94
  agenta/sdk/utils/helper/openai_cost.py,sha256=1VkgvucDnNZm1pTfcVLz9icWunntp1d7zwMmnviy3Uw,5877
95
95
  agenta/sdk/utils/preinit.py,sha256=YlJL7RLfel0R7DFp-jK7OV-z4ZIQJM0oupYlk7g8b5o,1278
@@ -108,7 +108,7 @@ agenta/templates/simple_prompt/app.py,sha256=kODgF6lhzsaJPdgL5b21bUki6jkvqjWZzWR
108
108
  agenta/templates/simple_prompt/env.example,sha256=g9AE5bYcGPpxawXMJ96gh8oenEPCHTabsiOnfQo3c5k,70
109
109
  agenta/templates/simple_prompt/requirements.txt,sha256=ywRglRy7pPkw8bljmMEJJ4aOOQKrt9FGKULZ-DGkoBU,23
110
110
  agenta/templates/simple_prompt/template.toml,sha256=DQBtRrF4GU8LBEXOZ-GGuINXMQDKGTEG5y37tnvIUIE,60
111
- agenta-0.12.6.dist-info/METADATA,sha256=Qj51sEqvl9Qg2gSnHwGR1hyn6rzxRqfaF9HFNMbdrq8,27336
112
- agenta-0.12.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
113
- agenta-0.12.6.dist-info/entry_points.txt,sha256=PDiu8_8AsL7ibU9v4iNoOKR1S7F2rdxjlEprjM9QOgo,46
114
- agenta-0.12.6.dist-info/RECORD,,
111
+ agenta-0.12.7.dist-info/METADATA,sha256=wijR1Y4DB7r3pSHKy3cpiuI8-Y8tef_7dMxFMkzzm6o,27336
112
+ agenta-0.12.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
113
+ agenta-0.12.7.dist-info/entry_points.txt,sha256=PDiu8_8AsL7ibU9v4iNoOKR1S7F2rdxjlEprjM9QOgo,46
114
+ agenta-0.12.7.dist-info/RECORD,,