weco 0.2.0__tar.gz → 0.2.1__tar.gz
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-0.2.0 → weco-0.2.1}/.github/workflows/release.yml +3 -3
- {weco-0.2.0 → weco-0.2.1}/PKG-INFO +3 -1
- {weco-0.2.0 → weco-0.2.1}/README.md +2 -0
- {weco-0.2.0 → weco-0.2.1}/pyproject.toml +1 -1
- {weco-0.2.0 → weco-0.2.1}/weco/__init__.py +1 -1
- {weco-0.2.0 → weco-0.2.1}/weco/panels.py +5 -42
- {weco-0.2.0 → weco-0.2.1}/weco/utils.py +5 -17
- {weco-0.2.0 → weco-0.2.1}/weco.egg-info/PKG-INFO +3 -1
- {weco-0.2.0 → weco-0.2.1}/.github/workflows/lint.yml +0 -0
- {weco-0.2.0 → weco-0.2.1}/.gitignore +0 -0
- {weco-0.2.0 → weco-0.2.1}/LICENSE +0 -0
- {weco-0.2.0 → weco-0.2.1}/examples/simple-mlx/evaluate.py +0 -0
- {weco-0.2.0 → weco-0.2.1}/examples/simple-mlx/metal-examples.rst +0 -0
- {weco-0.2.0 → weco-0.2.1}/examples/simple-mlx/optimize.py +0 -0
- {weco-0.2.0 → weco-0.2.1}/examples/simple-torch/evaluate.py +0 -0
- {weco-0.2.0 → weco-0.2.1}/examples/simple-torch/optimize.py +0 -0
- {weco-0.2.0 → weco-0.2.1}/setup.cfg +0 -0
- {weco-0.2.0 → weco-0.2.1}/weco/api.py +0 -0
- {weco-0.2.0 → weco-0.2.1}/weco/cli.py +0 -0
- {weco-0.2.0 → weco-0.2.1}/weco.egg-info/SOURCES.txt +0 -0
- {weco-0.2.0 → weco-0.2.1}/weco.egg-info/dependency_links.txt +0 -0
- {weco-0.2.0 → weco-0.2.1}/weco.egg-info/entry_points.txt +0 -0
- {weco-0.2.0 → weco-0.2.1}/weco.egg-info/requires.txt +0 -0
- {weco-0.2.0 → weco-0.2.1}/weco.egg-info/top_level.txt +0 -0
|
@@ -79,7 +79,7 @@ jobs:
|
|
|
79
79
|
path: dist/
|
|
80
80
|
|
|
81
81
|
- name: Sign dists with Sigstore
|
|
82
|
-
uses: sigstore/gh-action-sigstore-python@
|
|
82
|
+
uses: sigstore/gh-action-sigstore-python@v3.0.0
|
|
83
83
|
with:
|
|
84
84
|
inputs: >-
|
|
85
85
|
./dist/*.tar.gz
|
|
@@ -90,7 +90,7 @@ jobs:
|
|
|
90
90
|
GITHUB_TOKEN: ${{ github.token }}
|
|
91
91
|
run: >-
|
|
92
92
|
gh release create
|
|
93
|
-
'v0.2.
|
|
93
|
+
'v0.2.1'
|
|
94
94
|
--repo '${{ github.repository }}'
|
|
95
95
|
--notes ""
|
|
96
96
|
|
|
@@ -102,5 +102,5 @@ jobs:
|
|
|
102
102
|
# sigstore-produced signatures and certificates.
|
|
103
103
|
run: >-
|
|
104
104
|
gh release upload
|
|
105
|
-
'v0.2.
|
|
105
|
+
'v0.2.1' dist/**
|
|
106
106
|
--repo '${{ github.repository }}'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: weco
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Documentation for `weco`, a CLI for using Weco AI's code optimizer.
|
|
5
5
|
Author-email: Weco AI Team <dhruv@weco.ai>
|
|
6
6
|
License: MIT
|
|
@@ -49,6 +49,7 @@ The `weco` CLI leverages advanced optimization techniques and language model str
|
|
|
49
49
|
|
|
50
50
|
- **OpenAI:** `export OPENAI_API_KEY="your_key_here"`
|
|
51
51
|
- **Anthropic:** `export ANTHROPIC_API_KEY="your_key_here"`
|
|
52
|
+
- **Google DeepMind:** `export GEMINI_API_KEY="your_key_here"`
|
|
52
53
|
|
|
53
54
|
---
|
|
54
55
|
|
|
@@ -99,6 +100,7 @@ The CLI supports the following model providers:
|
|
|
99
100
|
|
|
100
101
|
- **OpenAI:** Set your API key using `OPENAI_API_KEY`.
|
|
101
102
|
- **Anthropic:** Set your API key using `ANTHROPIC_API_KEY`.
|
|
103
|
+
- **Google DeepMind:** Set your API key using `GEMINI_API_KEY`.
|
|
102
104
|
|
|
103
105
|
---
|
|
104
106
|
|
|
@@ -27,6 +27,7 @@ The `weco` CLI leverages advanced optimization techniques and language model str
|
|
|
27
27
|
|
|
28
28
|
- **OpenAI:** `export OPENAI_API_KEY="your_key_here"`
|
|
29
29
|
- **Anthropic:** `export ANTHROPIC_API_KEY="your_key_here"`
|
|
30
|
+
- **Google DeepMind:** `export GEMINI_API_KEY="your_key_here"`
|
|
30
31
|
|
|
31
32
|
---
|
|
32
33
|
|
|
@@ -77,6 +78,7 @@ The CLI supports the following model providers:
|
|
|
77
78
|
|
|
78
79
|
- **OpenAI:** Set your API key using `OPENAI_API_KEY`.
|
|
79
80
|
- **Anthropic:** Set your API key using `ANTHROPIC_API_KEY`.
|
|
81
|
+
- **Google DeepMind:** Set your API key using `GEMINI_API_KEY`.
|
|
80
82
|
|
|
81
83
|
---
|
|
82
84
|
|
|
@@ -10,7 +10,7 @@ authors = [
|
|
|
10
10
|
]
|
|
11
11
|
description = "Documentation for `weco`, a CLI for using Weco AI's code optimizer."
|
|
12
12
|
readme = "README.md"
|
|
13
|
-
version = "0.2.
|
|
13
|
+
version = "0.2.1"
|
|
14
14
|
license = {text = "MIT"}
|
|
15
15
|
requires-python = ">=3.12"
|
|
16
16
|
dependencies = ["requests", "rich"]
|
|
@@ -5,7 +5,7 @@ from rich.layout import Layout
|
|
|
5
5
|
from rich.panel import Panel
|
|
6
6
|
from rich.syntax import Syntax
|
|
7
7
|
from typing import Dict, List, Optional, Union, Tuple
|
|
8
|
-
from .utils import format_number
|
|
8
|
+
from .utils import format_number
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class SummaryPanel:
|
|
@@ -67,7 +67,6 @@ class PlanPanel:
|
|
|
67
67
|
|
|
68
68
|
def __init__(self):
|
|
69
69
|
self.plan = ""
|
|
70
|
-
self.max_lines = 3 # Approximate number of lines that can fit in the panel
|
|
71
70
|
|
|
72
71
|
def update(self, plan: str):
|
|
73
72
|
"""Update the plan text."""
|
|
@@ -79,15 +78,7 @@ class PlanPanel:
|
|
|
79
78
|
|
|
80
79
|
def get_display(self) -> Panel:
|
|
81
80
|
"""Create a panel displaying the plan with truncation if needed."""
|
|
82
|
-
|
|
83
|
-
return Panel(
|
|
84
|
-
display_text,
|
|
85
|
-
title="[bold]📝 Thinking...",
|
|
86
|
-
border_style="cyan",
|
|
87
|
-
expand=True,
|
|
88
|
-
padding=(0, 1),
|
|
89
|
-
subtitle="[cyan]↓ truncated ↓[/]" if len(self.plan) > self.max_lines else None,
|
|
90
|
-
)
|
|
81
|
+
return Panel(self.plan, title="[bold]📝 Thinking...", border_style="cyan", expand=True, padding=(0, 1))
|
|
91
82
|
|
|
92
83
|
|
|
93
84
|
class Node:
|
|
@@ -238,7 +229,6 @@ class EvaluationOutputPanel:
|
|
|
238
229
|
|
|
239
230
|
def __init__(self):
|
|
240
231
|
self.output = ""
|
|
241
|
-
self.max_lines = 25 # Approximate number of lines that can fit in the panel
|
|
242
232
|
|
|
243
233
|
def update(self, output: str) -> None:
|
|
244
234
|
"""Update the evaluation output."""
|
|
@@ -250,13 +240,7 @@ class EvaluationOutputPanel:
|
|
|
250
240
|
|
|
251
241
|
def get_display(self) -> Panel:
|
|
252
242
|
"""Create a panel displaying the evaluation output with truncation if needed."""
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
title = "[bold]📋 Evaluation Output"
|
|
256
|
-
if len(self.output) == len(display_text):
|
|
257
|
-
title += " (truncated)[/]"
|
|
258
|
-
|
|
259
|
-
return Panel(display_text, title=title, border_style="red", expand=True, padding=(0, 1))
|
|
243
|
+
return Panel(self.output, title="[bold]📋 Evaluation Output", border_style="red", expand=True, padding=(0, 1))
|
|
260
244
|
|
|
261
245
|
|
|
262
246
|
class SolutionPanels:
|
|
@@ -267,7 +251,6 @@ class SolutionPanels:
|
|
|
267
251
|
self.current_node = None
|
|
268
252
|
# Best solution
|
|
269
253
|
self.best_node = None
|
|
270
|
-
self.max_lines = 30 # Approximate number of lines that can fit in each panel
|
|
271
254
|
|
|
272
255
|
def update(self, current_node: Union[Node, None], best_node: Union[Node, None]):
|
|
273
256
|
"""Update the current and best solutions."""
|
|
@@ -282,44 +265,24 @@ class SolutionPanels:
|
|
|
282
265
|
best_code = self.best_node.code if self.best_node is not None else ""
|
|
283
266
|
best_score = self.best_node.metric if self.best_node is not None else None
|
|
284
267
|
|
|
285
|
-
# Determine if code is too long (approximate)
|
|
286
|
-
current_lines = current_code.count("\n") + 1
|
|
287
|
-
best_lines = best_code.count("\n") + 1
|
|
288
|
-
|
|
289
268
|
# Current solution (without score)
|
|
290
269
|
current_title = f"[bold]💡 Current Solution (Step {current_step})"
|
|
291
270
|
current_panel = Panel(
|
|
292
|
-
Syntax(
|
|
293
|
-
str(current_code),
|
|
294
|
-
"python",
|
|
295
|
-
theme="monokai",
|
|
296
|
-
line_numbers=True,
|
|
297
|
-
word_wrap=False,
|
|
298
|
-
line_range=(0, self.max_lines), # Only show first max_lines lines
|
|
299
|
-
),
|
|
271
|
+
Syntax(str(current_code), "python", theme="monokai", line_numbers=True, word_wrap=False),
|
|
300
272
|
title=current_title,
|
|
301
273
|
border_style="yellow",
|
|
302
274
|
expand=True,
|
|
303
275
|
padding=(0, 1),
|
|
304
|
-
subtitle="[yellow]↓ truncated ↓[/]" if current_lines > self.max_lines else None,
|
|
305
276
|
)
|
|
306
277
|
|
|
307
278
|
# Best solution
|
|
308
279
|
best_title = f"[bold]🏆 Best Solution ([green]Score: {f'{best_score:.4f}' if best_score is not None else 'N/A'}[/])"
|
|
309
280
|
best_panel = Panel(
|
|
310
|
-
Syntax(
|
|
311
|
-
str(best_code),
|
|
312
|
-
"python",
|
|
313
|
-
theme="monokai",
|
|
314
|
-
line_numbers=True,
|
|
315
|
-
word_wrap=False,
|
|
316
|
-
line_range=(0, self.max_lines), # Only show first max_lines lines
|
|
317
|
-
),
|
|
281
|
+
Syntax(str(best_code), "python", theme="monokai", line_numbers=True, word_wrap=False),
|
|
318
282
|
title=best_title,
|
|
319
283
|
border_style="green",
|
|
320
284
|
expand=True,
|
|
321
285
|
padding=(0, 1),
|
|
322
|
-
subtitle="[yellow]↓ truncated ↓[/]" if best_lines > self.max_lines else None,
|
|
323
286
|
)
|
|
324
287
|
|
|
325
288
|
return current_panel, best_panel
|
|
@@ -13,12 +13,11 @@ import pathlib
|
|
|
13
13
|
def read_api_keys_from_env() -> Dict[str, Any]:
|
|
14
14
|
"""Read API keys from environment variables."""
|
|
15
15
|
keys = {}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
keys["ANTHROPIC_API_KEY"] = anthropic_api_key
|
|
16
|
+
keys_to_check = ["OPENAI_API_KEY", "ANTHROPIC_API_KEY", "GEMINI_API_KEY"]
|
|
17
|
+
for key in keys_to_check:
|
|
18
|
+
value = os.getenv(key)
|
|
19
|
+
if value is not None and len(value) > 0:
|
|
20
|
+
keys[key] = value
|
|
22
21
|
return keys
|
|
23
22
|
|
|
24
23
|
|
|
@@ -106,14 +105,3 @@ def run_evaluation(eval_command: str) -> str:
|
|
|
106
105
|
output += "\n"
|
|
107
106
|
output += result.stdout
|
|
108
107
|
return output
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
def truncate_text(text: str, max_lines: int) -> str:
|
|
112
|
-
"""Truncate text to a maximum number of lines."""
|
|
113
|
-
lines = text.split("\n")
|
|
114
|
-
if len(lines) > max_lines:
|
|
115
|
-
display_lines = lines[:max_lines]
|
|
116
|
-
display_text = "\n".join(display_lines)
|
|
117
|
-
else:
|
|
118
|
-
display_text = text
|
|
119
|
-
return display_text
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: weco
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Documentation for `weco`, a CLI for using Weco AI's code optimizer.
|
|
5
5
|
Author-email: Weco AI Team <dhruv@weco.ai>
|
|
6
6
|
License: MIT
|
|
@@ -49,6 +49,7 @@ The `weco` CLI leverages advanced optimization techniques and language model str
|
|
|
49
49
|
|
|
50
50
|
- **OpenAI:** `export OPENAI_API_KEY="your_key_here"`
|
|
51
51
|
- **Anthropic:** `export ANTHROPIC_API_KEY="your_key_here"`
|
|
52
|
+
- **Google DeepMind:** `export GEMINI_API_KEY="your_key_here"`
|
|
52
53
|
|
|
53
54
|
---
|
|
54
55
|
|
|
@@ -99,6 +100,7 @@ The CLI supports the following model providers:
|
|
|
99
100
|
|
|
100
101
|
- **OpenAI:** Set your API key using `OPENAI_API_KEY`.
|
|
101
102
|
- **Anthropic:** Set your API key using `ANTHROPIC_API_KEY`.
|
|
103
|
+
- **Google DeepMind:** Set your API key using `GEMINI_API_KEY`.
|
|
102
104
|
|
|
103
105
|
---
|
|
104
106
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|