lm-deluge 0.0.67__py3-none-any.whl → 0.0.88__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 +25 -2
- lm_deluge/api_requests/anthropic.py +92 -17
- lm_deluge/api_requests/base.py +47 -11
- lm_deluge/api_requests/bedrock.py +7 -4
- lm_deluge/api_requests/chat_reasoning.py +4 -0
- lm_deluge/api_requests/gemini.py +138 -18
- lm_deluge/api_requests/openai.py +114 -21
- lm_deluge/client.py +282 -49
- lm_deluge/config.py +15 -3
- lm_deluge/mock_openai.py +643 -0
- lm_deluge/models/__init__.py +12 -1
- lm_deluge/models/anthropic.py +17 -2
- lm_deluge/models/arcee.py +16 -0
- lm_deluge/models/deepseek.py +36 -4
- lm_deluge/models/google.py +29 -0
- lm_deluge/models/grok.py +24 -0
- lm_deluge/models/kimi.py +36 -0
- lm_deluge/models/minimax.py +10 -0
- lm_deluge/models/openai.py +100 -0
- lm_deluge/models/openrouter.py +86 -8
- lm_deluge/models/together.py +11 -0
- lm_deluge/models/zai.py +1 -0
- lm_deluge/pipelines/gepa/__init__.py +95 -0
- lm_deluge/pipelines/gepa/core.py +354 -0
- lm_deluge/pipelines/gepa/docs/samples.py +696 -0
- lm_deluge/pipelines/gepa/examples/01_synthetic_keywords.py +140 -0
- lm_deluge/pipelines/gepa/examples/02_gsm8k_math.py +261 -0
- lm_deluge/pipelines/gepa/examples/03_hotpotqa_multihop.py +300 -0
- lm_deluge/pipelines/gepa/examples/04_batch_classification.py +271 -0
- lm_deluge/pipelines/gepa/examples/simple_qa.py +129 -0
- lm_deluge/pipelines/gepa/optimizer.py +435 -0
- lm_deluge/pipelines/gepa/proposer.py +235 -0
- lm_deluge/pipelines/gepa/util.py +165 -0
- lm_deluge/{llm_tools → pipelines}/score.py +2 -2
- lm_deluge/{llm_tools → pipelines}/translate.py +5 -3
- lm_deluge/prompt.py +224 -40
- lm_deluge/request_context.py +7 -2
- lm_deluge/tool/__init__.py +1118 -0
- lm_deluge/tool/builtin/anthropic/__init__.py +300 -0
- lm_deluge/tool/builtin/gemini.py +59 -0
- lm_deluge/tool/builtin/openai.py +74 -0
- lm_deluge/tool/cua/__init__.py +173 -0
- lm_deluge/tool/cua/actions.py +148 -0
- lm_deluge/tool/cua/base.py +27 -0
- lm_deluge/tool/cua/batch.py +215 -0
- lm_deluge/tool/cua/converters.py +466 -0
- lm_deluge/tool/cua/kernel.py +702 -0
- lm_deluge/tool/cua/trycua.py +989 -0
- lm_deluge/tool/prefab/__init__.py +45 -0
- lm_deluge/tool/prefab/batch_tool.py +156 -0
- lm_deluge/tool/prefab/docs.py +1119 -0
- lm_deluge/tool/prefab/email.py +294 -0
- lm_deluge/tool/prefab/filesystem.py +1711 -0
- lm_deluge/tool/prefab/full_text_search/__init__.py +285 -0
- lm_deluge/tool/prefab/full_text_search/tantivy_index.py +396 -0
- lm_deluge/tool/prefab/memory.py +458 -0
- lm_deluge/tool/prefab/otc/__init__.py +165 -0
- lm_deluge/tool/prefab/otc/executor.py +281 -0
- lm_deluge/tool/prefab/otc/parse.py +188 -0
- lm_deluge/tool/prefab/random.py +212 -0
- lm_deluge/tool/prefab/rlm/__init__.py +296 -0
- lm_deluge/tool/prefab/rlm/executor.py +349 -0
- lm_deluge/tool/prefab/rlm/parse.py +144 -0
- lm_deluge/tool/prefab/sandbox.py +1621 -0
- lm_deluge/tool/prefab/sheets.py +385 -0
- lm_deluge/tool/prefab/subagents.py +233 -0
- lm_deluge/tool/prefab/todos.py +342 -0
- lm_deluge/tool/prefab/tool_search.py +169 -0
- lm_deluge/tool/prefab/web_search.py +199 -0
- lm_deluge/tracker.py +16 -13
- lm_deluge/util/schema.py +412 -0
- lm_deluge/warnings.py +8 -0
- {lm_deluge-0.0.67.dist-info → lm_deluge-0.0.88.dist-info}/METADATA +22 -9
- lm_deluge-0.0.88.dist-info/RECORD +117 -0
- lm_deluge/built_in_tools/anthropic/__init__.py +0 -128
- lm_deluge/built_in_tools/openai.py +0 -28
- lm_deluge/presets/cerebras.py +0 -17
- lm_deluge/presets/meta.py +0 -13
- lm_deluge/tool.py +0 -849
- lm_deluge-0.0.67.dist-info/RECORD +0 -72
- lm_deluge/{llm_tools → pipelines}/__init__.py +1 -1
- /lm_deluge/{llm_tools → pipelines}/classify.py +0 -0
- /lm_deluge/{llm_tools → pipelines}/extract.py +0 -0
- /lm_deluge/{llm_tools → pipelines}/locate.py +0 -0
- /lm_deluge/{llm_tools → pipelines}/ocr.py +0 -0
- /lm_deluge/{built_in_tools → tool/builtin}/anthropic/bash.py +0 -0
- /lm_deluge/{built_in_tools → tool/builtin}/anthropic/computer_use.py +0 -0
- /lm_deluge/{built_in_tools → tool/builtin}/anthropic/editor.py +0 -0
- /lm_deluge/{built_in_tools → tool/builtin}/base.py +0 -0
- {lm_deluge-0.0.67.dist-info → lm_deluge-0.0.88.dist-info}/WHEEL +0 -0
- {lm_deluge-0.0.67.dist-info → lm_deluge-0.0.88.dist-info}/licenses/LICENSE +0 -0
- {lm_deluge-0.0.67.dist-info → lm_deluge-0.0.88.dist-info}/top_level.txt +0 -0
lm_deluge/models/anthropic.py
CHANGED
|
@@ -10,6 +10,19 @@ ANTHROPIC_MODELS = {
|
|
|
10
10
|
# ░███
|
|
11
11
|
# █████
|
|
12
12
|
#
|
|
13
|
+
"claude-4.5-opus": {
|
|
14
|
+
"id": "claude-4.5-opus",
|
|
15
|
+
"name": "claude-opus-4-5-20251101",
|
|
16
|
+
"api_base": "https://api.anthropic.com/v1",
|
|
17
|
+
"api_key_env_var": "ANTHROPIC_API_KEY",
|
|
18
|
+
"supports_json": False,
|
|
19
|
+
"api_spec": "anthropic",
|
|
20
|
+
"input_cost": 5.0,
|
|
21
|
+
"cached_input_cost": 0.50,
|
|
22
|
+
"cache_write_cost": 6.25,
|
|
23
|
+
"output_cost": 25.0,
|
|
24
|
+
"reasoning_model": True,
|
|
25
|
+
},
|
|
13
26
|
"claude-4.5-haiku": {
|
|
14
27
|
"id": "claude-4.5-haiku",
|
|
15
28
|
"name": "claude-haiku-4-5-20251001",
|
|
@@ -21,25 +34,27 @@ ANTHROPIC_MODELS = {
|
|
|
21
34
|
"cached_input_cost": 0.10,
|
|
22
35
|
"cache_write_cost": 1.25,
|
|
23
36
|
"output_cost": 3.0,
|
|
37
|
+
"reasoning_model": True,
|
|
24
38
|
},
|
|
25
39
|
"claude-4.5-sonnet": {
|
|
26
40
|
"id": "claude-4.5-sonnet",
|
|
27
41
|
"name": "claude-sonnet-4-5-20250929",
|
|
28
42
|
"api_base": "https://api.anthropic.com/v1",
|
|
29
43
|
"api_key_env_var": "ANTHROPIC_API_KEY",
|
|
30
|
-
"supports_json":
|
|
44
|
+
"supports_json": True,
|
|
31
45
|
"api_spec": "anthropic",
|
|
32
46
|
"input_cost": 3.0,
|
|
33
47
|
"cached_input_cost": 0.30,
|
|
34
48
|
"cache_write_cost": 3.75,
|
|
35
49
|
"output_cost": 15.0,
|
|
50
|
+
"reasoning_model": True,
|
|
36
51
|
},
|
|
37
52
|
"claude-4.1-opus": {
|
|
38
53
|
"id": "claude-4.1-opus",
|
|
39
54
|
"name": "claude-opus-4-1-20250805",
|
|
40
55
|
"api_base": "https://api.anthropic.com/v1",
|
|
41
56
|
"api_key_env_var": "ANTHROPIC_API_KEY",
|
|
42
|
-
"supports_json":
|
|
57
|
+
"supports_json": True,
|
|
43
58
|
"api_spec": "anthropic",
|
|
44
59
|
"input_cost": 15.0,
|
|
45
60
|
"cached_input_cost": 1.50,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
ARCEE_MODELS = {
|
|
2
|
+
"trinity-mini": {
|
|
3
|
+
"id": "trinity-mini",
|
|
4
|
+
"name": "trinity-mini",
|
|
5
|
+
"api_base": "https://api.arcee.ai/api/v1",
|
|
6
|
+
"api_key_env_var": "ARCEE_API_KEY",
|
|
7
|
+
"supports_json": True,
|
|
8
|
+
"supports_logprobs": False,
|
|
9
|
+
"supports_responses": False,
|
|
10
|
+
"api_spec": "openai",
|
|
11
|
+
"input_cost": 0.045,
|
|
12
|
+
"cached_input_cost": 0.045,
|
|
13
|
+
"output_cost": 0.15,
|
|
14
|
+
"reasoning_model": True,
|
|
15
|
+
}
|
|
16
|
+
}
|
lm_deluge/models/deepseek.py
CHANGED
|
@@ -12,8 +12,9 @@ DEEPSEEK_MODELS = {
|
|
|
12
12
|
"api_base": "https://api.deepseek.com/v1",
|
|
13
13
|
"api_key_env_var": "DEEPSEEK_API_KEY",
|
|
14
14
|
"api_spec": "openai",
|
|
15
|
-
"input_cost": 0.
|
|
16
|
-
"
|
|
15
|
+
"input_cost": 0.28,
|
|
16
|
+
"cached_input_cost": 0.028,
|
|
17
|
+
"output_cost": 0.42,
|
|
17
18
|
},
|
|
18
19
|
"deepseek-r1": {
|
|
19
20
|
"id": "deepseek-r1",
|
|
@@ -21,7 +22,38 @@ DEEPSEEK_MODELS = {
|
|
|
21
22
|
"api_base": "https://api.deepseek.com/v1",
|
|
22
23
|
"api_key_env_var": "DEEPSEEK_API_KEY",
|
|
23
24
|
"api_spec": "openai",
|
|
24
|
-
"input_cost": 0.
|
|
25
|
-
"
|
|
25
|
+
"input_cost": 0.28,
|
|
26
|
+
"cached_input_cost": 0.028,
|
|
27
|
+
"output_cost": 0.42,
|
|
28
|
+
},
|
|
29
|
+
"deepseek-reasoner": {
|
|
30
|
+
"id": "deepseek-reasoner",
|
|
31
|
+
"name": "deepseek-reasoner",
|
|
32
|
+
"api_base": "https://api.deepseek.com/v1",
|
|
33
|
+
"api_key_env_var": "DEEPSEEK_API_KEY",
|
|
34
|
+
"api_spec": "openai",
|
|
35
|
+
"input_cost": 0.28,
|
|
36
|
+
"cached_input_cost": 0.028,
|
|
37
|
+
"output_cost": 0.42,
|
|
38
|
+
},
|
|
39
|
+
"deepseek-reasoner-anthropic-compat": {
|
|
40
|
+
"id": "deepseek-reasoner-anthropic-compat",
|
|
41
|
+
"name": "deepseek-reasoner",
|
|
42
|
+
"api_base": "https://api.deepseek.com/anthropic",
|
|
43
|
+
"api_key_env_var": "DEEPSEEK_API_KEY",
|
|
44
|
+
"api_spec": "anthropic",
|
|
45
|
+
"input_cost": 0.28,
|
|
46
|
+
"cached_input_cost": 0.028,
|
|
47
|
+
"output_cost": 0.42,
|
|
48
|
+
},
|
|
49
|
+
"deepseek-speciale": {
|
|
50
|
+
"id": "deepseek-speciale",
|
|
51
|
+
"name": "deepseek-reasoner",
|
|
52
|
+
"api_base": "https://api.deepseek.com/v3.2_speciale_expires_on_20251215/v1",
|
|
53
|
+
"api_key_env_var": "DEEPSEEK_API_KEY",
|
|
54
|
+
"api_spec": "openai",
|
|
55
|
+
"input_cost": 0.28,
|
|
56
|
+
"cached_input_cost": 0.028,
|
|
57
|
+
"output_cost": 0.42,
|
|
26
58
|
},
|
|
27
59
|
}
|
lm_deluge/models/google.py
CHANGED
|
@@ -138,4 +138,33 @@ GOOGLE_MODELS = {
|
|
|
138
138
|
"output_cost": 0.4,
|
|
139
139
|
"reasoning_model": True,
|
|
140
140
|
},
|
|
141
|
+
# Gemini 3 models - advanced reasoning with thought signatures
|
|
142
|
+
"gemini-3-pro-preview": {
|
|
143
|
+
"id": "gemini-3-pro-preview",
|
|
144
|
+
"name": "gemini-3-pro-preview",
|
|
145
|
+
"api_base": "https://generativelanguage.googleapis.com/v1alpha",
|
|
146
|
+
"api_key_env_var": "GEMINI_API_KEY",
|
|
147
|
+
"supports_json": True,
|
|
148
|
+
"supports_logprobs": False,
|
|
149
|
+
"api_spec": "gemini",
|
|
150
|
+
"input_cost": 2.0, # <200k tokens
|
|
151
|
+
"cached_input_cost": 0.5, # estimated
|
|
152
|
+
"output_cost": 12.0, # <200k tokens
|
|
153
|
+
# Note: >200k tokens pricing is $4/$18 per million
|
|
154
|
+
"reasoning_model": True,
|
|
155
|
+
},
|
|
156
|
+
# Gemini 2.5 Computer Use model
|
|
157
|
+
"gemini-2.5-computer-use": {
|
|
158
|
+
"id": "gemini-2.5-computer-use",
|
|
159
|
+
"name": "gemini-2.5-computer-use-preview-10-2025",
|
|
160
|
+
"api_base": "https://generativelanguage.googleapis.com/v1beta",
|
|
161
|
+
"api_key_env_var": "GEMINI_API_KEY",
|
|
162
|
+
"supports_json": True,
|
|
163
|
+
"supports_logprobs": False,
|
|
164
|
+
"api_spec": "gemini",
|
|
165
|
+
"input_cost": 1.25, # same as gemini-2.5-pro for now
|
|
166
|
+
"cached_input_cost": 0.31,
|
|
167
|
+
"output_cost": 10.0,
|
|
168
|
+
"reasoning_model": True,
|
|
169
|
+
},
|
|
141
170
|
}
|
lm_deluge/models/grok.py
CHANGED
|
@@ -7,6 +7,30 @@ XAI_MODELS = {
|
|
|
7
7
|
# 888 888 888 888 888 888888K
|
|
8
8
|
# Y88b d88P 888 Y88..88P 888 "88b
|
|
9
9
|
# "Y8888P88 888 "Y88P" 888 888
|
|
10
|
+
"grok-4.1-fast-reasoning": {
|
|
11
|
+
"id": "grok-4.1-fast-reasoning",
|
|
12
|
+
"name": "grok-4-1-fast-reasoning",
|
|
13
|
+
"api_base": "https://api.x.ai/v1",
|
|
14
|
+
"api_key_env_var": "GROK_API_KEY",
|
|
15
|
+
"supports_json": True,
|
|
16
|
+
"supports_logprobs": True,
|
|
17
|
+
"api_spec": "openai",
|
|
18
|
+
"input_cost": 0.2,
|
|
19
|
+
"output_cost": 1.5,
|
|
20
|
+
"reasoning_model": False,
|
|
21
|
+
},
|
|
22
|
+
"grok-4.1-fast": {
|
|
23
|
+
"id": "grok-4.1-fast",
|
|
24
|
+
"name": "grok-4-1-fast-non-reasoning",
|
|
25
|
+
"api_base": "https://api.x.ai/v1",
|
|
26
|
+
"api_key_env_var": "GROK_API_KEY",
|
|
27
|
+
"supports_json": True,
|
|
28
|
+
"supports_logprobs": True,
|
|
29
|
+
"api_spec": "openai",
|
|
30
|
+
"input_cost": 0.2,
|
|
31
|
+
"output_cost": 1.5,
|
|
32
|
+
"reasoning_model": False,
|
|
33
|
+
},
|
|
10
34
|
"grok-code-fast-1": {
|
|
11
35
|
"id": "grok-code-fast-1",
|
|
12
36
|
"name": "grok-code-fast-1",
|
lm_deluge/models/kimi.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
KIMI_MODELS = {
|
|
2
|
+
"kimi-k2": {
|
|
3
|
+
"id": "kimi-k2",
|
|
4
|
+
"name": "kimi-k2-0905-preview",
|
|
5
|
+
"api_base": "https://api.moonshot.ai/anthropic/v1",
|
|
6
|
+
"api_key_env_var": "MOONSHOT_API_KEY",
|
|
7
|
+
"supports_json": True,
|
|
8
|
+
"api_spec": "anthropic",
|
|
9
|
+
},
|
|
10
|
+
"kimi-k2-turbo": {
|
|
11
|
+
"id": "kimi-k2-turbo",
|
|
12
|
+
"name": "kimi-k2-turbo-preview",
|
|
13
|
+
"api_base": "https://api.moonshot.ai/anthropic/v1",
|
|
14
|
+
"api_key_env_var": "MOONSHOT_API_KEY",
|
|
15
|
+
"supports_json": True,
|
|
16
|
+
"api_spec": "anthropic",
|
|
17
|
+
},
|
|
18
|
+
"kimi-k2-thinking": {
|
|
19
|
+
"id": "kimi-k2-thinking",
|
|
20
|
+
"name": "kimi-k2-thinking",
|
|
21
|
+
"api_base": "https://api.moonshot.ai/anthropic/v1",
|
|
22
|
+
"api_key_env_var": "MOONSHOT_API_KEY",
|
|
23
|
+
"supports_json": True,
|
|
24
|
+
"api_spec": "anthropic",
|
|
25
|
+
"reasoning_model": True,
|
|
26
|
+
},
|
|
27
|
+
"kimi-k2-thinking-turbo": {
|
|
28
|
+
"id": "kimi-k2-thinking-turbo",
|
|
29
|
+
"name": "kimi-k2-thinking-turbo",
|
|
30
|
+
"api_base": "https://api.moonshot.ai/anthropic/v1",
|
|
31
|
+
"api_key_env_var": "MOONSHOT_API_KEY",
|
|
32
|
+
"supports_json": True,
|
|
33
|
+
"api_spec": "anthropic",
|
|
34
|
+
"reasoning_model": True,
|
|
35
|
+
},
|
|
36
|
+
}
|
lm_deluge/models/openai.py
CHANGED
|
@@ -10,6 +10,78 @@ OPENAI_MODELS = {
|
|
|
10
10
|
# ░███
|
|
11
11
|
# █████
|
|
12
12
|
# ░░░░░
|
|
13
|
+
"gpt-5.2": {
|
|
14
|
+
"id": "gpt-5.2",
|
|
15
|
+
"name": "gpt-5.2",
|
|
16
|
+
"api_base": "https://api.openai.com/v1",
|
|
17
|
+
"api_key_env_var": "OPENAI_API_KEY",
|
|
18
|
+
"supports_json": True,
|
|
19
|
+
"supports_logprobs": False,
|
|
20
|
+
"supports_responses": True,
|
|
21
|
+
"api_spec": "openai",
|
|
22
|
+
"input_cost": 1.75,
|
|
23
|
+
"cached_input_cost": 0.175,
|
|
24
|
+
"output_cost": 14.0,
|
|
25
|
+
"reasoning_model": True,
|
|
26
|
+
"supports_xhigh": True,
|
|
27
|
+
},
|
|
28
|
+
"gpt-5.1-codex-max": {
|
|
29
|
+
"id": "gpt-5.1-codex-max",
|
|
30
|
+
"name": "gpt-5.1-codex-max",
|
|
31
|
+
"api_base": "https://api.openai.com/v1",
|
|
32
|
+
"api_key_env_var": "OPENAI_API_KEY",
|
|
33
|
+
"supports_json": True,
|
|
34
|
+
"supports_logprobs": False,
|
|
35
|
+
"supports_responses": True,
|
|
36
|
+
"api_spec": "openai",
|
|
37
|
+
"input_cost": 1.25,
|
|
38
|
+
"cached_input_cost": 0.125,
|
|
39
|
+
"output_cost": 10.0,
|
|
40
|
+
"reasoning_model": True,
|
|
41
|
+
"supports_xhigh": True,
|
|
42
|
+
},
|
|
43
|
+
"gpt-5.1": {
|
|
44
|
+
"id": "gpt-5.1",
|
|
45
|
+
"name": "gpt-5.1",
|
|
46
|
+
"api_base": "https://api.openai.com/v1",
|
|
47
|
+
"api_key_env_var": "OPENAI_API_KEY",
|
|
48
|
+
"supports_json": True,
|
|
49
|
+
"supports_logprobs": True,
|
|
50
|
+
"supports_responses": True,
|
|
51
|
+
"api_spec": "openai",
|
|
52
|
+
"input_cost": 1.25,
|
|
53
|
+
"cached_input_cost": 0.125,
|
|
54
|
+
"output_cost": 10.0,
|
|
55
|
+
"reasoning_model": True,
|
|
56
|
+
},
|
|
57
|
+
"gpt-5.1-codex": {
|
|
58
|
+
"id": "gpt-5.1-codex",
|
|
59
|
+
"name": "gpt-5.1-codex",
|
|
60
|
+
"api_base": "https://api.openai.com/v1",
|
|
61
|
+
"api_key_env_var": "OPENAI_API_KEY",
|
|
62
|
+
"supports_json": False,
|
|
63
|
+
"supports_logprobs": True,
|
|
64
|
+
"supports_responses": True,
|
|
65
|
+
"api_spec": "openai",
|
|
66
|
+
"input_cost": 1.25,
|
|
67
|
+
"cached_input_cost": 0.125,
|
|
68
|
+
"output_cost": 10.0,
|
|
69
|
+
"reasoning_model": True,
|
|
70
|
+
},
|
|
71
|
+
"gpt-5.1-codex-mini": {
|
|
72
|
+
"id": "gpt-5.1-codex-mini",
|
|
73
|
+
"name": "gpt-5.1-codex-mini",
|
|
74
|
+
"api_base": "https://api.openai.com/v1",
|
|
75
|
+
"api_key_env_var": "OPENAI_API_KEY",
|
|
76
|
+
"supports_json": False,
|
|
77
|
+
"supports_logprobs": True,
|
|
78
|
+
"supports_responses": True,
|
|
79
|
+
"api_spec": "openai",
|
|
80
|
+
"input_cost": 0.25,
|
|
81
|
+
"cached_input_cost": 0.025,
|
|
82
|
+
"output_cost": 2.0,
|
|
83
|
+
"reasoning_model": True,
|
|
84
|
+
},
|
|
13
85
|
"gpt-5-codex": {
|
|
14
86
|
"id": "gpt-5-codex",
|
|
15
87
|
"name": "gpt-5-codex",
|
|
@@ -107,6 +179,34 @@ OPENAI_MODELS = {
|
|
|
107
179
|
"output_cost": 6.0,
|
|
108
180
|
"reasoning_model": True,
|
|
109
181
|
},
|
|
182
|
+
"o4-mini-deep-research": {
|
|
183
|
+
"id": "o4-mini-deep-research",
|
|
184
|
+
"name": "o4-mini-deep-research",
|
|
185
|
+
"api_base": "https://api.openai.com/v1",
|
|
186
|
+
"api_key_env_var": "OPENAI_API_KEY",
|
|
187
|
+
"supports_json": True,
|
|
188
|
+
"supports_logprobs": False,
|
|
189
|
+
"supports_responses": True,
|
|
190
|
+
"api_spec": "openai",
|
|
191
|
+
"input_cost": 2,
|
|
192
|
+
"cached_input_cost": 0.5,
|
|
193
|
+
"output_cost": 8.0,
|
|
194
|
+
"reasoning_model": True,
|
|
195
|
+
},
|
|
196
|
+
"o3-deep-research": {
|
|
197
|
+
"id": "o3-deep-research",
|
|
198
|
+
"name": "o3-deep-research",
|
|
199
|
+
"api_base": "https://api.openai.com/v1",
|
|
200
|
+
"api_key_env_var": "OPENAI_API_KEY",
|
|
201
|
+
"supports_json": True,
|
|
202
|
+
"supports_logprobs": False,
|
|
203
|
+
"supports_responses": True,
|
|
204
|
+
"api_spec": "openai",
|
|
205
|
+
"input_cost": 10,
|
|
206
|
+
"cached_input_cost": 2.50,
|
|
207
|
+
"output_cost": 40.0,
|
|
208
|
+
"reasoning_model": True,
|
|
209
|
+
},
|
|
110
210
|
"o3": {
|
|
111
211
|
"id": "o3",
|
|
112
212
|
"name": "o3-2025-04-16",
|
lm_deluge/models/openrouter.py
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
OPENROUTER_MODELS = {
|
|
2
|
+
"intellect-3-openrouter": {
|
|
3
|
+
"id": "intellect-3-openrouter",
|
|
4
|
+
"name": "prime-intellect/intellect-3",
|
|
5
|
+
"api_base": "https://openrouter.ai/api/v1",
|
|
6
|
+
"api_key_env_var": "OPENROUTER_API_KEY",
|
|
7
|
+
"supports_json": True,
|
|
8
|
+
"api_spec": "openai",
|
|
9
|
+
"input_cost": 0.2,
|
|
10
|
+
"cached_input_cost": 0.2,
|
|
11
|
+
"cache_write_cost": 0.2,
|
|
12
|
+
"output_cost": 1.10,
|
|
13
|
+
},
|
|
2
14
|
"glm-4.6-openrouter": {
|
|
3
15
|
"id": "glm-4.6-openrouter",
|
|
4
|
-
"name": "z-ai/glm-4.6",
|
|
16
|
+
"name": "z-ai/glm-4.6:exacto",
|
|
5
17
|
"api_base": "https://openrouter.ai/api/v1",
|
|
6
18
|
"api_key_env_var": "OPENROUTER_API_KEY",
|
|
7
19
|
"supports_json": True,
|
|
8
20
|
"api_spec": "openai",
|
|
9
21
|
"input_cost": 0.6,
|
|
10
|
-
"cached_input_cost": 0.
|
|
22
|
+
"cached_input_cost": 0.6,
|
|
11
23
|
"cache_write_cost": 0.6,
|
|
12
24
|
"output_cost": 2.20,
|
|
13
25
|
},
|
|
@@ -35,9 +47,21 @@ OPENROUTER_MODELS = {
|
|
|
35
47
|
"cache_write_cost": 0.23,
|
|
36
48
|
"output_cost": 0.9,
|
|
37
49
|
},
|
|
50
|
+
"deepseek-3.2-exp-openrouter": {
|
|
51
|
+
"id": "deepseek-3.2-exp-openrouter",
|
|
52
|
+
"name": "deepseek/deepseek-v3.2-exp",
|
|
53
|
+
"api_base": "https://openrouter.ai/api/v1",
|
|
54
|
+
"api_key_env_var": "OPENROUTER_API_KEY",
|
|
55
|
+
"supports_json": True,
|
|
56
|
+
"api_spec": "openai",
|
|
57
|
+
"input_cost": 0.27,
|
|
58
|
+
"cached_input_cost": 0.27,
|
|
59
|
+
"cache_write_cost": 0.27,
|
|
60
|
+
"output_cost": 0.4,
|
|
61
|
+
},
|
|
38
62
|
"deepseek-3.2-openrouter": {
|
|
39
63
|
"id": "deepseek-3.2-openrouter",
|
|
40
|
-
"name": "deepseek/deepseek-v3.2
|
|
64
|
+
"name": "deepseek/deepseek-v3.2",
|
|
41
65
|
"api_base": "https://openrouter.ai/api/v1",
|
|
42
66
|
"api_key_env_var": "OPENROUTER_API_KEY",
|
|
43
67
|
"supports_json": True,
|
|
@@ -47,18 +71,72 @@ OPENROUTER_MODELS = {
|
|
|
47
71
|
"cache_write_cost": 0.27,
|
|
48
72
|
"output_cost": 0.4,
|
|
49
73
|
},
|
|
50
|
-
|
|
51
|
-
|
|
74
|
+
"gpt-oss-20b-openrouter": {
|
|
75
|
+
"id": "gpt-oss-20b-openrouter",
|
|
76
|
+
"name": "openai/gpt-oss-20b",
|
|
77
|
+
"api_base": "https://openrouter.ai/api/v1",
|
|
78
|
+
"api_key_env_var": "OPENROUTER_API_KEY",
|
|
79
|
+
"supports_json": True,
|
|
80
|
+
"api_spec": "openai",
|
|
81
|
+
"input_cost": 0.04,
|
|
82
|
+
"cached_input_cost": 0.04,
|
|
83
|
+
"cache_write_cost": 0.04,
|
|
84
|
+
"output_cost": 0.18,
|
|
85
|
+
},
|
|
86
|
+
"gpt-oss-120b-openrouter": {
|
|
87
|
+
"id": "gpt-oss-120b-openrouter",
|
|
88
|
+
"name": "openai/gpt-oss-120b",
|
|
89
|
+
"api_base": "https://openrouter.ai/api/v1",
|
|
90
|
+
"api_key_env_var": "OPENROUTER_API_KEY",
|
|
91
|
+
"supports_json": True,
|
|
92
|
+
"api_spec": "openai",
|
|
93
|
+
"input_cost": 0.05,
|
|
94
|
+
"cached_input_cost": 0.05,
|
|
95
|
+
"cache_write_cost": 0.05,
|
|
96
|
+
"output_cost": 0.45,
|
|
97
|
+
},
|
|
52
98
|
"kimi-k2-openrouter": {
|
|
53
99
|
"id": "kimi-k2-openrouter",
|
|
54
|
-
"name": "
|
|
100
|
+
"name": "moonshotai/kimi-k2-0905:exacto",
|
|
101
|
+
"api_base": "https://openrouter.ai/api/v1",
|
|
102
|
+
"api_key_env_var": "OPENROUTER_API_KEY",
|
|
103
|
+
"supports_json": True,
|
|
104
|
+
"api_spec": "openai",
|
|
105
|
+
"input_cost": 1,
|
|
106
|
+
"cached_input_cost": 1,
|
|
107
|
+
"cache_write_cost": 1,
|
|
108
|
+
"output_cost": 3,
|
|
109
|
+
},
|
|
110
|
+
"kimi-k2-thinking-openrouter": {
|
|
111
|
+
"id": "kimi-k2-thinking-openrouter",
|
|
112
|
+
"name": "moonshotai/kimi-k2-thinking",
|
|
55
113
|
"api_base": "https://openrouter.ai/api/v1",
|
|
56
114
|
"api_key_env_var": "OPENROUTER_API_KEY",
|
|
57
115
|
"supports_json": True,
|
|
58
116
|
"api_spec": "openai",
|
|
59
117
|
"input_cost": 0.6,
|
|
60
|
-
"cached_input_cost": 0.
|
|
118
|
+
"cached_input_cost": 0.6,
|
|
61
119
|
"cache_write_cost": 0.6,
|
|
62
|
-
"output_cost": 2.
|
|
120
|
+
"output_cost": 2.5,
|
|
121
|
+
},
|
|
122
|
+
"olmo-3-32b-think-openrouter": {
|
|
123
|
+
"id": "olmo-3-32b-think-openrouter",
|
|
124
|
+
"name": "allenai/olmo-3-32b-think",
|
|
125
|
+
"api_base": "https://openrouter.ai/api/v1",
|
|
126
|
+
"api_key_env_var": "OPENROUTER_API_KEY",
|
|
127
|
+
"supports_json": True,
|
|
128
|
+
"api_spec": "openai",
|
|
129
|
+
"input_cost": 0.2,
|
|
130
|
+
"output_cost": 35,
|
|
131
|
+
},
|
|
132
|
+
"trinity-mini-openrouter": {
|
|
133
|
+
"id": "trinity-mini-openrouter",
|
|
134
|
+
"name": "arcee-ai/trinity-mini:free",
|
|
135
|
+
"api_base": "https://openrouter.ai/api/v1",
|
|
136
|
+
"api_key_env_var": "OPENROUTER_API_KEY",
|
|
137
|
+
"supports_json": True,
|
|
138
|
+
"api_spec": "openai",
|
|
139
|
+
"input_cost": 0.045,
|
|
140
|
+
"output_cost": 0.15,
|
|
63
141
|
},
|
|
64
142
|
}
|
lm_deluge/models/together.py
CHANGED
|
@@ -93,4 +93,15 @@ TOGETHER_MODELS = {
|
|
|
93
93
|
"output_cost": 0.59,
|
|
94
94
|
"reasoning_model": True,
|
|
95
95
|
},
|
|
96
|
+
"trinity-mini-together": {
|
|
97
|
+
"id": "trinity-mini-together",
|
|
98
|
+
"name": "arcee-ai/trinity-mini",
|
|
99
|
+
"api_base": "https://api.together.xyz/v1",
|
|
100
|
+
"api_key_env_var": "TOGETHER_API_KEY",
|
|
101
|
+
"supports_json": False,
|
|
102
|
+
"api_spec": "openai",
|
|
103
|
+
"input_cost": 0.18,
|
|
104
|
+
"output_cost": 0.59,
|
|
105
|
+
"reasoning_model": True,
|
|
106
|
+
},
|
|
96
107
|
}
|
lm_deluge/models/zai.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ZAI_MODELS = {}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""
|
|
2
|
+
GEPA (Genetic Pareto) prompt optimizer for lm-deluge.
|
|
3
|
+
|
|
4
|
+
This module provides an evolutionary optimizer for text components in AI systems.
|
|
5
|
+
It analyzes whole trajectories to propose improvements to prompts, tool descriptions,
|
|
6
|
+
and other text-based configuration.
|
|
7
|
+
|
|
8
|
+
Example usage:
|
|
9
|
+
from lm_deluge import LLMClient
|
|
10
|
+
from lm_deluge.prompt import Conversation, Message
|
|
11
|
+
from lm_deluge.pipelines.gepa import Component, EvalResult, optimize
|
|
12
|
+
|
|
13
|
+
# Define components to optimize
|
|
14
|
+
components = {
|
|
15
|
+
"system_prompt": Component(
|
|
16
|
+
description="Instructions given to the model",
|
|
17
|
+
value="You are a helpful assistant.",
|
|
18
|
+
),
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
# Define how to evaluate one example
|
|
22
|
+
def evaluate(client: LLMClient, values: dict[str, str], example: dict) -> EvalResult:
|
|
23
|
+
# Build prompt with current component values
|
|
24
|
+
conv = Conversation.system(values["system_prompt"])
|
|
25
|
+
conv = conv.add(Message.user(example["question"]))
|
|
26
|
+
|
|
27
|
+
# Run inference
|
|
28
|
+
response = client.process_prompts_sync([conv], show_progress=False)[0]
|
|
29
|
+
answer = response.completion
|
|
30
|
+
|
|
31
|
+
# Score the result
|
|
32
|
+
correct = example["answer"].lower() in answer.lower()
|
|
33
|
+
score = 1.0 if correct else 0.0
|
|
34
|
+
|
|
35
|
+
# Build feedback for the proposer
|
|
36
|
+
feedback = f"Score: {score}. Expected: {example['answer']}"
|
|
37
|
+
|
|
38
|
+
# Return full trajectory
|
|
39
|
+
full_conv = conv.add(Message.ai(answer))
|
|
40
|
+
return EvalResult(conversation=full_conv, score=score, feedback=feedback)
|
|
41
|
+
|
|
42
|
+
# Run optimization
|
|
43
|
+
result = optimize(
|
|
44
|
+
components=components,
|
|
45
|
+
evaluate_fn=evaluate,
|
|
46
|
+
dataset=train_examples,
|
|
47
|
+
task_client=LLMClient("gpt-4o-mini"),
|
|
48
|
+
proposer_client=LLMClient("gpt-4o"),
|
|
49
|
+
max_iterations=50,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
print(f"Best score: {result.best_score}")
|
|
53
|
+
print(f"Best prompt: {result.best_candidate['system_prompt']}")
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
from lm_deluge.pipelines.gepa.core import (
|
|
57
|
+
Component,
|
|
58
|
+
EvalResult,
|
|
59
|
+
GEPAResult,
|
|
60
|
+
GEPAState,
|
|
61
|
+
Proposal,
|
|
62
|
+
)
|
|
63
|
+
from lm_deluge.pipelines.gepa.optimizer import GEPAEngine, optimize
|
|
64
|
+
from lm_deluge.pipelines.gepa.proposer import (
|
|
65
|
+
DEFAULT_PROPOSAL_PROMPT,
|
|
66
|
+
build_proposal_prompt,
|
|
67
|
+
parse_proposal_response,
|
|
68
|
+
propose_improvement_sync,
|
|
69
|
+
)
|
|
70
|
+
from lm_deluge.pipelines.gepa.util import (
|
|
71
|
+
extract_text_from_response,
|
|
72
|
+
format_components_for_prompt,
|
|
73
|
+
format_conversation_compact,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
__all__ = [
|
|
77
|
+
# Core types
|
|
78
|
+
"Component",
|
|
79
|
+
"EvalResult",
|
|
80
|
+
"Proposal",
|
|
81
|
+
"GEPAState",
|
|
82
|
+
"GEPAResult",
|
|
83
|
+
# Main API
|
|
84
|
+
"optimize",
|
|
85
|
+
"GEPAEngine",
|
|
86
|
+
# Proposer utilities
|
|
87
|
+
"DEFAULT_PROPOSAL_PROMPT",
|
|
88
|
+
"build_proposal_prompt",
|
|
89
|
+
"parse_proposal_response",
|
|
90
|
+
"propose_improvement_sync",
|
|
91
|
+
# Formatting utilities
|
|
92
|
+
"format_conversation_compact",
|
|
93
|
+
"format_components_for_prompt",
|
|
94
|
+
"extract_text_from_response",
|
|
95
|
+
]
|