agenta 0.5.8__py3-none-any.whl → 0.6.0__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
@@ -57,7 +57,7 @@ def set_global_config(var_name: str, var_value: Any) -> None:
57
57
  toml.dump(global_config, config_file)
58
58
 
59
59
 
60
- def get_api_key() -> str:
60
+ def get_api_key(backend_host: str) -> str:
61
61
  """
62
62
  Retrieve or request the API key for accessing the Agenta platform.
63
63
 
@@ -65,6 +65,9 @@ def get_api_key() -> str:
65
65
  If found, it prompts the user to confirm whether they'd like to use that key.
66
66
  If not found, it asks the user to input a new key.
67
67
 
68
+ Args:
69
+ backend_host (str): The URL of the backend host.
70
+
68
71
  Returns:
69
72
  str: The API key to be used for accessing the Agenta platform.
70
73
 
@@ -85,7 +88,7 @@ def get_api_key() -> str:
85
88
  sys.exit(0)
86
89
 
87
90
  api_key = questionary.text(
88
- "(You can get your API Key here: https://cloud.agenta.ai/settings?tab=apiKeys) "
91
+ f"(You can get your API Key here: {backend_host}/settings?tab=apiKeys) "
89
92
  "Please provide your API key:"
90
93
  ).ask()
91
94
 
agenta/cli/main.py CHANGED
@@ -8,9 +8,10 @@ import click
8
8
  import questionary
9
9
  import toml
10
10
 
11
+ from agenta.cli import helper
11
12
  from agenta.client import client
13
+ from agenta.cli import variant_configs
12
14
  from agenta.cli import variant_commands
13
- from agenta.cli import helper
14
15
 
15
16
 
16
17
  def print_version(ctx, param, value):
@@ -101,8 +102,13 @@ def init(app_name: str):
101
102
  "Please provide the IP or URL of your remote host"
102
103
  ).ask()
103
104
  elif where_question == "On agenta cloud":
104
- backend_host = "https://cloud.agenta.ai"
105
- api_key = helper.get_api_key()
105
+ global_backend_host = helper.get_global_config("host")
106
+ if global_backend_host:
107
+ backend_host = global_backend_host
108
+ else:
109
+ backend_host = "https://cloud.agenta.ai"
110
+
111
+ api_key = helper.get_api_key(backend_host)
106
112
  client.validate_api_key(api_key, backend_host)
107
113
 
108
114
  elif where_question is None: # User pressed Ctrl+C
@@ -186,6 +192,7 @@ def init(app_name: str):
186
192
 
187
193
  # Add the commands to the CLI group
188
194
  cli.add_command(init)
195
+ cli.add_command(variant_configs.config)
189
196
  cli.add_command(variant_commands.variant)
190
197
 
191
198
  if __name__ == "__main__":
@@ -0,0 +1,49 @@
1
+ import click
2
+ from agenta.cli import helper
3
+
4
+
5
+ @click.group()
6
+ def config():
7
+ """Commands for variants configurations"""
8
+ pass
9
+
10
+
11
+ def update_backend_host(backend_host: str):
12
+ """Check the config file and update the backend URL
13
+
14
+ Arguments:
15
+ app_folder -- the app folder
16
+ backend_host -- the backend host
17
+ """
18
+
19
+ click.echo(
20
+ click.style("\nChecking and updating global backend host...", fg="bright_black")
21
+ )
22
+ helper.set_global_config("host", backend_host)
23
+
24
+
25
+ @config.command(
26
+ name="set-host",
27
+ context_settings=dict(
28
+ ignore_unknown_options=True,
29
+ allow_extra_args=True,
30
+ ),
31
+ )
32
+ @click.option(
33
+ "--backend_host", default=None, help="The URL of the backend host to use."
34
+ )
35
+ @click.pass_context
36
+ def set_config_url(ctx, backend_host: str):
37
+ """Set the backend URL in the app configuration"""
38
+
39
+ try:
40
+ if not backend_host:
41
+ if ctx.args:
42
+ backend_host = ctx.args[0]
43
+ else:
44
+ click.echo(click.style("Backend host URL not specified", fg="red"))
45
+
46
+ update_backend_host(backend_host)
47
+ click.echo(click.style("Backend host updated successfully! 🎉\n"))
48
+ except Exception as ex:
49
+ click.echo(click.style(f"Error updating backend host: {ex}", fg="red"))
@@ -12,10 +12,9 @@ from typing import Any, Callable, Dict, Optional, Tuple
12
12
  import agenta
13
13
  from fastapi import Body, FastAPI, UploadFile
14
14
  from fastapi.middleware.cors import CORSMiddleware
15
- from fastapi.openapi.models import Server
16
15
  from fastapi.responses import JSONResponse
17
16
 
18
- from .context import get_contexts, save_context
17
+ from .context import save_context
19
18
  from .router import router as router
20
19
  from .types import (
21
20
  Context,
@@ -345,7 +344,6 @@ def override_schema(openapi_schema: dict, func_name: str, endpoint: str, params:
345
344
  f"Body_{func_name}_{endpoint}_post"
346
345
  ]["properties"]
347
346
  for param_name, param_val in params.items():
348
- # print(param_name, param_val)
349
347
  if isinstance(param_val, MultipleChoiceParam):
350
348
  subschema = find_in_schema(schema_to_override, param_name, "choice")
351
349
  default = str(param_val)
agenta/sdk/types.py CHANGED
@@ -106,7 +106,7 @@ class Message(BaseModel):
106
106
  class MessagesInput(list):
107
107
  """Messages Input for Chat-completion.
