lm-deluge 0.0.56__py3-none-any.whl → 0.0.58__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 +2 -1
- lm_deluge/api_requests/anthropic.py +1 -1
- lm_deluge/client.py +34 -21
- lm_deluge/models/__init__.py +7 -7
- lm_deluge/models/anthropic.py +12 -20
- lm_deluge/models/bedrock.py +0 -14
- lm_deluge/models/cohere.py +0 -16
- lm_deluge/models/google.py +0 -20
- lm_deluge/models/grok.py +48 -4
- lm_deluge/models/groq.py +2 -2
- lm_deluge/models/meta.py +0 -8
- lm_deluge/models/openai.py +0 -34
- lm_deluge/models/openrouter.py +64 -1
- lm_deluge/models/together.py +0 -16
- lm_deluge/prompt.py +6 -7
- lm_deluge/tool.py +338 -18
- lm_deluge/tracker.py +11 -5
- {lm_deluge-0.0.56.dist-info → lm_deluge-0.0.58.dist-info}/METADATA +1 -1
- {lm_deluge-0.0.56.dist-info → lm_deluge-0.0.58.dist-info}/RECORD +22 -24
- lm_deluge/agent.py +0 -0
- lm_deluge/gemini_limits.py +0 -65
- {lm_deluge-0.0.56.dist-info → lm_deluge-0.0.58.dist-info}/WHEEL +0 -0
- {lm_deluge-0.0.56.dist-info → lm_deluge-0.0.58.dist-info}/licenses/LICENSE +0 -0
- {lm_deluge-0.0.56.dist-info → lm_deluge-0.0.58.dist-info}/top_level.txt +0 -0
lm_deluge/models/openai.py
CHANGED
|
@@ -77,8 +77,6 @@ OPENAI_MODELS = {
|
|
|
77
77
|
"api_spec": "openai",
|
|
78
78
|
"input_cost": 3.0,
|
|
79
79
|
"output_cost": 12.0,
|
|
80
|
-
"requests_per_minute": 20,
|
|
81
|
-
"tokens_per_minute": 100_000,
|
|
82
80
|
"reasoning_model": False,
|
|
83
81
|
},
|
|
84
82
|
"o3": {
|
|
@@ -93,8 +91,6 @@ OPENAI_MODELS = {
|
|
|
93
91
|
"input_cost": 2.0,
|
|
94
92
|
"cached_input_cost": 0.50,
|
|
95
93
|
"output_cost": 8.0,
|
|
96
|
-
"requests_per_minute": 20,
|
|
97
|
-
"tokens_per_minute": 100_000,
|
|
98
94
|
"reasoning_model": True,
|
|
99
95
|
},
|
|
100
96
|
"o4-mini": {
|
|
@@ -109,8 +105,6 @@ OPENAI_MODELS = {
|
|
|
109
105
|
"input_cost": 1.1,
|
|
110
106
|
"cached_input_cost": 0.275,
|
|
111
107
|
"output_cost": 4.4,
|
|
112
|
-
"requests_per_minute": 20,
|
|
113
|
-
"tokens_per_minute": 100_000,
|
|
114
108
|
"reasoning_model": True,
|
|
115
109
|
},
|
|
116
110
|
"gpt-4.1": {
|
|
@@ -125,8 +119,6 @@ OPENAI_MODELS = {
|
|
|
125
119
|
"input_cost": 2.0,
|
|
126
120
|
"cached_input_cost": 0.50,
|
|
127
121
|
"output_cost": 8.0,
|
|
128
|
-
"requests_per_minute": 20,
|
|
129
|
-
"tokens_per_minute": 100_000,
|
|
130
122
|
"reasoning_model": False,
|
|
131
123
|
},
|
|
132
124
|
"gpt-4.1-mini": {
|
|
@@ -141,8 +133,6 @@ OPENAI_MODELS = {
|
|
|
141
133
|
"input_cost": 0.4,
|
|
142
134
|
"cached_input_cost": 0.10,
|
|
143
135
|
"output_cost": 1.6,
|
|
144
|
-
"requests_per_minute": 20,
|
|
145
|
-
"tokens_per_minute": 100_000,
|
|
146
136
|
"reasoning_model": False,
|
|
147
137
|
},
|
|
148
138
|
"gpt-4.1-nano": {
|
|
@@ -157,8 +147,6 @@ OPENAI_MODELS = {
|
|
|
157
147
|
"input_cost": 0.1,
|
|
158
148
|
"cached_input_cost": 0.025,
|
|
159
149
|
"output_cost": 0.4,
|
|
160
|
-
"requests_per_minute": 20,
|
|
161
|
-
"tokens_per_minute": 100_000,
|
|
162
150
|
"reasoning_model": False,
|
|
163
151
|
},
|
|
164
152
|
"gpt-4.5": {
|
|
@@ -172,8 +160,6 @@ OPENAI_MODELS = {
|
|
|
172
160
|
"api_spec": "openai",
|
|
173
161
|
"input_cost": 75.0,
|
|
174
162
|
"output_cost": 150.0,
|
|
175
|
-
"requests_per_minute": 20,
|
|
176
|
-
"tokens_per_minute": 100_000,
|
|
177
163
|
"reasoning_model": False,
|
|
178
164
|
},
|
|
179
165
|
"o3-mini": {
|
|
@@ -188,8 +174,6 @@ OPENAI_MODELS = {
|
|
|
188
174
|
"input_cost": 1.1,
|
|
189
175
|
"cached_input_cost": 0.55,
|
|
190
176
|
"output_cost": 4.4,
|
|
191
|
-
"requests_per_minute": 20,
|
|
192
|
-
"tokens_per_minute": 100_000,
|
|
193
177
|
"reasoning_model": True,
|
|
194
178
|
},
|
|
195
179
|
"o1": {
|
|
@@ -204,8 +188,6 @@ OPENAI_MODELS = {
|
|
|
204
188
|
"input_cost": 15.0,
|
|
205
189
|
"cached_input_cost": 7.50,
|
|
206
190
|
"output_cost": 60.0,
|
|
207
|
-
"requests_per_minute": 20,
|
|
208
|
-
"tokens_per_minute": 100_000,
|
|
209
191
|
"reasoning_model": True,
|
|
210
192
|
},
|
|
211
193
|
"o1-preview": {
|
|
@@ -219,8 +201,6 @@ OPENAI_MODELS = {
|
|
|
219
201
|
"api_spec": "openai",
|
|
220
202
|
"input_cost": 15.0,
|
|
221
203
|
"output_cost": 60.0,
|
|
222
|
-
"requests_per_minute": 20,
|
|
223
|
-
"tokens_per_minute": 100_000,
|
|
224
204
|
"reasoning_model": True,
|
|
225
205
|
},
|
|
226
206
|
"o1-mini": {
|
|
@@ -235,8 +215,6 @@ OPENAI_MODELS = {
|
|
|
235
215
|
"input_cost": 1.1,
|
|
236
216
|
"cached_input_cost": 0.55,
|
|
237
217
|
"output_cost": 4.4,
|
|
238
|
-
"requests_per_minute": 20,
|
|
239
|
-
"tokens_per_minute": 100_000,
|
|
240
218
|
"reasoning_model": True,
|
|
241
219
|
},
|
|
242
220
|
"gpt-4o": {
|
|
@@ -251,8 +229,6 @@ OPENAI_MODELS = {
|
|
|
251
229
|
"input_cost": 2.50,
|
|
252
230
|
"cached_input_cost": 1.25,
|
|
253
231
|
"output_cost": 10.0,
|
|
254
|
-
"requests_per_minute": 10_000,
|
|
255
|
-
"tokens_per_minute": 30_000_000,
|
|
256
232
|
},
|
|
257
233
|
"gpt-4o-mini": {
|
|
258
234
|
"id": "gpt-4o-mini",
|
|
@@ -266,8 +242,6 @@ OPENAI_MODELS = {
|
|
|
266
242
|
"input_cost": 0.15,
|
|
267
243
|
"cached_input_cost": 0.075,
|
|
268
244
|
"output_cost": 0.6,
|
|
269
|
-
"requests_per_minute": 60_000,
|
|
270
|
-
"tokens_per_minute": 250_000_000,
|
|
271
245
|
},
|
|
272
246
|
"gpt-3.5-turbo": {
|
|
273
247
|
"id": "gpt-3.5-turbo",
|
|
@@ -280,8 +254,6 @@ OPENAI_MODELS = {
|
|
|
280
254
|
"api_spec": "openai",
|
|
281
255
|
"input_cost": 0.5,
|
|
282
256
|
"output_cost": 1.5,
|
|
283
|
-
"requests_per_minute": 40_000,
|
|
284
|
-
"tokens_per_minute": 75_000_000,
|
|
285
257
|
},
|
|
286
258
|
"gpt-4-turbo": {
|
|
287
259
|
"id": "gpt-4-turbo",
|
|
@@ -294,8 +266,6 @@ OPENAI_MODELS = {
|
|
|
294
266
|
"api_spec": "openai",
|
|
295
267
|
"input_cost": 10.0,
|
|
296
268
|
"output_cost": 30.0,
|
|
297
|
-
"requests_per_minute": 10_000,
|
|
298
|
-
"tokens_per_minute": 1_500_000,
|
|
299
269
|
},
|
|
300
270
|
"gpt-4": {
|
|
301
271
|
"id": "gpt-4",
|
|
@@ -308,8 +278,6 @@ OPENAI_MODELS = {
|
|
|
308
278
|
"api_spec": "openai",
|
|
309
279
|
"input_cost": 30.0,
|
|
310
280
|
"output_cost": 60.0,
|
|
311
|
-
"requests_per_minute": 10_000,
|
|
312
|
-
"tokens_per_minute": 300_000,
|
|
313
281
|
},
|
|
314
282
|
"gpt-4-32k": {
|
|
315
283
|
"id": "gpt-4-32k",
|
|
@@ -322,7 +290,5 @@ OPENAI_MODELS = {
|
|
|
322
290
|
"api_spec": "openai",
|
|
323
291
|
"input_cost": 60.0,
|
|
324
292
|
"output_cost": 120.0,
|
|
325
|
-
"requests_per_minute": 1_000,
|
|
326
|
-
"tokens_per_minute": 150_000,
|
|
327
293
|
},
|
|
328
294
|
}
|
lm_deluge/models/openrouter.py
CHANGED
|
@@ -1 +1,64 @@
|
|
|
1
|
-
OPENROUTER_MODELS = {
|
|
1
|
+
OPENROUTER_MODELS = {
|
|
2
|
+
"glm-4.6-openrouter": {
|
|
3
|
+
"id": "glm-4.6-openrouter",
|
|
4
|
+
"name": "z-ai/glm-4.6",
|
|
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.6,
|
|
10
|
+
"cached_input_cost": 0.11,
|
|
11
|
+
"cache_write_cost": 0.6,
|
|
12
|
+
"output_cost": 2.20,
|
|
13
|
+
},
|
|
14
|
+
"deepseek-r1-openrouter": {
|
|
15
|
+
"id": "deepseek-r1-openrouter",
|
|
16
|
+
"name": "deepseek/deepseek-r1-0528",
|
|
17
|
+
"api_base": "https://openrouter.ai/api/v1",
|
|
18
|
+
"api_key_env_var": "OPENROUTER_API_KEY",
|
|
19
|
+
"supports_json": True,
|
|
20
|
+
"api_spec": "openai",
|
|
21
|
+
"input_cost": 0.40,
|
|
22
|
+
"cached_input_cost": 0.40,
|
|
23
|
+
"cache_write_cost": 0.40,
|
|
24
|
+
"output_cost": 1.75,
|
|
25
|
+
},
|
|
26
|
+
"deepseek-3.1-openrouter": {
|
|
27
|
+
"id": "deepseek-3.1-openrouter",
|
|
28
|
+
"name": "deepseek/deepseek-v3.1-terminus",
|
|
29
|
+
"api_base": "https://openrouter.ai/api/v1",
|
|
30
|
+
"api_key_env_var": "OPENROUTER_API_KEY",
|
|
31
|
+
"supports_json": True,
|
|
32
|
+
"api_spec": "openai",
|
|
33
|
+
"input_cost": 0.23,
|
|
34
|
+
"cached_input_cost": 0.23,
|
|
35
|
+
"cache_write_cost": 0.23,
|
|
36
|
+
"output_cost": 0.9,
|
|
37
|
+
},
|
|
38
|
+
"deepseek-3.2-openrouter": {
|
|
39
|
+
"id": "deepseek-3.2-openrouter",
|
|
40
|
+
"name": "deepseek/deepseek-v3.2-exp",
|
|
41
|
+
"api_base": "https://openrouter.ai/api/v1",
|
|
42
|
+
"api_key_env_var": "OPENROUTER_API_KEY",
|
|
43
|
+
"supports_json": True,
|
|
44
|
+
"api_spec": "openai",
|
|
45
|
+
"input_cost": 0.27,
|
|
46
|
+
"cached_input_cost": 0.27,
|
|
47
|
+
"cache_write_cost": 0.27,
|
|
48
|
+
"output_cost": 0.4,
|
|
49
|
+
},
|
|
50
|
+
# "gpt-oss-20b-openrouter": {},
|
|
51
|
+
# "gpt-oss-120b-openrouter": {},
|
|
52
|
+
"kimi-k2-openrouter": {
|
|
53
|
+
"id": "kimi-k2-openrouter",
|
|
54
|
+
"name": "z-ai/glm-4.6",
|
|
55
|
+
"api_base": "https://openrouter.ai/api/v1",
|
|
56
|
+
"api_key_env_var": "OPENROUTER_API_KEY",
|
|
57
|
+
"supports_json": True,
|
|
58
|
+
"api_spec": "openai",
|
|
59
|
+
"input_cost": 0.6,
|
|
60
|
+
"cached_input_cost": 0.11,
|
|
61
|
+
"cache_write_cost": 0.6,
|
|
62
|
+
"output_cost": 2.20,
|
|
63
|
+
},
|
|
64
|
+
}
|
lm_deluge/models/together.py
CHANGED
|
@@ -20,8 +20,6 @@ TOGETHER_MODELS = {
|
|
|
20
20
|
"api_spec": "openai",
|
|
21
21
|
"input_cost": 3.0,
|
|
22
22
|
"output_cost": 7.0,
|
|
23
|
-
"requests_per_minute": None,
|
|
24
|
-
"tokens_per_minute": None,
|
|
25
23
|
},
|
|
26
24
|
"deepseek-v3-together": {
|
|
27
25
|
"id": "deepseek-v3-together",
|
|
@@ -32,8 +30,6 @@ TOGETHER_MODELS = {
|
|
|
32
30
|
"api_spec": "openai",
|
|
33
31
|
"input_cost": 1.25,
|
|
34
32
|
"output_cost": 1.25,
|
|
35
|
-
"requests_per_minute": None,
|
|
36
|
-
"tokens_per_minute": None,
|
|
37
33
|
},
|
|
38
34
|
"qwen-3-235b-together": {
|
|
39
35
|
"id": "qwen-3-235b-together",
|
|
@@ -44,8 +40,6 @@ TOGETHER_MODELS = {
|
|
|
44
40
|
"api_spec": "openai",
|
|
45
41
|
"input_cost": 0.2,
|
|
46
42
|
"output_cost": 0.6,
|
|
47
|
-
"requests_per_minute": None,
|
|
48
|
-
"tokens_per_minute": None,
|
|
49
43
|
},
|
|
50
44
|
"qwen-2.5-vl-together": {
|
|
51
45
|
"id": "qwen-2.5-vl-together",
|
|
@@ -56,8 +50,6 @@ TOGETHER_MODELS = {
|
|
|
56
50
|
"api_spec": "openai",
|
|
57
51
|
"input_cost": 1.95,
|
|
58
52
|
"output_cost": 8.0,
|
|
59
|
-
"requests_per_minute": None,
|
|
60
|
-
"tokens_per_minute": None,
|
|
61
53
|
},
|
|
62
54
|
"llama-4-maverick-together": {
|
|
63
55
|
"id": "llama-4-maverick-together",
|
|
@@ -68,8 +60,6 @@ TOGETHER_MODELS = {
|
|
|
68
60
|
"api_spec": "openai",
|
|
69
61
|
"input_cost": 0.27,
|
|
70
62
|
"output_cost": 0.85,
|
|
71
|
-
"requests_per_minute": None,
|
|
72
|
-
"tokens_per_minute": None,
|
|
73
63
|
},
|
|
74
64
|
"llama-4-scout-together": {
|
|
75
65
|
"id": "llama-4-scout-together",
|
|
@@ -80,8 +70,6 @@ TOGETHER_MODELS = {
|
|
|
80
70
|
"api_spec": "openai",
|
|
81
71
|
"input_cost": 0.18,
|
|
82
72
|
"output_cost": 0.59,
|
|
83
|
-
"requests_per_minute": None,
|
|
84
|
-
"tokens_per_minute": None,
|
|
85
73
|
},
|
|
86
74
|
"gpt-oss-120b-together": {
|
|
87
75
|
"id": "gpt-oss-120b-together",
|
|
@@ -92,8 +80,6 @@ TOGETHER_MODELS = {
|
|
|
92
80
|
"api_spec": "openai",
|
|
93
81
|
"input_cost": 0.18,
|
|
94
82
|
"output_cost": 0.59,
|
|
95
|
-
"requests_per_minute": None,
|
|
96
|
-
"tokens_per_minute": None,
|
|
97
83
|
"reasoning_model": True,
|
|
98
84
|
},
|
|
99
85
|
"gpt-oss-20b-together": {
|
|
@@ -105,8 +91,6 @@ TOGETHER_MODELS = {
|
|
|
105
91
|
"api_spec": "openai",
|
|
106
92
|
"input_cost": 0.18,
|
|
107
93
|
"output_cost": 0.59,
|
|
108
|
-
"requests_per_minute": None,
|
|
109
|
-
"tokens_per_minute": None,
|
|
110
94
|
"reasoning_model": True,
|
|
111
95
|
},
|
|
112
96
|
}
|
lm_deluge/prompt.py
CHANGED
|
@@ -144,8 +144,8 @@ class ToolResult:
|
|
|
144
144
|
def oa_chat(
|
|
145
145
|
self,
|
|
146
146
|
) -> dict: # OpenAI Chat Completions - tool results are separate messages
|
|
147
|
-
print("serializing toolresult with oa_chat...")
|
|
148
|
-
print("typeof self.result:", type(self.result))
|
|
147
|
+
# print("serializing toolresult with oa_chat...")
|
|
148
|
+
# print("typeof self.result:", type(self.result))
|
|
149
149
|
if isinstance(self.result, str):
|
|
150
150
|
return {
|
|
151
151
|
"role": "tool",
|
|
@@ -174,8 +174,7 @@ class ToolResult:
|
|
|
174
174
|
raise ValueError("result type not supported")
|
|
175
175
|
|
|
176
176
|
def oa_resp(self) -> dict: # OpenAI Responses
|
|
177
|
-
print("
|
|
178
|
-
print("typeof self.result:", type(self.result))
|
|
177
|
+
# print("typeof self.result:", type(self.result))
|
|
179
178
|
# if normal (not built-in just return the regular output
|
|
180
179
|
if not self.built_in:
|
|
181
180
|
result = (
|
|
@@ -466,7 +465,7 @@ class Message:
|
|
|
466
465
|
self.parts.append(ToolCall(id=id, name=name, arguments=arguments))
|
|
467
466
|
return self
|
|
468
467
|
|
|
469
|
-
def
|
|
468
|
+
def with_tool_result(
|
|
470
469
|
self, tool_call_id: str, result: str | list[ToolResultPart]
|
|
471
470
|
) -> "Message":
|
|
472
471
|
"""Append a tool result block and return self for chaining."""
|
|
@@ -1189,11 +1188,11 @@ class Conversation:
|
|
|
1189
1188
|
"""
|
|
1190
1189
|
if self.messages and self.messages[-1].role == "tool":
|
|
1191
1190
|
# Append to existing tool message (parallel tool calls)
|
|
1192
|
-
self.messages[-1].
|
|
1191
|
+
self.messages[-1].with_tool_result(tool_call_id, result)
|
|
1193
1192
|
else:
|
|
1194
1193
|
# Create new tool message
|
|
1195
1194
|
tool_msg = Message("tool", [])
|
|
1196
|
-
tool_msg.
|
|
1195
|
+
tool_msg.with_tool_result(tool_call_id, result)
|
|
1197
1196
|
self.messages.append(tool_msg)
|
|
1198
1197
|
return self
|
|
1199
1198
|
|