weco 0.3.2__py3-none-any.whl → 0.3.3__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/api.py +1 -2
- weco/cli.py +2 -2
- weco/optimizer.py +2 -19
- {weco-0.3.2.dist-info → weco-0.3.3.dist-info}/METADATA +29 -95
- {weco-0.3.2.dist-info → weco-0.3.3.dist-info}/RECORD +9 -9
- {weco-0.3.2.dist-info → weco-0.3.3.dist-info}/WHEEL +0 -0
- {weco-0.3.2.dist-info → weco-0.3.3.dist-info}/entry_points.txt +0 -0
- {weco-0.3.2.dist-info → weco-0.3.3.dist-info}/licenses/LICENSE +0 -0
- {weco-0.3.2.dist-info → weco-0.3.3.dist-info}/top_level.txt +0 -0
weco/api.py
CHANGED
|
@@ -178,7 +178,6 @@ def evaluate_feedback_then_suggest_next_solution(
|
|
|
178
178
|
run_id: str,
|
|
179
179
|
step: int,
|
|
180
180
|
execution_output: str,
|
|
181
|
-
additional_instructions: str = None,
|
|
182
181
|
auth_headers: dict = {},
|
|
183
182
|
timeout: Union[int, Tuple[int, int]] = (10, 3650),
|
|
184
183
|
) -> Dict[str, Any]:
|
|
@@ -189,7 +188,7 @@ def evaluate_feedback_then_suggest_next_solution(
|
|
|
189
188
|
|
|
190
189
|
response = requests.post(
|
|
191
190
|
f"{__base_url__}/runs/{run_id}/suggest",
|
|
192
|
-
json={"execution_output": truncated_output, "
|
|
191
|
+
json={"execution_output": truncated_output, "metadata": {}},
|
|
193
192
|
headers=auth_headers,
|
|
194
193
|
timeout=timeout,
|
|
195
194
|
)
|
weco/cli.py
CHANGED
|
@@ -49,7 +49,7 @@ def configure_run_parser(run_parser: argparse.ArgumentParser) -> None:
|
|
|
49
49
|
"--model",
|
|
50
50
|
type=str,
|
|
51
51
|
default=None,
|
|
52
|
-
help="Model to use for optimization. Defaults to `o4-mini
|
|
52
|
+
help="Model to use for optimization. Defaults to `o4-mini`. See full list at https://docs.weco.ai/cli/supported-models",
|
|
53
53
|
)
|
|
54
54
|
run_parser.add_argument(
|
|
55
55
|
"-l", "--log-dir", type=str, default=".runs", help="Directory to store logs and results. Defaults to `.runs`."
|
|
@@ -164,7 +164,7 @@ def main() -> None:
|
|
|
164
164
|
"--model",
|
|
165
165
|
type=str,
|
|
166
166
|
default=None,
|
|
167
|
-
help="Model to use for optimization. Defaults to `o4-mini
|
|
167
|
+
help="Model to use for optimization. Defaults to `o4-mini`. See full list at docs.weco.ai/cli/supported-models",
|
|
168
168
|
)
|
|
169
169
|
|
|
170
170
|
subparsers = parser.add_subparsers(
|
weco/optimizer.py
CHANGED
|
@@ -337,8 +337,6 @@ def execute_optimization(
|
|
|
337
337
|
|
|
338
338
|
# Starting from step 1 to steps (inclusive) because the baseline solution is step 0, so we want to optimize for steps worth of steps
|
|
339
339
|
for step in range(1, steps + 1):
|
|
340
|
-
# Re-read instructions from the original source (file path or string) BEFORE each suggest call
|
|
341
|
-
current_additional_instructions = read_additional_instructions(additional_instructions=additional_instructions)
|
|
342
340
|
if run_id:
|
|
343
341
|
try:
|
|
344
342
|
current_status_response = get_optimization_run_status(
|
|
@@ -356,12 +354,7 @@ def execute_optimization(
|
|
|
356
354
|
|
|
357
355
|
# Send feedback and get next suggestion
|
|
358
356
|
eval_and_next_solution_response = evaluate_feedback_then_suggest_next_solution(
|
|
359
|
-
console=console,
|
|
360
|
-
step=step,
|
|
361
|
-
run_id=run_id,
|
|
362
|
-
execution_output=term_out,
|
|
363
|
-
additional_instructions=current_additional_instructions,
|
|
364
|
-
auth_headers=auth_headers,
|
|
357
|
+
console=console, step=step, run_id=run_id, execution_output=term_out, auth_headers=auth_headers
|
|
365
358
|
)
|
|
366
359
|
# Save next solution (.runs/<run-id>/step_<step>.<extension>)
|
|
367
360
|
write_to_path(fp=runs_dir / f"step_{step}{source_fp.suffix}", content=eval_and_next_solution_response["code"])
|
|
@@ -415,16 +408,9 @@ def execute_optimization(
|
|
|
415
408
|
)
|
|
416
409
|
|
|
417
410
|
if not user_stop_requested_flag:
|
|
418
|
-
# Re-read instructions from the original source (file path or string) BEFORE each suggest call
|
|
419
|
-
current_additional_instructions = read_additional_instructions(additional_instructions=additional_instructions)
|
|
420
411
|
# Evaluate the final solution thats been generated
|
|
421
412
|
eval_and_next_solution_response = evaluate_feedback_then_suggest_next_solution(
|
|
422
|
-
console=console,
|
|
423
|
-
step=steps,
|
|
424
|
-
run_id=run_id,
|
|
425
|
-
execution_output=term_out,
|
|
426
|
-
additional_instructions=current_additional_instructions,
|
|
427
|
-
auth_headers=auth_headers,
|
|
413
|
+
console=console, step=steps, run_id=run_id, execution_output=term_out, auth_headers=auth_headers
|
|
428
414
|
)
|
|
429
415
|
summary_panel.set_step(step=steps)
|
|
430
416
|
status_response = get_optimization_run_status(
|
|
@@ -632,7 +618,6 @@ def resume_optimization(run_id: str, console: Optional[Console] = None) -> bool:
|
|
|
632
618
|
log_dir = resume_resp.get("log_dir", ".runs")
|
|
633
619
|
save_logs = bool(resume_resp.get("save_logs", False))
|
|
634
620
|
eval_timeout = resume_resp.get("eval_timeout")
|
|
635
|
-
additional_instructions = resume_resp.get("additional_instructions")
|
|
636
621
|
|
|
637
622
|
# Write last solution code to source path
|
|
638
623
|
source_fp = pathlib.Path(source_path)
|
|
@@ -739,7 +724,6 @@ def resume_optimization(run_id: str, console: Optional[Console] = None) -> bool:
|
|
|
739
724
|
step=step,
|
|
740
725
|
run_id=resume_resp["run_id"],
|
|
741
726
|
execution_output=term_out,
|
|
742
|
-
additional_instructions=additional_instructions,
|
|
743
727
|
auth_headers=auth_headers,
|
|
744
728
|
)
|
|
745
729
|
|
|
@@ -795,7 +779,6 @@ def resume_optimization(run_id: str, console: Optional[Console] = None) -> bool:
|
|
|
795
779
|
step=total_steps,
|
|
796
780
|
run_id=resume_resp["run_id"],
|
|
797
781
|
execution_output=term_out,
|
|
798
|
-
additional_instructions=additional_instructions,
|
|
799
782
|
auth_headers=auth_headers,
|
|
800
783
|
)
|
|
801
784
|
summary_panel.set_step(step=total_steps)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: weco
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
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:
|
|
@@ -230,7 +230,7 @@ Dynamic: license-file
|
|
|
230
230
|
|
|
231
231
|
<div align="center">
|
|
232
232
|
<img src="assets/weco.svg" alt="Weco Logo" width="120" height="120" style="margin-bottom: 20px;">
|
|
233
|
-
<h1>Weco: The
|
|
233
|
+
<h1>Weco: The Code Optimization Agent</h1>
|
|
234
234
|
</div>
|
|
235
235
|
|
|
236
236
|
[](https://www.python.org)
|
|
@@ -238,7 +238,7 @@ Dynamic: license-file
|
|
|
238
238
|
[](https://docs.weco.ai/)
|
|
239
239
|
[](https://pepy.tech/projects/weco)
|
|
240
240
|
[](https://arxiv.org/abs/2502.13138)
|
|
241
|
-
[](https://colab.research.google.com/github/WecoAI/weco-cli/blob/main/examples/hello-
|
|
241
|
+
[](https://colab.research.google.com/github/WecoAI/weco-cli/blob/main/examples/hello-world/colab_notebook_walkthrough.ipynb)
|
|
242
242
|
|
|
243
243
|
`pip install weco`
|
|
244
244
|
|
|
@@ -262,77 +262,32 @@ Example applications include:
|
|
|
262
262
|
|
|
263
263
|
The `weco` CLI leverages a tree search approach guided by LLMs to iteratively explore and refine your code. It automatically applies changes, runs your evaluation script, parses the results, and proposes further improvements based on the specified goal.
|
|
264
264
|
|
|
265
|
-

|
|
266
265
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
## Setup
|
|
270
|
-
|
|
271
|
-
1. **Install the Package:**
|
|
272
|
-
|
|
273
|
-
```bash
|
|
274
|
-
pip install weco
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
2. **Authenticate (Required):**
|
|
278
|
-
|
|
279
|
-
`weco` now uses a **credit-based billing system** with centralized LLM access. You need to authenticate to use the service:
|
|
280
|
-
|
|
281
|
-
- **Run the CLI**: `weco` will prompt you to authenticate via your web browser
|
|
282
|
-
- **Free Credits**: New users receive **free credits** upon signup
|
|
283
|
-
- **Centralized Keys**: All LLM provider API keys are managed by Weco (no BYOK required)
|
|
284
|
-
- **Credit Top-ups**: Purchase additional credits through the dashboard at [dashboard.weco.ai](https://dashboard.weco.ai)
|
|
285
|
-
|
|
286
|
-
---
|
|
287
|
-
|
|
288
|
-
## Get Started
|
|
289
|
-
|
|
290
|
-
### Quick Start (Recommended for New Users)
|
|
291
|
-
|
|
292
|
-
The easiest way to get started with Weco is to use the **interactive copilot**. Simply navigate to your project directory and run:
|
|
293
|
-
|
|
294
|
-
```bash
|
|
295
|
-
weco
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
Or specify a project path:
|
|
266
|
+
## Install the Package
|
|
299
267
|
|
|
300
268
|
```bash
|
|
301
|
-
weco
|
|
269
|
+
pip install weco
|
|
302
270
|
```
|
|
303
271
|
|
|
304
|
-
|
|
272
|
+
## Getting Started
|
|
305
273
|
|
|
306
|
-
|
|
307
|
-
2. **Suggest specific optimizations** tailored to your code (e.g., GPU kernel optimization, model improvements, prompt engineering)
|
|
308
|
-
3. **Generate evaluation scripts** automatically or help you configure existing ones
|
|
309
|
-
4. **Set up the complete optimization pipeline** with appropriate metrics and commands
|
|
310
|
-
5. **Run the optimization** or provide you with the exact command to execute
|
|
311
|
-
|
|
312
|
-
<div style="background-color: #fff3cd; border: 1px solid #ffeeba; padding: 15px; border-radius: 4px; margin-bottom: 15px;">
|
|
313
|
-
<strong>⚠️ Warning: Code Modification</strong><br>
|
|
314
|
-
<code>weco</code> directly modifies the file specified by <code>--source</code> during the optimization process. It is <strong>strongly recommended</strong> to use version control (like Git) to track changes and revert if needed. Alternatively, ensure you have a backup of your original file before running the command. Upon completion, the file will contain the best-performing version of the code found during the run.
|
|
315
|
-
</div>
|
|
316
|
-
|
|
317
|
-
### Manual Setup
|
|
274
|
+
### Quickstart with an example project
|
|
318
275
|
|
|
319
276
|
**Configure optimization parameters yourself** - If you need precise control over the optimization parameters, you can use the direct `weco run` command:
|
|
320
277
|
|
|
321
278
|
**Example: Optimizing Simple PyTorch Operations**
|
|
322
279
|
|
|
323
280
|
```bash
|
|
324
|
-
|
|
325
|
-
cd examples/hello-
|
|
326
|
-
|
|
327
|
-
# Install dependencies
|
|
328
|
-
pip install torch
|
|
281
|
+
git clone https://github.com/WecoAI/weco-cli.git
|
|
282
|
+
cd weco-cli/examples/hello-world/
|
|
283
|
+
pip install -r requirements.txt
|
|
329
284
|
|
|
330
|
-
# Run Weco with
|
|
331
|
-
weco run --source
|
|
332
|
-
--eval-command "python evaluate.py --
|
|
285
|
+
# Run Weco with configuration
|
|
286
|
+
weco run --source module.py \
|
|
287
|
+
--eval-command "python evaluate.py --path module.py" \
|
|
333
288
|
--metric speedup \
|
|
334
289
|
--goal maximize \
|
|
335
|
-
--steps
|
|
290
|
+
--steps 10 \
|
|
336
291
|
--additional-instructions "Fuse operations in the forward method while ensuring the max float deviation remains small. Maintain the same format of the code."
|
|
337
292
|
```
|
|
338
293
|
|
|
@@ -362,7 +317,7 @@ For more advanced examples, including [Triton](/examples/triton/README.md), [CUD
|
|
|
362
317
|
| Argument | Description | Default | Example |
|
|
363
318
|
| :----------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------ |
|
|
364
319
|
| `-n, --steps` | Number of optimization steps (LLM iterations) to run. | 100 | `-n 50` |
|
|
365
|
-
| `-M, --model` | Model identifier for the LLM to use (e.g., `o4-mini`, `claude-sonnet-4-
|
|
320
|
+
| `-M, --model` | Model identifier for the LLM to use (e.g., `o4-mini`, `claude-sonnet-4-5`, `gpt-5`). | `o4-mini` | `-M o4-mini` |
|
|
366
321
|
| `-i, --additional-instructions`| Natural language description of specific instructions **or** path to a file containing detailed instructions to guide the LLM. Supported file formats include - `.txt`, `.md`, and `.rst`. | `None` | `-i instructions.md` or `-i "Optimize the model for faster inference"`|
|
|
367
322
|
| `-l, --log-dir` | Path to the directory to log intermediate steps and final optimization result. | `.runs/` | `-l ./logs/` |
|
|
368
323
|
| `--eval-timeout` | Timeout in seconds for each step in evaluation. | No timeout (unlimited) | `--eval-timeout 3600` |
|
|
@@ -370,37 +325,12 @@ For more advanced examples, including [Triton](/examples/triton/README.md), [CUD
|
|
|
370
325
|
|
|
371
326
|
---
|
|
372
327
|
|
|
373
|
-
### Authentication & Dashboard
|
|
374
|
-
|
|
375
|
-
The CLI requires a Weco account for authentication and billing.
|
|
376
|
-
|
|
377
|
-
#### Credit-Based Authentication (Required)
|
|
378
|
-
Weco now requires authentication for all operations. This enables our credit-based billing system and provides access to powerful optimizations:
|
|
379
|
-
|
|
380
|
-
1. **During onboarding**: When you run `weco` for the first time, you'll be prompted to log in
|
|
381
|
-
2. **Manual login**: Use `weco logout` to clear credentials, then run `weco` again to re-authenticate
|
|
382
|
-
3. **Device flow**: Weco will open your browser automatically and guide you through a secure OAuth-style authentication
|
|
383
|
-
|
|
384
|
-

|
|
385
|
-
|
|
386
|
-
**Benefits:**
|
|
387
|
-
- **No API Key Management**: All LLM provider keys are managed centrally
|
|
388
|
-
- **Cost Transparency**: See exactly how many credits each optimization consumes
|
|
389
|
-
- **Free Trial**: Free credits to get started with optimization projects
|
|
390
|
-
- **Run History**: View all your optimization runs on the Weco dashboard
|
|
391
|
-
- **Progress Tracking**: Monitor long-running optimizations remotely
|
|
392
|
-
- **Budget Control**: Set spending limits and auto top-up preferences
|
|
393
|
-
|
|
394
|
-
---
|
|
395
|
-
|
|
396
328
|
## Command Reference
|
|
397
329
|
|
|
398
330
|
### Basic Usage Patterns
|
|
399
331
|
|
|
400
332
|
| Command | Description | When to Use |
|
|
401
333
|
|---------|-------------|-------------|
|
|
402
|
-
| `weco` | Launch interactive onboarding | **Recommended for beginners** - Analyzes your codebase and guides you through setup |
|
|
403
|
-
| `weco /path/to/project` | Launch onboarding for specific project | When working with a project in a different directory |
|
|
404
334
|
| `weco run [options]` | Direct optimization execution | **For advanced users** - When you know exactly what to optimize and how |
|
|
405
335
|
| `weco resume <run-id>` | Resume an interrupted run | Continue from the last completed step |
|
|
406
336
|
| `weco logout` | Clear authentication credentials | To switch accounts or troubleshoot authentication issues |
|
|
@@ -410,19 +340,23 @@ Weco now requires authentication for all operations. This enables our credit-bas
|
|
|
410
340
|
You can specify which LLM model to use with the `-M` or `--model` flag:
|
|
411
341
|
|
|
412
342
|
```bash
|
|
413
|
-
|
|
414
|
-
weco --model gpt-4o
|
|
415
|
-
|
|
416
|
-
# Use with direct execution
|
|
417
|
-
weco run --model claude-3.5-sonnet --source optimize.py [other options...]
|
|
343
|
+
weco run --model gpt-5 --source optimize.py [other options...]
|
|
418
344
|
```
|
|
419
345
|
|
|
420
|
-
**Available models:**
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
- `
|
|
346
|
+
**Available models (30 total):**
|
|
347
|
+
|
|
348
|
+
**OpenAI Models:**
|
|
349
|
+
- GPT-5 Series: `gpt-5.1`, `gpt-5.1-codex`, `gpt-5.1-codex-mini`, `gpt-5-codex`, `gpt-5-pro`, `gpt-5`, `gpt-5-mini`, `gpt-5-nano`
|
|
350
|
+
- O-Series Reasoning: `o3-pro`, `o3`, `o3-mini`, `o4-mini`, `o1-pro`, `o1`, `codex-mini-latest`
|
|
351
|
+
- GPT-4 Series: `gpt-4.1`, `gpt-4.1-mini`, `gpt-4.1-nano`, `gpt-4o`, `gpt-4o-mini`
|
|
352
|
+
|
|
353
|
+
**Anthropic Claude (via Vertex AI):**
|
|
354
|
+
- `claude-opus-4-5`, `claude-opus-4-1`, `claude-opus-4`, `claude-sonnet-4-5`, `claude-sonnet-4`, `claude-haiku-4-5`
|
|
355
|
+
|
|
356
|
+
**Google Gemini:**
|
|
357
|
+
- `gemini-3-pro-preview`, `gemini-2.5-pro`, `gemini-2.5-flash`, `gemini-2.5-flash-lite`
|
|
424
358
|
|
|
425
|
-
All models are available through Weco
|
|
359
|
+
All models are available through Weco. If no model is specified, Weco automatically selects the best model for your optimization task.
|
|
426
360
|
|
|
427
361
|
---
|
|
428
362
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
weco/__init__.py,sha256=ClO0uT6GKOA0iSptvP0xbtdycf0VpoPTq37jHtvlhtw,303
|
|
2
|
-
weco/api.py,sha256=
|
|
2
|
+
weco/api.py,sha256=zKcI4riwruK6CjV_vcL8RlsJGRXO40iP0WxeETtzPIY,18430
|
|
3
3
|
weco/auth.py,sha256=O31Hoj-Loi8DWJJG2LfeWgUMuNqAUeGDpd2ZGjA9Ah0,9997
|
|
4
4
|
weco/chatbot.py,sha256=EIK2WaOul9gn_yHLThjsZV7RnE8t3XQPwgRkO5tybSU,38415
|
|
5
|
-
weco/cli.py,sha256=
|
|
5
|
+
weco/cli.py,sha256=5TusCKQ8o4CUdqxOSkvWyjMzt86O9sj21SJoeU0Ni5w,11098
|
|
6
6
|
weco/constants.py,sha256=V6yFugTznKm5EC2_jr4I_whd7sqI80HiPggRn0az580,406
|
|
7
7
|
weco/credits.py,sha256=C08x-TRcLg3ccfKqMGNRY7zBn7t3r7LZ119bxgfztaI,7629
|
|
8
|
-
weco/optimizer.py,sha256=
|
|
8
|
+
weco/optimizer.py,sha256=nOKFmwPdFLcQ7RF4ielsD7iRfPMxvGr07pS9ocbW9C8,41282
|
|
9
9
|
weco/panels.py,sha256=fnGPtmvxpx21AuBCtCFu1f_BpSxybNr2lhjIIKIutrY,16133
|
|
10
10
|
weco/utils.py,sha256=erDDrA_g3KSlel6YEAGALlV_k8ftT-VQnPT1BrmzK8k,7021
|
|
11
|
-
weco-0.3.
|
|
12
|
-
weco-0.3.
|
|
13
|
-
weco-0.3.
|
|
14
|
-
weco-0.3.
|
|
15
|
-
weco-0.3.
|
|
16
|
-
weco-0.3.
|
|
11
|
+
weco-0.3.3.dist-info/licenses/LICENSE,sha256=9LUfoGHjLPtak2zps2kL2tm65HAZIICx_FbLaRuS4KU,11337
|
|
12
|
+
weco-0.3.3.dist-info/METADATA,sha256=aAE9oMp_SKJiQSG189k7fsb5ovvidj2t1DTuqNfvc68,28700
|
|
13
|
+
weco-0.3.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
+
weco-0.3.3.dist-info/entry_points.txt,sha256=ixJ2uClALbCpBvnIR6BXMNck8SHAab8eVkM9pIUowcs,39
|
|
15
|
+
weco-0.3.3.dist-info/top_level.txt,sha256=F0N7v6e2zBSlsorFv-arAq2yDxQbzX3KVO8GxYhPUeE,5
|
|
16
|
+
weco-0.3.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|