108
108
 
109
- Parameters:
109
+ Args:
110
110
  messages (List[Dict[str, str]]): The list of messages inputs.
111
111
  Required. Each message should be a dictionary with "role" and "content" keys.
112
112
 
@@ -116,11 +116,8 @@ class MessagesInput(list):
116
116
  """
117
117
 
118
118
  def __new__(cls, messages: List[Dict[str, str]] = None):
119
- if not messages:
120
- raise ValueError("Missing required parameter in MessagesInput")
121
-
122
119
  instance = super().__new__(cls, messages)
123
- instance.messages = messages
120
+ instance.default = messages
124
121
  return instance
125
122
 
126
123
  @classmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: agenta
3
- Version: 0.5.8
3
+ Version: 0.6.0
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,8 +1,9 @@
1
1
  agenta/__init__.py,sha256=grmSigSubGpmopSRm6W3bVVOdVR6tHNfqleJPecESak,394
2
- agenta/cli/helper.py,sha256=Bexi77D5g9tbFND5Xh7u6KzbqKKD9jdZmiLTbXMCLgY,5928
3
- agenta/cli/main.py,sha256=R3i6jbn_mxTjLdJxVeYzdfYv7i1cxdqbvxUc-NDFNZY,6392
2
+ agenta/cli/helper.py,sha256=-Xl7aDfRczrSnMVdv-tNDEq0YkxQNZxPH8mTSvmATxU,6005
3
+ agenta/cli/main.py,sha256=AYNSMeQTJ9MVRd-5oTS1WuiWZXwQDkK_Vn1BM_F2IXQ,6660
4
4
  agenta/cli/telemetry.py,sha256=TiI4Nd1F1f1eSrs3fumDhcl8iu56aI4emyaGo5BQwMU,1165
5
5
  agenta/cli/variant_commands.py,sha256=wsY5dD2_3hX6HN2d-f1L4BtbjhvGiiw8rThxy_63A1A,15980
6
+ agenta/cli/variant_configs.py,sha256=PLiuMKadVzs6Gi2uYaT0pZzyULNHDXaTMDWboqpwWdU,1293
6
7
  agenta/client/Readme.md,sha256=umhMce1Gq_der9pH4M_pP4NQ8rHa3MENJLM9OrdUZ50,131
7
8
  agenta/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
9
  agenta/client/api_models.py,sha256=zebfE2-0-SW1SvzyarzmSJMXqyiCLKrX2sHpzoX-RnU,623
@@ -17,11 +18,11 @@ agenta/docker/docker-assets/lambda_function.py,sha256=h4UZSSfqwpfsCgERv6frqwm_4J
17
18
  agenta/docker/docker-assets/main.py,sha256=BbmbFByRQ8MzL8402pJryEF34t6ba1i_JrMtWMAQDQ4,327
18
19
  agenta/docker/docker_utils.py,sha256=oK51dmJLUXcR0iEi3knDqt5BZxF3somqWHVOpTQ8rOI,5681
19
20
  agenta/sdk/__init__.py,sha256=QgjkiERHsprd59qx1bYOKD21DSQr3Bftetfgozdoe7I,470
20
- agenta/sdk/agenta_decorator.py,sha256=psRjROXtus2huHNOeGWvf-4Nnig5EEaJKEFCOXnEIJI,13354
21
+ agenta/sdk/agenta_decorator.py,sha256=VmM4RAdgEc30FHvL313hQqqpzwwmjl_amT4dhBXMuI4,13259
21
22
  agenta/sdk/agenta_init.py,sha256=3-0WRpRSveWUcLhosTuym-YKV9gKVNrOTxGjSa6SxyI,7152
22
23
  agenta/sdk/context.py,sha256=q-PxL05-I84puunUAs9LGsffEXcYhDxhQxjuOz2vK90,901
23
24
  agenta/sdk/router.py,sha256=0sbajvn5C7t18anH6yNo7-oYxldHnYfwcbmQnIXBePw,269
24
- agenta/sdk/types.py,sha256=ep2ls42AxEIBcb0_NJVwDw2isNHFX_BNFBbom2ogP2w,3929
25
+ agenta/sdk/types.py,sha256=JkNq4fkpOqlTC3PHotQHgLwQLWHqBXmctZGSr61CjEY,3820
25
26
  agenta/sdk/utils/globals.py,sha256=lpgflY8xovZJtHfJf41dbNCZGwx07YNkG9ldruv6xoI,360
26
27
  agenta/sdk/utils/preinit.py,sha256=YlJL7RLfel0R7DFp-jK7OV-z4ZIQJM0oupYlk7g8b5o,1278
27
28
  agenta/templates/compose_email/README.md,sha256=ss7vZPpI1Hg0VmYtFliwq_r5LnqbCy_S5OQDXg8UoIA,308
@@ -39,7 +40,7 @@ agenta/templates/simple_prompt/app.py,sha256=kODgF6lhzsaJPdgL5b21bUki6jkvqjWZzWR
39
40
  agenta/templates/simple_prompt/env.example,sha256=g9AE5bYcGPpxawXMJ96gh8oenEPCHTabsiOnfQo3c5k,70
40
41
  agenta/templates/simple_prompt/requirements.txt,sha256=ywRglRy7pPkw8bljmMEJJ4aOOQKrt9FGKULZ-DGkoBU,23
41
42
  agenta/templates/simple_prompt/template.toml,sha256=DQBtRrF4GU8LBEXOZ-GGuINXMQDKGTEG5y37tnvIUIE,60
42
- agenta-0.5.8.dist-info/METADATA,sha256=1crHlBipy4gKc3JZ3a41vFXpYRew6kgb7v_xMju3xDI,10093
43
- agenta-0.5.8.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
44
- agenta-0.5.8.dist-info/entry_points.txt,sha256=PDiu8_8AsL7ibU9v4iNoOKR1S7F2rdxjlEprjM9QOgo,46
45
- agenta-0.5.8.dist-info/RECORD,,
43
+ agenta-0.6.0.dist-info/METADATA,sha256=kvVWmSlKSCMzZTzfIiNGeDsnprW8rHd-l_f96wi7pFo,10093
44
+ agenta-0.6.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
45
+ agenta-0.6.0.dist-info/entry_points.txt,sha256=PDiu8_8AsL7ibU9v4iNoOKR1S7F2rdxjlEprjM9QOgo,46
46
+ agenta-0.6.0.dist-info/RECORD,,
File without changes