agenta 0.12.5__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 +1 -0
- agenta/cli/main.py +11 -8
- agenta/sdk/__init__.py +1 -0
- agenta/sdk/agenta_decorator.py +8 -0
- agenta/sdk/types.py +38 -0
- {agenta-0.12.5.dist-info → agenta-0.12.7.dist-info}/METADATA +1 -1
- {agenta-0.12.5.dist-info → agenta-0.12.7.dist-info}/RECORD +9 -9
- {agenta-0.12.5.dist-info → agenta-0.12.7.dist-info}/WHEEL +0 -0
- {agenta-0.12.5.dist-info → agenta-0.12.7.dist-info}/entry_points.txt +0 -0
agenta/__init__.py
CHANGED
agenta/cli/main.py
CHANGED
|
@@ -153,18 +153,21 @@ def init(app_name: str, backend_host: str):
|
|
|
153
153
|
try:
|
|
154
154
|
key_prefix = api_key.split(".")[0]
|
|
155
155
|
client.validate_api_key(key_prefix=key_prefix)
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
except Exception as ex:
|
|
157
|
+
click.echo(
|
|
158
|
+
click.style(
|
|
159
|
+
f"Error: Unable to validate API key.\nError: {ex}", fg="red"
|
|
160
|
+
)
|
|
161
|
+
)
|
|
162
|
+
sys.exit(1)
|
|
163
|
+
# Make request to fetch user organizations after api key validation
|
|
164
|
+
try:
|
|
158
165
|
organizations = client.list_organizations()
|
|
159
166
|
if len(organizations) >= 1:
|
|
160
167
|
user_organizations = organizations
|
|
161
168
|
except Exception as ex:
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
sys.exit(1)
|
|
165
|
-
else:
|
|
166
|
-
click.echo(click.style(f"Error: {ex}", fg="red"))
|
|
167
|
-
sys.exit(1)
|
|
169
|
+
click.echo(click.style(f"Error: {ex}", fg="red"))
|
|
170
|
+
sys.exit(1)
|
|
168
171
|
|
|
169
172
|
filtered_org = None
|
|
170
173
|
if where_question == "On agenta cloud":
|
agenta/sdk/__init__.py
CHANGED
agenta/sdk/agenta_decorator.py
CHANGED
|
@@ -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,7 +1,7 @@
|
|
|
1
|
-
agenta/__init__.py,sha256=
|
|
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
|
-
agenta/cli/main.py,sha256=
|
|
4
|
+
agenta/cli/main.py,sha256=jeTI0U1xeRwFv3QkJRwOXWVK13V9t3JEoApAk5VbAtA,9487
|
|
5
5
|
agenta/cli/telemetry.py,sha256=GaFFRsE_NtrcSSJ10r2jhgFs5Sk8gf2C09Ox3gOr3eU,1317
|
|
6
6
|
agenta/cli/variant_commands.py,sha256=wJCfTp1uNQwSadg4rraxZF5NUVfpfg_0RAK76qD5xDo,16858
|
|
7
7
|
agenta/cli/variant_configs.py,sha256=PLiuMKadVzs6Gi2uYaT0pZzyULNHDXaTMDWboqpwWdU,1293
|
|
@@ -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=
|
|
88
|
-
agenta/sdk/agenta_decorator.py,sha256=
|
|
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=
|
|
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.
|
|
112
|
-
agenta-0.12.
|
|
113
|
-
agenta-0.12.
|
|
114
|
-
agenta-0.12.
|
|
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,,
|
|
File without changes
|
|
File without changes
|