agenta 0.10.0__py3-none-any.whl → 0.10.2__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/main.py CHANGED
@@ -79,7 +79,9 @@ def cli():
79
79
 
80
80
  @click.command()
81
81
  @click.option("--app_name", default="")
82
- def init(app_name: str):
82
+ @click.option("--backend_host", default="")
83
+ def init(app_name: str, backend_host: str):
84
+ init_option = "Blank App" if backend_host != "" and app_name != "" else ""
83
85
  """Initialize a new Agenta app with the template files."""
84
86
  if not app_name:
85
87
  while True:
@@ -95,28 +97,38 @@ def init(app_name: str):
95
97
  )
96
98
 
97
99
  try:
98
- where_question = questionary.select(
99
- "Where are you running agenta?",
100
- choices=["On agenta cloud", "On my local machine", "On a remote machine"],
101
- ).ask()
102
-
103
- if where_question == "On my local machine":
104
- backend_host = "http://localhost"
105
- elif where_question == "On a remote machine":
106
- backend_host = questionary.text(
107
- "Please provide the IP or URL of your remote host"
100
+ backend_hosts = {
101
+ "https://cloud.agenta.ai": "On agenta cloud",
102
+ "http://localhost": "On my local machine",
103
+ }
104
+ where_question = backend_hosts.get(backend_host, "On a remote machine")
105
+ if not backend_host:
106
+ where_question = questionary.select(
107
+ "Where are you running agenta?",
108
+ choices=[
109
+ "On agenta cloud",
110
+ "On my local machine",
111
+ "On a remote machine",
112
+ ],
108
113
  ).ask()
109
- elif where_question == "On agenta cloud":
110
- global_backend_host = helper.get_global_config("host")
111
- if global_backend_host:
112
- backend_host = global_backend_host
113
- else:
114
- backend_host = "https://cloud.agenta.ai"
115
114
 
116
- api_key = helper.get_api_key(backend_host)
115
+ if where_question == "On my local machine":
116
+ backend_host = "http://localhost"
117
+ elif where_question == "On a remote machine":
118
+ backend_host = questionary.text(
119
+ "Please provide the IP or URL of your remote host"
120
+ ).ask()
121
+ elif where_question == "On agenta cloud":
122
+ global_backend_host = helper.get_global_config("host")
123
+ if global_backend_host:
124
+ backend_host = global_backend_host
125
+ else:
126
+ backend_host = "https://cloud.agenta.ai"
127
+
128
+ api_key = helper.get_api_key(backend_host)
117
129
 
118
- elif where_question is None: # User pressed Ctrl+C
119
- sys.exit(0)
130
+ elif where_question is None: # User pressed Ctrl+C
131
+ sys.exit(0)
120
132
  backend_host = (
121
133
  backend_host
122
134
  if backend_host.startswith("http://") or backend_host.startswith("https://")
@@ -160,41 +172,42 @@ def init(app_name: str):
160
172
  toml.dump(config, config_file)
161
173
 
162
174
  # Ask for init option
163
- init_option = questionary.select(
164
- "How do you want to initialize your app?",
165
- choices=["Blank App", "Start from template"],
166
- ).ask()
167
-
168
- # If the user selected the second option, show a list of available templates
169
- if init_option == "Start from template":
170
- current_dir = Path.cwd()
171
- template_dir = Path(__file__).parent.parent / "templates"
172
- templates = [
173
- folder.name for folder in template_dir.iterdir() if folder.is_dir()
174
- ]
175
- template_desc = [
176
- toml.load((template_dir / name / "template.toml"))["short_desc"]
177
- for name in templates
178
- ]
179
-
180
- # Show the templates to the user
181
- template = questionary.select(
182
- "Which template do you want to use?",
183
- choices=[
184
- questionary.Choice(
185
- title=f"{template} - {template_desc}", value=template
186
- )
187
- for template, template_desc in zip(templates, template_desc)
188
- ],
175
+ if not init_option:
176
+ init_option = questionary.select(
177
+ "How do you want to initialize your app?",
178
+ choices=["Blank App", "Start from template"],
189
179
  ).ask()
190
180
 
191
- # Copy the template files to the current directory
192
- chosen_template_dir = template_dir / template
193
- for file in chosen_template_dir.glob("*"):
194
- if file.name != "template.toml" and not file.is_dir():
195
- shutil.copy(file, current_dir / file.name)
196
- elif init_option is None: # User pressed Ctrl+C
197
- sys.exit(0)
181
+ # If the user selected the second option, show a list of available templates
182
+ if init_option == "Start from template":
183
+ current_dir = Path.cwd()
184
+ template_dir = Path(__file__).parent.parent / "templates"
185
+ templates = [
186
+ folder.name for folder in template_dir.iterdir() if folder.is_dir()
187
+ ]
188
+ template_desc = [
189
+ toml.load((template_dir / name / "template.toml"))["short_desc"]
190
+ for name in templates
191
+ ]
192
+
193
+ # Show the templates to the user
194
+ template = questionary.select(
195
+ "Which template do you want to use?",
196
+ choices=[
197
+ questionary.Choice(
198
+ title=f"{template} - {template_desc}", value=template
199
+ )
200
+ for template, template_desc in zip(templates, template_desc)
201
+ ],
202
+ ).ask()
203
+
204
+ # Copy the template files to the current directory
205
+ chosen_template_dir = template_dir / template
206
+ for file in chosen_template_dir.glob("*"):
207
+ if file.name != "template.toml" and not file.is_dir():
208
+ shutil.copy(file, current_dir / file.name)
209
+ elif init_option is None: # User pressed Ctrl+C
210
+ sys.exit(0)
198
211
 
199
212
  # Create a .gitignore file and add some default environment folder names to it
200
213
  gitignore_content = (
agenta/sdk/agenta_init.py CHANGED
@@ -75,16 +75,21 @@ class AgentaSingleton:
75
75
  )
76
76
  else:
77
77
  try:
78
- get_app_id = client.list_apps(app_name=app_name)
79
- app_id = get_app_id.app_id
78
+ apps = client.list_apps(app_name=app_name)
79
+ if len(apps) == 0:
80
+ raise APIRequestError(f"App with name {app_name} not found")
80
81
 
82
+ app_id = apps[0].app_id
81
83
  if not app_id:
82
84
  raise APIRequestError(
83
85
  f"App with name {app_name} does not exist on the server."
84
86
  )
85
87
 
86
- get_base_id = client.list_bases(app_id=app_id, base_name=base_name)
87
- base_id = get_base_id.base_id
88
+ bases = client.list_bases(app_id=app_id, base_name=base_name)
89
+ if len(bases) == 0:
90
+ raise APIRequestError(f"No base was found for the app {app_id}")
91
+
92
+ base_id = bases[0].base_id
88
93
  except Exception as ex:
89
94
  raise APIRequestError(
90
95
  f"Failed to get base id and/or app_id from the server with error: {ex}"
@@ -171,7 +176,7 @@ class Config:
171
176
  + str(ex)
172
177
  )
173
178
  try:
174
- self.set(**config["parameters"])
179
+ self.set(**config.parameters)
175
180
  except Exception as ex:
176
181
  logger.warning("Failed to set the configuration with error: " + str(ex))
177
182
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: agenta
3
- Version: 0.10.0
3
+ Version: 0.10.2
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,7 +1,7 @@
1
1
  agenta/__init__.py,sha256=Sg_4PW8MM-r9p96FeqTdu1h7fcQzN4nF7KPuQD7lgIc,493
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=3XuIlEQLG9X3NFW3beKPqSe-zTNdBGdT9jh8e0dU5PU,7599
4
+ agenta/cli/main.py,sha256=sYkNSqSJRTQOi6u-JulHiwC4ObqzygP13Dk1tcwEktk,8310
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
@@ -86,7 +86,7 @@ agenta/docker/docker-assets/main.py,sha256=BbmbFByRQ8MzL8402pJryEF34t6ba1i_JrMtW
86
86
  agenta/docker/docker_utils.py,sha256=gtwD0XZ_1Vk-rzNUYctlnRjZPpn01mX7tYvaNK7o7OQ,3542
87
87
  agenta/sdk/__init__.py,sha256=TUTEndClnM2SKeQsC7Swv_K3uWkBZTd7jYKvp2-tQeY,565
88
88
  agenta/sdk/agenta_decorator.py,sha256=B0tQCBsbSUFfdo1Ibadd0MPQCN7xdGtBcTurmsclL6U,15429
89
- agenta/sdk/agenta_init.py,sha256=NdXNUlfabALJINJlZr5oXFt4XwMeAomp83YImdTZ_KU,7792
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
92
  agenta/sdk/types.py,sha256=GiUiXDkbM2pMx1-mldzQT8uDUcm9sRqVUytThEkbjj4,4658
@@ -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.10.0.dist-info/METADATA,sha256=oAcCBLqZqUXCKD1y1MTwDxHuyXwz_cw8hTAfEupgg3M,27296
112
- agenta-0.10.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
113
- agenta-0.10.0.dist-info/entry_points.txt,sha256=PDiu8_8AsL7ibU9v4iNoOKR1S7F2rdxjlEprjM9QOgo,46
114
- agenta-0.10.0.dist-info/RECORD,,
111
+ agenta-0.10.2.dist-info/METADATA,sha256=EOO3EgKztl8qTAHATQwW4IjsyoDxREGmc50ygS0vWc8,27296
112
+ agenta-0.10.2.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
113
+ agenta-0.10.2.dist-info/entry_points.txt,sha256=PDiu8_8AsL7ibU9v4iNoOKR1S7F2rdxjlEprjM9QOgo,46
114
+ agenta-0.10.2.dist-info/RECORD,,