lm-deluge 0.0.8__py3-none-any.whl → 0.0.10__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/api_requests/anthropic.py +23 -7
- lm_deluge/api_requests/base.py +38 -11
- lm_deluge/api_requests/bedrock.py +283 -0
- lm_deluge/api_requests/common.py +2 -0
- lm_deluge/api_requests/mistral.py +2 -2
- lm_deluge/api_requests/openai.py +37 -6
- lm_deluge/client.py +18 -3
- lm_deluge/models.py +89 -24
- lm_deluge/prompt.py +352 -16
- lm_deluge/tool.py +212 -38
- {lm_deluge-0.0.8.dist-info → lm_deluge-0.0.10.dist-info}/METADATA +4 -1
- {lm_deluge-0.0.8.dist-info → lm_deluge-0.0.10.dist-info}/RECORD +15 -14
- {lm_deluge-0.0.8.dist-info → lm_deluge-0.0.10.dist-info}/WHEEL +0 -0
- {lm_deluge-0.0.8.dist-info → lm_deluge-0.0.10.dist-info}/licenses/LICENSE +0 -0
- {lm_deluge-0.0.8.dist-info → lm_deluge-0.0.10.dist-info}/top_level.txt +0 -0
lm_deluge/client.py
CHANGED
|
@@ -9,6 +9,7 @@ from typing import Sequence, overload, Literal, Any
|
|
|
9
9
|
from tqdm.auto import tqdm
|
|
10
10
|
|
|
11
11
|
from lm_deluge.prompt import Conversation
|
|
12
|
+
from lm_deluge.tool import Tool
|
|
12
13
|
|
|
13
14
|
from .tracker import StatusTracker
|
|
14
15
|
from .sampling_params import SamplingParams
|
|
@@ -225,39 +226,47 @@ class LLMClient:
|
|
|
225
226
|
async def process_prompts_async(
|
|
226
227
|
self,
|
|
227
228
|
prompts: Sequence[str | list[dict] | Conversation],
|
|
229
|
+
*,
|
|
228
230
|
return_completions_only: bool,
|
|
229
231
|
show_progress: bool = ...,
|
|
230
|
-
dry_run: Literal[True]
|
|
232
|
+
dry_run: Literal[True],
|
|
231
233
|
verbose: bool = ...,
|
|
234
|
+
tools: list[Tool] | None = ...,
|
|
232
235
|
) -> dict[str, int]: ...
|
|
233
236
|
|
|
234
237
|
@overload
|
|
235
238
|
async def process_prompts_async(
|
|
236
239
|
self,
|
|
237
240
|
prompts: Sequence[str | list[dict] | Conversation],
|
|
241
|
+
*,
|
|
238
242
|
return_completions_only: Literal[True],
|
|
239
243
|
show_progress: bool = ...,
|
|
240
|
-
dry_run:
|
|
244
|
+
dry_run: bool = ...,
|
|
241
245
|
verbose: bool = ...,
|
|
246
|
+
tools: list[Tool] | None = ...,
|
|
242
247
|
) -> list[str | None]: ...
|
|
243
248
|
|
|
244
249
|
@overload
|
|
245
250
|
async def process_prompts_async(
|
|
246
251
|
self,
|
|
247
252
|
prompts: Sequence[str | list[dict] | Conversation],
|
|
253
|
+
*,
|
|
248
254
|
return_completions_only: Literal[False] = ...,
|
|
249
255
|
show_progress: bool = ...,
|
|
250
|
-
dry_run:
|
|
256
|
+
dry_run: bool = ...,
|
|
251
257
|
verbose: bool = ...,
|
|
258
|
+
tools: list[Tool] | None = ...,
|
|
252
259
|
) -> list[APIResponse | None]: ...
|
|
253
260
|
|
|
254
261
|
async def process_prompts_async(
|
|
255
262
|
self,
|
|
256
263
|
prompts: Sequence[str | list[dict] | Conversation],
|
|
264
|
+
*,
|
|
257
265
|
return_completions_only: bool = False,
|
|
258
266
|
show_progress: bool = True,
|
|
259
267
|
dry_run: bool = False,
|
|
260
268
|
verbose: bool = False,
|
|
269
|
+
tools: list[Tool] | None = None,
|
|
261
270
|
) -> list[APIResponse | None] | list[str | None] | dict[str, int]:
|
|
262
271
|
# if prompts are not Conversations, convert them.
|
|
263
272
|
# can only handle strings for now
|
|
@@ -335,6 +344,7 @@ class LLMClient:
|
|
|
335
344
|
progress_bar=pbar,
|
|
336
345
|
use_qps=self.use_qps,
|
|
337
346
|
verbose=verbose,
|
|
347
|
+
tools=tools,
|
|
338
348
|
)
|
|
339
349
|
)
|
|
340
350
|
api_results: list[APIResponse] = await api_task
|
|
@@ -357,10 +367,12 @@ class LLMClient:
|
|
|
357
367
|
def process_prompts_sync(
|
|
358
368
|
self,
|
|
359
369
|
prompts: Sequence[str | list[dict] | Conversation],
|
|
370
|
+
*,
|
|
360
371
|
return_completions_only: bool = False,
|
|
361
372
|
show_progress=True,
|
|
362
373
|
dry_run: bool = False,
|
|
363
374
|
verbose: bool = False,
|
|
375
|
+
tools: list[Tool] | None = None,
|
|
364
376
|
):
|
|
365
377
|
return asyncio.run(
|
|
366
378
|
self.process_prompts_async(
|
|
@@ -369,6 +381,7 @@ class LLMClient:
|
|
|
369
381
|
show_progress=show_progress,
|
|
370
382
|
dry_run=dry_run,
|
|
371
383
|
verbose=verbose,
|
|
384
|
+
tools=tools,
|
|
372
385
|
)
|
|
373
386
|
)
|
|
374
387
|
|
|
@@ -556,6 +569,7 @@ async def process_api_prompts_async(
|
|
|
556
569
|
progress_bar: tqdm | None = None,
|
|
557
570
|
use_qps: bool = False,
|
|
558
571
|
verbose: bool = False,
|
|
572
|
+
tools: list[Tool] | None = None,
|
|
559
573
|
):
|
|
560
574
|
"""Processes API requests in parallel, throttling to stay under rate limits."""
|
|
561
575
|
# change ids to integer list
|
|
@@ -639,6 +653,7 @@ async def process_api_prompts_async(
|
|
|
639
653
|
pbar=progress_bar,
|
|
640
654
|
all_model_names=models,
|
|
641
655
|
all_sampling_params=sampling_params,
|
|
656
|
+
tools=tools,
|
|
642
657
|
)
|
|
643
658
|
status_tracker.num_tasks_started += 1
|
|
644
659
|
status_tracker.num_tasks_in_progress += 1
|
lm_deluge/models.py
CHANGED
|
@@ -629,30 +629,95 @@ registry = {
|
|
|
629
629
|
# ░███ ░███░███░░░ ░███ ░███ ░███ ░███ ░███░███ ███ ░███░░███
|
|
630
630
|
# ███████████ ░░██████ ░░████████ █████ ░░██████ ░░██████ ████ █████
|
|
631
631
|
# ░░░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░ ░░░░░░ ░░░░░░ ░░░░ ░░░░░
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
632
|
+
"claude-3-haiku-bedrock": {
|
|
633
|
+
"id": "claude-3-haiku-bedrock",
|
|
634
|
+
"name": "us.anthropic.claude-3-haiku-20240307-v1:0",
|
|
635
|
+
"regions": ["us-east-1", "us-west-2", "ap-southeast-2", "eu-west-3"],
|
|
636
|
+
"api_base": "",
|
|
637
|
+
"api_key_env_var": "",
|
|
638
|
+
"api_spec": "bedrock",
|
|
639
|
+
"input_cost": 0.25,
|
|
640
|
+
"output_cost": 1.25,
|
|
641
|
+
"requests_per_minute": 4_000,
|
|
642
|
+
"tokens_per_minute": 8_000_000,
|
|
643
|
+
},
|
|
644
|
+
"claude-3.5-haiku-bedrock": {
|
|
645
|
+
"id": "claude-3.5-haiku-bedrock",
|
|
646
|
+
"name": "us.anthropic.claude-3-5-haiku-20241022-v1:0",
|
|
647
|
+
"regions": ["us-east-1", "us-west-2", "ap-southeast-2", "eu-west-3"],
|
|
648
|
+
"api_base": "",
|
|
649
|
+
"api_key_env_var": "",
|
|
650
|
+
"api_spec": "bedrock",
|
|
651
|
+
"input_cost": 0.25,
|
|
652
|
+
"output_cost": 1.25,
|
|
653
|
+
"requests_per_minute": 4_000,
|
|
654
|
+
"tokens_per_minute": 8_000_000,
|
|
655
|
+
},
|
|
656
|
+
"claude-3.5-sonnet-bedrock": {
|
|
657
|
+
"id": "claude-3.5-sonnet-bedrock",
|
|
658
|
+
"name": "us.anthropic.claude-3-5-sonnet-20240620-v1:0",
|
|
659
|
+
"regions": ["us-east-1", "us-west-2"],
|
|
660
|
+
"api_base": "",
|
|
661
|
+
"api_key_env_var": "",
|
|
662
|
+
"api_spec": "bedrock",
|
|
663
|
+
"input_cost": 3.0,
|
|
664
|
+
"output_cost": 15.0,
|
|
665
|
+
"requests_per_minute": 4_000,
|
|
666
|
+
"tokens_per_minute": 400_000,
|
|
667
|
+
"reasoning_model": False,
|
|
668
|
+
},
|
|
669
|
+
"claude-3.6-sonnet-bedrock": {
|
|
670
|
+
"id": "claude-3.6-sonnet-bedrock",
|
|
671
|
+
"name": "us.anthropic.claude-3-5-sonnet-20241022-v2:0",
|
|
672
|
+
"regions": ["us-east-1", "us-west-2", "us-east-2"],
|
|
673
|
+
"api_base": "",
|
|
674
|
+
"api_key_env_var": "",
|
|
675
|
+
"api_spec": "bedrock",
|
|
676
|
+
"input_cost": 3.0,
|
|
677
|
+
"output_cost": 15.0,
|
|
678
|
+
"requests_per_minute": 4_000,
|
|
679
|
+
"tokens_per_minute": 400_000,
|
|
680
|
+
"reasoning_model": False,
|
|
681
|
+
},
|
|
682
|
+
"claude-3.7-sonnet-bedrock": {
|
|
683
|
+
"id": "claude-3.7-sonnet-bedrock",
|
|
684
|
+
"name": "us.anthropic.claude-3-7-sonnet-20250219-v1:0",
|
|
685
|
+
"regions": ["us-east-1", "us-west-2", "eu-west-1"],
|
|
686
|
+
"api_base": "",
|
|
687
|
+
"api_key_env_var": "",
|
|
688
|
+
"api_spec": "bedrock",
|
|
689
|
+
"input_cost": 3.0,
|
|
690
|
+
"output_cost": 15.0,
|
|
691
|
+
"requests_per_minute": 4_000,
|
|
692
|
+
"tokens_per_minute": 400_000,
|
|
693
|
+
"reasoning_model": True,
|
|
694
|
+
},
|
|
695
|
+
"claude-4-sonnet-bedrock": {
|
|
696
|
+
"id": "claude-4-sonnet-bedrock",
|
|
697
|
+
"name": "us.anthropic.claude-sonnet-4-20250514-v1:0",
|
|
698
|
+
"regions": ["us-east-1", "us-west-2", "us-east-2"],
|
|
699
|
+
"api_base": "",
|
|
700
|
+
"api_key_env_var": "",
|
|
701
|
+
"api_spec": "bedrock",
|
|
702
|
+
"input_cost": 3.0,
|
|
703
|
+
"output_cost": 15.0,
|
|
704
|
+
"requests_per_minute": 4_000,
|
|
705
|
+
"tokens_per_minute": 400_000,
|
|
706
|
+
"reasoning_model": True,
|
|
707
|
+
},
|
|
708
|
+
"claude-4-opus-bedrock": {
|
|
709
|
+
"id": "claude-4-opus-bedrock",
|
|
710
|
+
"name": "us.anthropic.claude-opus-4-20250514-v1:0",
|
|
711
|
+
"regions": ["us-east-1", "us-west-2", "us-east-2"],
|
|
712
|
+
"api_base": "",
|
|
713
|
+
"api_key_env_var": "",
|
|
714
|
+
"api_spec": "bedrock",
|
|
715
|
+
"input_cost": 3.0,
|
|
716
|
+
"output_cost": 15.0,
|
|
717
|
+
"requests_per_minute": 4_000,
|
|
718
|
+
"tokens_per_minute": 400_000,
|
|
719
|
+
"reasoning_model": True,
|
|
720
|
+
},
|
|
656
721
|
# "mistral-7b-bedrock": {
|
|
657
722
|
# "id": "mistral-7b-bedrock",
|
|
658
723
|
# "name": "mistral.mistral-7b-instruct-v0:2",
|