weco 0.2.13__py3-none-any.whl → 0.2.15__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.
weco/__init__.py CHANGED
@@ -1,7 +1,7 @@
1
1
  import os
2
2
 
3
3
  # DO NOT EDIT
4
- __pkg_version__ = "0.2.13"
4
+ __pkg_version__ = "0.2.15"
5
5
  __api_version__ = "v1"
6
6
 
7
7
  __base_url__ = f"https://api.weco.ai/{__api_version__}"
weco/api.py CHANGED
@@ -7,8 +7,7 @@ import sys
7
7
 
8
8
  def handle_api_error(e: requests.exceptions.HTTPError, console: rich.console.Console) -> None:
9
9
  """Extract and display error messages from API responses in a structured format."""
10
- error_message = str(e) # Default message
11
- console.print(f"[bold red]Error:[/] {error_message}")
10
+ console.print(f"[bold red]{e.response.json()['detail']}[/]")
12
11
  sys.exit(1)
13
12
 
14
13
 
weco/cli.py CHANGED
@@ -201,14 +201,13 @@ def main() -> None:
201
201
  )
202
202
 
203
203
  # --- Logout Command ---
204
- logout_parser = subparsers.add_parser("logout", help="Log out from Weco and clear saved API key.") # noqa F841
204
+ _ = subparsers.add_parser("logout", help="Log out from Weco and clear saved API key.")
205
205
 
206
206
  args = parser.parse_args()
207
207
 
208
208
  # --- Handle Logout Command ---
209
209
  if args.command == "logout":
210
210
  clear_api_key()
211
- console.print("[green]Logged out successfully.[/]") # Added feedback
212
211
  sys.exit(0)
213
212
 
214
213
  # --- Handle Run Command ---
@@ -257,20 +256,23 @@ def main() -> None:
257
256
  maximize = args.maximize == "true"
258
257
  steps = args.steps
259
258
  code_generator_config = {"model": args.model}
260
- evaluator_config = {"model": args.model}
259
+ evaluator_config = {
260
+ "model": args.model,
261
+ "include_analysis": False, # NOTE: False for now
262
+ }
261
263
  search_policy_config = {
262
264
  "num_drafts": max(1, math.ceil(0.15 * steps)),
263
265
  "debug_prob": 0.5,
264
266
  "max_debug_depth": max(1, math.ceil(0.1 * steps)),
265
267
  }
268
+ # API request timeout
269
+ timeout = 800
266
270
  # Read additional instructions
267
271
  additional_instructions = read_additional_instructions(additional_instructions=args.additional_instructions)
268
272
  # Read source code path
269
273
  source_fp = pathlib.Path(args.source)
270
274
  # Read source code content
271
275
  source_code = read_from_path(fp=source_fp, is_json=False)
272
- # API request timeout
273
- timeout = 800
274
276
 
275
277
  # --- Panel Initialization ---
276
278
  summary_panel = SummaryPanel(
@@ -308,9 +310,8 @@ def main() -> None:
308
310
  runs_dir = pathlib.Path(args.log_dir) / session_id
309
311
  runs_dir.mkdir(parents=True, exist_ok=True)
310
312
 
311
- # Save the original code (.runs/<session-id>/original.<extension>)
312
- runs_copy_source_fp = runs_dir / f"original{source_fp.suffix}" # Use correct suffix
313
- write_to_path(fp=runs_copy_source_fp, content=source_code)
313
+ # Write the initial code string to the logs
314
+ write_to_path(fp=runs_dir / f"step_0{source_fp.suffix}", content=session_response["code"])
314
315
 
315
316
  # Write the initial code string to the source file path (if not preserving)
316
317
  if not args.preserve_source:
@@ -378,7 +379,8 @@ def main() -> None:
378
379
  transition_delay=0.1,
379
380
  )
380
381
 
381
- for step in range(1, steps):
382
+ # Starting from step 1 to steps (inclusive) because the baseline solution is step 0, so we want to optimize for steps worth of steps
383
+ for step in range(1, steps + 1):
382
384
  # Re-read instructions from the original source (file path or string) BEFORE each suggest call
