lm-deluge 0.0.88__py3-none-any.whl → 0.0.90__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 lm-deluge might be problematic. Click here for more details.
- lm_deluge/__init__.py +0 -24
- lm_deluge/api_requests/anthropic.py +25 -5
- lm_deluge/api_requests/base.py +37 -0
- lm_deluge/api_requests/bedrock.py +23 -2
- lm_deluge/api_requests/gemini.py +36 -10
- lm_deluge/api_requests/openai.py +31 -4
- lm_deluge/batches.py +15 -45
- lm_deluge/client.py +27 -1
- lm_deluge/models/__init__.py +2 -0
- lm_deluge/models/anthropic.py +12 -12
- lm_deluge/models/google.py +13 -0
- lm_deluge/models/minimax.py +9 -1
- lm_deluge/models/openrouter.py +48 -0
- lm_deluge/models/zai.py +50 -1
- lm_deluge/pipelines/gepa/docs/samples.py +19 -10
- lm_deluge/prompt.py +333 -68
- lm_deluge/server/__init__.py +24 -0
- lm_deluge/server/__main__.py +144 -0
- lm_deluge/server/adapters.py +369 -0
- lm_deluge/server/app.py +388 -0
- lm_deluge/server/auth.py +71 -0
- lm_deluge/server/model_policy.py +215 -0
- lm_deluge/server/models_anthropic.py +172 -0
- lm_deluge/server/models_openai.py +175 -0
- lm_deluge/skills/anthropic.py +0 -0
- lm_deluge/skills/compat.py +0 -0
- lm_deluge/tool/__init__.py +13 -1
- lm_deluge/tool/prefab/sandbox/__init__.py +19 -0
- lm_deluge/tool/prefab/sandbox/daytona_sandbox.py +483 -0
- lm_deluge/tool/prefab/sandbox/docker_sandbox.py +609 -0
- lm_deluge/tool/prefab/sandbox/fargate_sandbox.py +546 -0
- lm_deluge/tool/prefab/sandbox/modal_sandbox.py +469 -0
- lm_deluge/tool/prefab/sandbox/seatbelt_sandbox.py +827 -0
- lm_deluge/tool/prefab/skills.py +0 -0
- {lm_deluge-0.0.88.dist-info → lm_deluge-0.0.90.dist-info}/METADATA +4 -3
- {lm_deluge-0.0.88.dist-info → lm_deluge-0.0.90.dist-info}/RECORD +39 -24
- lm_deluge/mock_openai.py +0 -643
- lm_deluge/tool/prefab/sandbox.py +0 -1621
- {lm_deluge-0.0.88.dist-info → lm_deluge-0.0.90.dist-info}/WHEEL +0 -0
- {lm_deluge-0.0.88.dist-info → lm_deluge-0.0.90.dist-info}/licenses/LICENSE +0 -0
- {lm_deluge-0.0.88.dist-info → lm_deluge-0.0.90.dist-info}/top_level.txt +0 -0
lm_deluge/models/zai.py
CHANGED
|
@@ -1 +1,50 @@
|
|
|
1
|
-
ZAI_MODELS = {
|
|
1
|
+
ZAI_MODELS = {
|
|
2
|
+
"glm-4.7": {
|
|
3
|
+
"id": "glm-4.7",
|
|
4
|
+
"name": "glm-4.7",
|
|
5
|
+
"api_base": "https://api.z.ai/api/anthropic/v1",
|
|
6
|
+
"api_key_env_var": "ZAI_API_KEY",
|
|
7
|
+
"supports_json": True,
|
|
8
|
+
"api_spec": "anthropic",
|
|
9
|
+
"input_cost": 0.6,
|
|
10
|
+
"cached_input_cost": 0.6,
|
|
11
|
+
"cache_write_cost": 0.6,
|
|
12
|
+
"output_cost": 2.20,
|
|
13
|
+
},
|
|
14
|
+
"glm-4.6": {
|
|
15
|
+
"id": "glm-4.6",
|
|
16
|
+
"name": "glm-4.6",
|
|
17
|
+
"api_base": "https://api.z.ai/api/anthropic/v1",
|
|
18
|
+
"api_key_env_var": "ZAI_API_KEY",
|
|
19
|
+
"supports_json": True,
|
|
20
|
+
"api_spec": "anthropic",
|
|
21
|
+
"input_cost": 0.6,
|
|
22
|
+
"cached_input_cost": 0.6,
|
|
23
|
+
"cache_write_cost": 0.6,
|
|
24
|
+
"output_cost": 2.20,
|
|
25
|
+
},
|
|
26
|
+
"glm-4.5": {
|
|
27
|
+
"id": "glm-4.5",
|
|
28
|
+
"name": "glm-4.5",
|
|
29
|
+
"api_base": "https://api.z.ai/api/anthropic/v1",
|
|
30
|
+
"api_key_env_var": "ZAI_API_KEY",
|
|
31
|
+
"supports_json": True,
|
|
32
|
+
"api_spec": "anthropic",
|
|
33
|
+
"input_cost": 0.6,
|
|
34
|
+
"cached_input_cost": 0.6,
|
|
35
|
+
"cache_write_cost": 0.6,
|
|
36
|
+
"output_cost": 2.20,
|
|
37
|
+
},
|
|
38
|
+
"glm-4.5-air": {
|
|
39
|
+
"id": "glm-4.5-air",
|
|
40
|
+
"name": "glm-4.5-air",
|
|
41
|
+
"api_base": "https://api.z.ai/api/anthropic/v1",
|
|
42
|
+
"api_key_env_var": "ZAI_API_KEY",
|
|
43
|
+
"supports_json": True,
|
|
44
|
+
"api_spec": "anthropic",
|
|
45
|
+
"input_cost": 0.6,
|
|
46
|
+
"cached_input_cost": 0.6,
|
|
47
|
+
"cache_write_cost": 0.6,
|
|
48
|
+
"output_cost": 2.20,
|
|
49
|
+
},
|
|
50
|
+
}
|
|
@@ -6,7 +6,11 @@ Features:
|
|
|
6
6
|
- Selects a parent (best-by-val), mutates a single component, and accepts only if
|
|
7
7
|
minibatch reward improves; accepted candidates get a full val eval and join the pool.
|
|
8
8
|
- Components: system_prompt, search_docstring, fetch_docstring.
|
|
9
|
-
- Rollouts are run via verifiers +
|
|
9
|
+
- Rollouts are run via verifiers + OpenAI SDK (pointing to lm-deluge proxy server); reflection uses LLMClient.
|
|
10
|
+
|
|
11
|
+
Prerequisites:
|
|
12
|
+
Start the lm-deluge proxy server first:
|
|
13
|
+
python -m lm_deluge.server --port 8000
|
|
10
14
|
|
|
11
15
|
Run:
|
|
12
16
|
uv run python gepa_lm_deluge_full.py --corpus-file ... --queries-file ... --env-file ...
|
|
@@ -31,8 +35,9 @@ from fts_bench import ( # type: ignore
|
|
|
31
35
|
)
|
|
32
36
|
from verifiers.utils.tool_utils import convert_func_to_oai_tool # type: ignore
|
|
33
37
|
|
|
34
|
-
from
|
|
35
|
-
|
|
38
|
+
from openai import AsyncOpenAI # type: ignore
|
|
39
|
+
|
|
40
|
+
from lm_deluge.client import LLMClient # type: ignore
|
|
36
41
|
from lm_deluge.util.json import try_load_json # type: ignore
|
|
37
42
|
|
|
38
43
|
# ---------------------- Helpers ---------------------- #
|
|
@@ -362,7 +367,12 @@ def parse_args() -> argparse.Namespace:
|
|
|
362
367
|
parser.add_argument(
|
|
363
368
|
"--model",
|
|
364
369
|
default="claude-5-mini",
|
|
365
|
-
help="Model for rollouts via
|
|
370
|
+
help="Model for rollouts via lm-deluge proxy server.",
|
|
371
|
+
)
|
|
372
|
+
parser.add_argument(
|
|
373
|
+
"--proxy-url",
|
|
374
|
+
default="http://localhost:8000/v1",
|
|
375
|
+
help="URL of the lm-deluge proxy server.",
|
|
366
376
|
)
|
|
367
377
|
parser.add_argument(
|
|
368
378
|
"--reflection-model",
|
|
@@ -437,7 +447,8 @@ def main() -> None:
|
|
|
437
447
|
val_records = [val_ds[i] for i in range(len(val_ds))]
|
|
438
448
|
question_key = _question_key_from_records(train_records or val_records) # noqa
|
|
439
449
|
|
|
440
|
-
|
|
450
|
+
# Create OpenAI client pointing to lm-deluge proxy server
|
|
451
|
+
rollout_client = AsyncOpenAI(base_url=args.proxy_url, api_key="not-needed")
|
|
441
452
|
reflection_client = LLMClient(args.reflection_model, progress="tqdm")
|
|
442
453
|
|
|
443
454
|
seed_candidate = {
|
|
@@ -478,11 +489,9 @@ def main() -> None:
|
|
|
478
489
|
merges_tested = 0
|
|
479
490
|
frontier = compute_val_frontier(population)
|
|
480
491
|
|
|
481
|
-
def print_rollout_usage(rollout_client:
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
print("Rollout client usage:")
|
|
485
|
-
client_obj.print_usage()
|
|
492
|
+
def print_rollout_usage(rollout_client: AsyncOpenAI):
|
|
493
|
+
# Usage tracking not available via proxy - would need server-side tracking
|
|
494
|
+
print("Rollout client: using lm-deluge proxy server")
|
|
486
495
|
|
|
487
496
|
for it in range(1, args.iterations + 1):
|
|
488
497
|
print(f"=== Starting iteration {it} ===")
|