383
385
  current_additional_instructions = read_additional_instructions(
384
386
  additional_instructions=args.additional_instructions
@@ -551,9 +553,7 @@ def main() -> None:
551
553
  best_solution_score = None
552
554
 
553
555
  if best_solution_code is None or best_solution_score is None:
554
- best_solution_content = (
555
- f"# Weco could not find a better solution\n\n{read_from_path(fp=runs_copy_source_fp, is_json=False)}"
556
- )
556
+ best_solution_content = f"# Weco could not find a better solution\n\n{read_from_path(fp=runs_dir / f'step_0{source_fp.suffix}', is_json=False)}"
557
557
  else:
558
558
  # Format score for the comment
559
559
  best_score_str = (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: weco
3
- Version: 0.2.13
3
+ Version: 0.2.15
4
4
  Summary: Documentation for `weco`, a CLI for using Weco AI's code optimizer.
5
5
  Author-email: Weco AI Team <contact@weco.ai>
6
6
  License: MIT
@@ -0,0 +1,12 @@
1
+ weco/__init__.py,sha256=2P-Z80aRiNeL8hyXD4ExZxizUgLb_Tj_NOydwoqTZ_k,426
2
+ weco/api.py,sha256=z2DCe0kQJaaBHo-Vml52GRc9nwQBnrKATXoY3UfPojw,3842
3
+ weco/auth.py,sha256=IPfiLthcNRkPyM8pWHTyDLvikw83sigacpY1PmeA03Y,2343
4
+ weco/cli.py,sha256=rcntl-hFQorCNSBX1yaNoL-4eBJFSkN5Vo35b6-W4UU,28993
5
+ weco/panels.py,sha256=gB4rZbCvqzewUCBcILvyyU4fnOQLwFgHCGmtn-ZlgSo,13385
6
+ weco/utils.py,sha256=hhIebUPnetFMfNSFfcsKVw1TSpeu_Zw3rBPPnxDie0U,3911
7
+ weco-0.2.15.dist-info/licenses/LICENSE,sha256=p_GQqJBvuZgkLNboYKyH-5dhpTDlKs2wq2TVM55WrWE,1065
8
+ weco-0.2.15.dist-info/METADATA,sha256=B97o-KOP1o2sUVHqSz1maZGy-iysBKBbvq16QIyVE68,10851
9
+ weco-0.2.15.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
10
+ weco-0.2.15.dist-info/entry_points.txt,sha256=ixJ2uClALbCpBvnIR6BXMNck8SHAab8eVkM9pIUowcs,39
11
+ weco-0.2.15.dist-info/top_level.txt,sha256=F0N7v6e2zBSlsorFv-arAq2yDxQbzX3KVO8GxYhPUeE,5
12
+ weco-0.2.15.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (79.0.0)
2
+ Generator: setuptools (79.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,12 +0,0 @@
1
- weco/__init__.py,sha256=DvJyE-y8upXub4ecCkEZlC5tD5-XonqMe6x8ZtQmnQ0,426
2
- weco/api.py,sha256=_zgQ4AHDBgqfU2569W63c10qKuIWA5y63XT0qqvUag8,3881
3
- weco/auth.py,sha256=IPfiLthcNRkPyM8pWHTyDLvikw83sigacpY1PmeA03Y,2343
4
- weco/cli.py,sha256=rvUqxdJov_R74lkr0Gx-802RNsBYxhLahTue54n2bqc,28967
5
- weco/panels.py,sha256=gB4rZbCvqzewUCBcILvyyU4fnOQLwFgHCGmtn-ZlgSo,13385
6
- weco/utils.py,sha256=hhIebUPnetFMfNSFfcsKVw1TSpeu_Zw3rBPPnxDie0U,3911
7
- weco-0.2.13.dist-info/licenses/LICENSE,sha256=p_GQqJBvuZgkLNboYKyH-5dhpTDlKs2wq2TVM55WrWE,1065
8
- weco-0.2.13.dist-info/METADATA,sha256=QD0MYkpAfdETUUtQA2PC1HTuvaMf2zeAOEWyqP_lxrk,10851
9
- weco-0.2.13.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
10
- weco-0.2.13.dist-info/entry_points.txt,sha256=ixJ2uClALbCpBvnIR6BXMNck8SHAab8eVkM9pIUowcs,39
11
- weco-0.2.13.dist-info/top_level.txt,sha256=F0N7v6e2zBSlsorFv-arAq2yDxQbzX3KVO8GxYhPUeE,5
12
- weco-0.2.13.dist-info/RECORD,,