lm-deluge 0.0.35__tar.gz → 0.0.106__tar.gz
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.
- {lm_deluge-0.0.35/src/lm_deluge.egg-info → lm_deluge-0.0.106}/PKG-INFO +40 -22
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/README.md +22 -19
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/pyproject.toml +16 -3
- lm_deluge-0.0.106/src/lm_deluge/__init__.py +19 -0
- lm_deluge-0.0.106/src/lm_deluge/api_requests/anthropic.py +433 -0
- lm_deluge-0.0.106/src/lm_deluge/api_requests/base.py +325 -0
- lm_deluge-0.0.106/src/lm_deluge/api_requests/bedrock.py +459 -0
- lm_deluge-0.0.35/src/lm_deluge/api_requests/bedrock.py → lm_deluge-0.0.106/src/lm_deluge/api_requests/bedrock_nova.py +95 -87
- lm_deluge-0.0.106/src/lm_deluge/api_requests/chat_reasoning.py +4 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/api_requests/common.py +2 -0
- lm_deluge-0.0.35/src/lm_deluge/request_context.py → lm_deluge-0.0.106/src/lm_deluge/api_requests/context.py +24 -17
- lm_deluge-0.0.106/src/lm_deluge/api_requests/gemini.py +367 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/api_requests/mistral.py +17 -10
- lm_deluge-0.0.106/src/lm_deluge/api_requests/openai.py +769 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/api_requests/response.py +35 -5
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/batches.py +134 -62
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/cache.py +11 -2
- lm_deluge-0.0.106/src/lm_deluge/cli.py +746 -0
- lm_deluge-0.0.106/src/lm_deluge/client/__init__.py +1737 -0
- lm_deluge-0.0.106/src/lm_deluge/config.py +23 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/embed.py +2 -6
- lm_deluge-0.0.106/src/lm_deluge/mcp/__init__.py +38 -0
- lm_deluge-0.0.106/src/lm_deluge/mcp/client.py +204 -0
- lm_deluge-0.0.106/src/lm_deluge/mcp/sse.py +92 -0
- lm_deluge-0.0.106/src/lm_deluge/mcp/transports.py +245 -0
- lm_deluge-0.0.106/src/lm_deluge/mcp/types.py +59 -0
- lm_deluge-0.0.106/src/lm_deluge/models/__init__.py +278 -0
- lm_deluge-0.0.106/src/lm_deluge/models/anthropic.py +169 -0
- lm_deluge-0.0.106/src/lm_deluge/models/arcee.py +16 -0
- lm_deluge-0.0.106/src/lm_deluge/models/azure.py +269 -0
- lm_deluge-0.0.106/src/lm_deluge/models/bedrock.py +162 -0
- lm_deluge-0.0.106/src/lm_deluge/models/cerebras.py +66 -0
- lm_deluge-0.0.106/src/lm_deluge/models/cohere.py +84 -0
- lm_deluge-0.0.106/src/lm_deluge/models/deepseek.py +59 -0
- lm_deluge-0.0.106/src/lm_deluge/models/fireworks.py +18 -0
- lm_deluge-0.0.106/src/lm_deluge/models/google.py +196 -0
- lm_deluge-0.0.106/src/lm_deluge/models/grok.py +110 -0
- lm_deluge-0.0.106/src/lm_deluge/models/groq.py +78 -0
- lm_deluge-0.0.106/src/lm_deluge/models/kimi.py +59 -0
- lm_deluge-0.0.106/src/lm_deluge/models/meta.py +59 -0
- lm_deluge-0.0.106/src/lm_deluge/models/minimax.py +18 -0
- lm_deluge-0.0.106/src/lm_deluge/models/mistral.py +110 -0
- lm_deluge-0.0.106/src/lm_deluge/models/openai.py +445 -0
- lm_deluge-0.0.106/src/lm_deluge/models/openrouter.py +329 -0
- lm_deluge-0.0.106/src/lm_deluge/models/together.py +110 -0
- lm_deluge-0.0.106/src/lm_deluge/models/zai.py +62 -0
- {lm_deluge-0.0.35/src/lm_deluge/llm_tools → lm_deluge-0.0.106/src/lm_deluge/pipelines}/extract.py +11 -10
- lm_deluge-0.0.106/src/lm_deluge/pipelines/gepa/__init__.py +95 -0
- lm_deluge-0.0.106/src/lm_deluge/pipelines/gepa/core.py +354 -0
- lm_deluge-0.0.106/src/lm_deluge/pipelines/gepa/docs/samples.py +705 -0
- lm_deluge-0.0.106/src/lm_deluge/pipelines/gepa/examples/01_synthetic_keywords.py +140 -0
- lm_deluge-0.0.106/src/lm_deluge/pipelines/gepa/examples/02_gsm8k_math.py +261 -0
- lm_deluge-0.0.106/src/lm_deluge/pipelines/gepa/examples/03_hotpotqa_multihop.py +300 -0
- lm_deluge-0.0.106/src/lm_deluge/pipelines/gepa/examples/04_batch_classification.py +271 -0
- lm_deluge-0.0.106/src/lm_deluge/pipelines/gepa/examples/simple_qa.py +129 -0
- lm_deluge-0.0.106/src/lm_deluge/pipelines/gepa/optimizer.py +435 -0
- lm_deluge-0.0.106/src/lm_deluge/pipelines/gepa/proposer.py +235 -0
- lm_deluge-0.0.106/src/lm_deluge/pipelines/gepa/util.py +165 -0
- lm_deluge-0.0.106/src/lm_deluge/pipelines/heartbeat.py +29 -0
- {lm_deluge-0.0.35/src/lm_deluge/llm_tools → lm_deluge-0.0.106/src/lm_deluge/pipelines}/score.py +2 -2
- {lm_deluge-0.0.35/src/lm_deluge/llm_tools → lm_deluge-0.0.106/src/lm_deluge/pipelines}/translate.py +5 -3
- lm_deluge-0.0.106/src/lm_deluge/prompt/__init__.py +47 -0
- lm_deluge-0.0.106/src/lm_deluge/prompt/conversation.py +1230 -0
- lm_deluge-0.0.106/src/lm_deluge/prompt/file.py +531 -0
- {lm_deluge-0.0.35/src/lm_deluge → lm_deluge-0.0.106/src/lm_deluge/prompt}/image.py +40 -1
- lm_deluge-0.0.106/src/lm_deluge/prompt/message.py +596 -0
- lm_deluge-0.0.106/src/lm_deluge/prompt/serialization.py +21 -0
- lm_deluge-0.0.106/src/lm_deluge/prompt/signatures.py +77 -0
- lm_deluge-0.0.106/src/lm_deluge/prompt/text.py +50 -0
- lm_deluge-0.0.106/src/lm_deluge/prompt/thinking.py +68 -0
- lm_deluge-0.0.106/src/lm_deluge/prompt/tool_calls.py +301 -0
- lm_deluge-0.0.106/src/lm_deluge/server/__init__.py +24 -0
- lm_deluge-0.0.106/src/lm_deluge/server/__main__.py +144 -0
- lm_deluge-0.0.106/src/lm_deluge/server/adapters.py +369 -0
- lm_deluge-0.0.106/src/lm_deluge/server/app.py +388 -0
- lm_deluge-0.0.106/src/lm_deluge/server/auth.py +71 -0
- lm_deluge-0.0.106/src/lm_deluge/server/model_policy.py +215 -0
- lm_deluge-0.0.106/src/lm_deluge/server/models_anthropic.py +172 -0
- lm_deluge-0.0.106/src/lm_deluge/server/models_openai.py +175 -0
- lm_deluge-0.0.106/src/lm_deluge/skill/SKILL.md +196 -0
- lm_deluge-0.0.106/src/lm_deluge/skill/__init__.py +1 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/__init__.py +1296 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/builtin/anthropic/__init__.py +300 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/builtin/anthropic/computer_use.py +0 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/builtin/gemini.py +59 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/builtin/openai.py +74 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/cua/__init__.py +173 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/cua/actions.py +148 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/cua/base.py +27 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/cua/batch.py +214 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/cua/converters.py +466 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/cua/kernel.py +702 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/cua/trycua.py +989 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/__init__.py +119 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/batch_tool.py +156 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/curl.py +343 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/docs.py +1119 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/email.py +294 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/filesystem.py +1721 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/full_text_search/__init__.py +286 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/full_text_search/tantivy_index.py +396 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/memory.py +460 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/otc/__init__.py +165 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/otc/executor.py +281 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/otc/parse.py +188 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/philips_hue.py +428 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/random.py +188 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/rlm/__init__.py +296 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/rlm/executor.py +349 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/rlm/parse.py +144 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/sandbox/__init__.py +58 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/sandbox/daytona_sandbox.py +483 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/sandbox/docker_sandbox.py +609 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/sandbox/fargate_sandbox.py +546 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/sandbox/modal_sandbox.py +469 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/sandbox/seatbelt_sandbox.py +829 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/sheets.py +385 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/skills.py +0 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/subagents.py +233 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/todos.py +342 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/tool_search.py +169 -0
- lm_deluge-0.0.106/src/lm_deluge/tool/prefab/web_search.py +1020 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/tracker.py +91 -15
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/usage.py +30 -21
- lm_deluge-0.0.106/src/lm_deluge/util/anthropic_files.py +228 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/util/harmony.py +6 -4
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/util/json.py +1 -2
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/util/logprobs.py +4 -4
- lm_deluge-0.0.106/src/lm_deluge/util/schema.py +412 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/util/validation.py +14 -9
- lm_deluge-0.0.106/src/lm_deluge/warnings.py +54 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106/src/lm_deluge.egg-info}/PKG-INFO +40 -22
- lm_deluge-0.0.106/src/lm_deluge.egg-info/SOURCES.txt +156 -0
- lm_deluge-0.0.106/src/lm_deluge.egg-info/entry_points.txt +3 -0
- lm_deluge-0.0.106/src/lm_deluge.egg-info/requires.txt +38 -0
- lm_deluge-0.0.35/src/lm_deluge/__init__.py +0 -17
- lm_deluge-0.0.35/src/lm_deluge/api_requests/anthropic.py +0 -217
- lm_deluge-0.0.35/src/lm_deluge/api_requests/base.py +0 -151
- lm_deluge-0.0.35/src/lm_deluge/api_requests/gemini.py +0 -204
- lm_deluge-0.0.35/src/lm_deluge/api_requests/openai.py +0 -527
- lm_deluge-0.0.35/src/lm_deluge/built_in_tools/anthropic/__init__.py +0 -128
- lm_deluge-0.0.35/src/lm_deluge/built_in_tools/openai.py +0 -28
- lm_deluge-0.0.35/src/lm_deluge/client.py +0 -828
- lm_deluge-0.0.35/src/lm_deluge/config.py +0 -33
- lm_deluge-0.0.35/src/lm_deluge/file.py +0 -158
- lm_deluge-0.0.35/src/lm_deluge/gemini_limits.py +0 -65
- lm_deluge-0.0.35/src/lm_deluge/models/__init__.py +0 -1390
- lm_deluge-0.0.35/src/lm_deluge/prompt.py +0 -984
- lm_deluge-0.0.35/src/lm_deluge/tool.py +0 -461
- lm_deluge-0.0.35/src/lm_deluge.egg-info/SOURCES.txt +0 -61
- lm_deluge-0.0.35/src/lm_deluge.egg-info/requires.txt +0 -17
- lm_deluge-0.0.35/tests/test_builtin_tools.py +0 -58
- lm_deluge-0.0.35/tests/test_native_mcp_server.py +0 -66
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/LICENSE +0 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/setup.cfg +0 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/api_requests/__init__.py +0 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/api_requests/deprecated/bedrock.py +0 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/api_requests/deprecated/cohere.py +0 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/api_requests/deprecated/deepseek.py +0 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/api_requests/deprecated/mistral.py +0 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/api_requests/deprecated/vertex.py +0 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/errors.py +0 -0
- {lm_deluge-0.0.35/src/lm_deluge/llm_tools → lm_deluge-0.0.106/src/lm_deluge/pipelines}/__init__.py +1 -1
- {lm_deluge-0.0.35/src/lm_deluge/llm_tools → lm_deluge-0.0.106/src/lm_deluge/pipelines}/classify.py +0 -0
- {lm_deluge-0.0.35/src/lm_deluge/llm_tools → lm_deluge-0.0.106/src/lm_deluge/pipelines}/locate.py +0 -0
- {lm_deluge-0.0.35/src/lm_deluge/llm_tools → lm_deluge-0.0.106/src/lm_deluge/pipelines}/ocr.py +0 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/rerank.py +0 -0
- /lm_deluge-0.0.35/src/lm_deluge/agent.py → /lm_deluge-0.0.106/src/lm_deluge/skills/anthropic.py +0 -0
- /lm_deluge-0.0.35/src/lm_deluge/built_in_tools/anthropic/bash.py → /lm_deluge-0.0.106/src/lm_deluge/skills/compat.py +0 -0
- /lm_deluge-0.0.35/src/lm_deluge/built_in_tools/anthropic/computer_use.py → /lm_deluge-0.0.106/src/lm_deluge/tool/builtin/anthropic/bash.py +0 -0
- {lm_deluge-0.0.35/src/lm_deluge/built_in_tools → lm_deluge-0.0.106/src/lm_deluge/tool/builtin}/anthropic/editor.py +0 -0
- {lm_deluge-0.0.35/src/lm_deluge/built_in_tools → lm_deluge-0.0.106/src/lm_deluge/tool/builtin}/base.py +0 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/util/spatial.py +0 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge/util/xml.py +0 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge.egg-info/dependency_links.txt +0 -0
- {lm_deluge-0.0.35 → lm_deluge-0.0.106}/src/lm_deluge.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lm_deluge
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.106
|
|
4
4
|
Summary: Python utility for using LLM API models.
|
|
5
5
|
Author-email: Benjamin Anderson <ben@trytaylor.ai>
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -9,7 +9,6 @@ License-File: LICENSE
|
|
|
9
9
|
Requires-Dist: python-dotenv
|
|
10
10
|
Requires-Dist: json5
|
|
11
11
|
Requires-Dist: PyYAML
|
|
12
|
-
Requires-Dist: pandas
|
|
13
12
|
Requires-Dist: aiohttp
|
|
14
13
|
Requires-Dist: tiktoken
|
|
15
14
|
Requires-Dist: xxhash
|
|
@@ -21,8 +20,24 @@ Requires-Dist: bs4
|
|
|
21
20
|
Requires-Dist: lxml
|
|
22
21
|
Requires-Dist: pdf2image
|
|
23
22
|
Requires-Dist: pillow
|
|
24
|
-
Requires-Dist: fastmcp>=2.4
|
|
25
23
|
Requires-Dist: rich
|
|
24
|
+
Provides-Extra: aws
|
|
25
|
+
Requires-Dist: boto3>=1.28.0; extra == "aws"
|
|
26
|
+
Provides-Extra: docker
|
|
27
|
+
Requires-Dist: docker>=7.0.0; extra == "docker"
|
|
28
|
+
Provides-Extra: full-text-search
|
|
29
|
+
Requires-Dist: tantivy>=0.21.0; extra == "full-text-search"
|
|
30
|
+
Requires-Dist: lenlp>=0.1.0; extra == "full-text-search"
|
|
31
|
+
Provides-Extra: sandbox
|
|
32
|
+
Requires-Dist: modal>=0.64.0; extra == "sandbox"
|
|
33
|
+
Requires-Dist: daytona-sdk>=0.1.4; extra == "sandbox"
|
|
34
|
+
Requires-Dist: docker>=7.0.0; extra == "sandbox"
|
|
35
|
+
Provides-Extra: server
|
|
36
|
+
Requires-Dist: fastapi>=0.100.0; extra == "server"
|
|
37
|
+
Requires-Dist: uvicorn>=0.20.0; extra == "server"
|
|
38
|
+
Provides-Extra: dev
|
|
39
|
+
Requires-Dist: ty; extra == "dev"
|
|
40
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
26
41
|
Dynamic: license-file
|
|
27
42
|
|
|
28
43
|
# lm-deluge
|
|
@@ -35,9 +50,9 @@ Dynamic: license-file
|
|
|
35
50
|
- **Spray across models/providers** – Configure a client with multiple models from any provider(s), and sampling weights. The client samples a model for each request.
|
|
36
51
|
- **Tool Use** – Unified API for defining tools for all providers, and creating tools automatically from python functions.
|
|
37
52
|
- **MCP Support** – Instantiate a `Tool` from a local or remote MCP server so that any LLM can use it, whether or not that provider natively supports MCP.
|
|
38
|
-
- **Computer Use** – We support
|
|
39
|
-
- **Caching** –
|
|
40
|
-
- **Convenient message constructor** – No more looking up how to build an Anthropic messages list with images. Our `Conversation` and `Message` classes work great with our
|
|
53
|
+
- **Computer Use** – We support computer use for all major providers, and have pre-fabricated tools to integrate with Kernel, TryCUA, and more.
|
|
54
|
+
- **Local & Remote Caching** – Use Anthropic caching more easily with common patterns (system-only, tools-only, last N messages, etc.) Use client-side caching to save completions to avoid repeated LLM calls to process the same input.
|
|
55
|
+
- **Convenient message constructor** – No more looking up how to build an Anthropic messages list with images. Our `Conversation` and `Message` classes work great with our `LLMClient` or with the `openai` and `anthropic` packages.
|
|
41
56
|
- **Sync and async APIs** – Use the client from sync or async code.
|
|
42
57
|
|
|
43
58
|
**STREAMING IS NOT IN SCOPE.** There are plenty of packages that let you stream chat completions across providers. The sole purpose of this package is to do very fast batch inference using APIs. Sorry!
|
|
@@ -50,7 +65,7 @@ Dynamic: license-file
|
|
|
50
65
|
pip install lm-deluge
|
|
51
66
|
```
|
|
52
67
|
|
|
53
|
-
The package relies on environment variables for API keys. Typical variables include `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `COHERE_API_KEY`, `META_API_KEY`, and `
|
|
68
|
+
The package relies on environment variables for API keys. Typical variables include `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `COHERE_API_KEY`, `META_API_KEY`, and `GEMINI_API_KEY`. `LLMClient` will automatically load the `.env` file when imported; we recommend using that to set the environment variables. For Bedrock, you'll need to set `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`.
|
|
54
69
|
|
|
55
70
|
## Quickstart
|
|
56
71
|
|
|
@@ -59,9 +74,9 @@ The package relies on environment variables for API keys. Typical variables incl
|
|
|
59
74
|
```python
|
|
60
75
|
from lm_deluge import LLMClient
|
|
61
76
|
|
|
62
|
-
client = LLMClient("gpt-
|
|
77
|
+
client = LLMClient("gpt-4.1-mini")
|
|
63
78
|
resps = client.process_prompts_sync(["Hello, world!"])
|
|
64
|
-
print(
|
|
79
|
+
print(resps[0].completion)
|
|
65
80
|
```
|
|
66
81
|
|
|
67
82
|
## Spraying Across Models
|
|
@@ -72,13 +87,13 @@ To distribute your requests across models, just provide a list of more than one
|
|
|
72
87
|
from lm_deluge import LLMClient
|
|
73
88
|
|
|
74
89
|
client = LLMClient(
|
|
75
|
-
["gpt-
|
|
90
|
+
["gpt-4.1-mini", "claude-4.5-haiku"],
|
|
76
91
|
max_requests_per_minute=10_000
|
|
77
92
|
)
|
|
78
93
|
resps = client.process_prompts_sync(
|
|
79
94
|
["Hello, ChatGPT!", "Hello, Claude!"]
|
|
80
95
|
)
|
|
81
|
-
print(
|
|
96
|
+
print(resps[0].completion)
|
|
82
97
|
```
|
|
83
98
|
|
|
84
99
|
## Configuration
|
|
@@ -111,14 +126,17 @@ await client.process_prompts_async(
|
|
|
111
126
|
|
|
112
127
|
### Queueing individual prompts
|
|
113
128
|
|
|
114
|
-
You can queue prompts one at a time and track progress explicitly
|
|
129
|
+
You can queue prompts one at a time and track progress explicitly. Iterate over
|
|
130
|
+
results as they finish with `as_completed` (or gather them all at once with
|
|
131
|
+
`wait_for_all`):
|
|
115
132
|
|
|
116
133
|
```python
|
|
117
134
|
client = LLMClient("gpt-4.1-mini", progress="tqdm")
|
|
118
135
|
client.open()
|
|
119
|
-
|
|
136
|
+
client.start_nowait("hello there")
|
|
120
137
|
# ... queue more tasks ...
|
|
121
|
-
|
|
138
|
+
async for task_id, result in client.as_completed():
|
|
139
|
+
print(task_id, result.completion)
|
|
122
140
|
client.close()
|
|
123
141
|
```
|
|
124
142
|
|
|
@@ -129,7 +147,7 @@ Constructing conversations to pass to models is notoriously annoying. Each provi
|
|
|
129
147
|
```python
|
|
130
148
|
from lm_deluge import Message, Conversation
|
|
131
149
|
|
|
132
|
-
prompt = Conversation.system("You are a helpful assistant.").add(
|
|
150
|
+
prompt = Conversation().system("You are a helpful assistant.").add(
|
|
133
151
|
Message.user("What's in this image?").add_image("tests/image.jpg")
|
|
134
152
|
)
|
|
135
153
|
|
|
@@ -150,7 +168,7 @@ from lm_deluge import LLMClient, Conversation
|
|
|
150
168
|
|
|
151
169
|
# Simple file upload
|
|
152
170
|
client = LLMClient("gpt-4.1-mini")
|
|
153
|
-
conversation = Conversation.user(
|
|
171
|
+
conversation = Conversation().user(
|
|
154
172
|
"Please summarize this document",
|
|
155
173
|
file="path/to/document.pdf"
|
|
156
174
|
)
|
|
@@ -159,7 +177,7 @@ resps = client.process_prompts_sync([conversation])
|
|
|
159
177
|
# You can also create File objects for more control
|
|
160
178
|
from lm_deluge import File
|
|
161
179
|
file = File("path/to/report.pdf", filename="Q4_Report.pdf")
|
|
162
|
-
conversation = Conversation.user("Analyze this financial report")
|
|
180
|
+
conversation = Conversation().user("Analyze this financial report")
|
|
163
181
|
conversation.messages[0].parts.append(file)
|
|
164
182
|
```
|
|
165
183
|
|
|
@@ -176,7 +194,7 @@ def get_weather(city: str) -> str:
|
|
|
176
194
|
return f"The weather in {city} is sunny and 72°F"
|
|
177
195
|
|
|
178
196
|
tool = Tool.from_function(get_weather)
|
|
179
|
-
client = LLMClient("claude-
|
|
197
|
+
client = LLMClient("claude-4.5-haiku")
|
|
180
198
|
resps = client.process_prompts_sync(
|
|
181
199
|
["What's the weather in Paris?"],
|
|
182
200
|
tools=[tool]
|
|
@@ -229,7 +247,7 @@ for tool_call in resps[0].tool_calls:
|
|
|
229
247
|
import asyncio
|
|
230
248
|
|
|
231
249
|
async def main():
|
|
232
|
-
conv = Conversation.user("List the files in the current directory")
|
|
250
|
+
conv = Conversation().user("List the files in the current directory")
|
|
233
251
|
conv, resp = await client.run_agent_loop(conv, tools=tools)
|
|
234
252
|
print(resp.content.completion)
|
|
235
253
|
|
|
@@ -245,12 +263,12 @@ from lm_deluge import LLMClient, Conversation, Message
|
|
|
245
263
|
|
|
246
264
|
# Create a conversation with system message
|
|
247
265
|
conv = (
|
|
248
|
-
Conversation.system("You are an expert Python developer with deep knowledge of async programming.")
|
|
266
|
+
Conversation().system("You are an expert Python developer with deep knowledge of async programming.")
|
|
249
267
|
.add(Message.user("How do I use asyncio.gather?"))
|
|
250
268
|
)
|
|
251
269
|
|
|
252
270
|
# Use prompt caching to cache system message and tools
|
|
253
|
-
client = LLMClient("claude-
|
|
271
|
+
client = LLMClient("claude-4.5-sonnet")
|
|
254
272
|
resps = client.process_prompts_sync(
|
|
255
273
|
[conv],
|
|
256
274
|
cache="system_and_tools" # Cache system message and any tools
|
|
@@ -291,7 +309,7 @@ We support structured outputs via `json_mode` parameter provided to `SamplingPar
|
|
|
291
309
|
|
|
292
310
|
## Built‑in tools
|
|
293
311
|
|
|
294
|
-
The `lm_deluge.
|
|
312
|
+
The `lm_deluge.pipelines` module exposes a few helper functions that combine LLMClient with prompt and output parsing to accomplish tasks:
|
|
295
313
|
|
|
296
314
|
- `extract` – structure text or images into a Pydantic model based on a schema.
|
|
297
315
|
- `translate` – translate a list of strings to English.
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
- **Spray across models/providers** – Configure a client with multiple models from any provider(s), and sampling weights. The client samples a model for each request.
|
|
9
9
|
- **Tool Use** – Unified API for defining tools for all providers, and creating tools automatically from python functions.
|
|
10
10
|
- **MCP Support** – Instantiate a `Tool` from a local or remote MCP server so that any LLM can use it, whether or not that provider natively supports MCP.
|
|
11
|
-
- **Computer Use** – We support
|
|
12
|
-
- **Caching** –
|
|
13
|
-
- **Convenient message constructor** – No more looking up how to build an Anthropic messages list with images. Our `Conversation` and `Message` classes work great with our
|
|
11
|
+
- **Computer Use** – We support computer use for all major providers, and have pre-fabricated tools to integrate with Kernel, TryCUA, and more.
|
|
12
|
+
- **Local & Remote Caching** – Use Anthropic caching more easily with common patterns (system-only, tools-only, last N messages, etc.) Use client-side caching to save completions to avoid repeated LLM calls to process the same input.
|
|
13
|
+
- **Convenient message constructor** – No more looking up how to build an Anthropic messages list with images. Our `Conversation` and `Message` classes work great with our `LLMClient` or with the `openai` and `anthropic` packages.
|
|
14
14
|
- **Sync and async APIs** – Use the client from sync or async code.
|
|
15
15
|
|
|
16
16
|
**STREAMING IS NOT IN SCOPE.** There are plenty of packages that let you stream chat completions across providers. The sole purpose of this package is to do very fast batch inference using APIs. Sorry!
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
pip install lm-deluge
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
The package relies on environment variables for API keys. Typical variables include `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `COHERE_API_KEY`, `META_API_KEY`, and `
|
|
26
|
+
The package relies on environment variables for API keys. Typical variables include `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `COHERE_API_KEY`, `META_API_KEY`, and `GEMINI_API_KEY`. `LLMClient` will automatically load the `.env` file when imported; we recommend using that to set the environment variables. For Bedrock, you'll need to set `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`.
|
|
27
27
|
|
|
28
28
|
## Quickstart
|
|
29
29
|
|
|
@@ -32,9 +32,9 @@ The package relies on environment variables for API keys. Typical variables incl
|
|
|
32
32
|
```python
|
|
33
33
|
from lm_deluge import LLMClient
|
|
34
34
|
|
|
35
|
-
client = LLMClient("gpt-
|
|
35
|
+
client = LLMClient("gpt-4.1-mini")
|
|
36
36
|
resps = client.process_prompts_sync(["Hello, world!"])
|
|
37
|
-
print(
|
|
37
|
+
print(resps[0].completion)
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Spraying Across Models
|
|
@@ -45,13 +45,13 @@ To distribute your requests across models, just provide a list of more than one
|
|
|
45
45
|
from lm_deluge import LLMClient
|
|
46
46
|
|
|
47
47
|
client = LLMClient(
|
|
48
|
-
["gpt-
|
|
48
|
+
["gpt-4.1-mini", "claude-4.5-haiku"],
|
|
49
49
|
max_requests_per_minute=10_000
|
|
50
50
|
)
|
|
51
51
|
resps = client.process_prompts_sync(
|
|
52
52
|
["Hello, ChatGPT!", "Hello, Claude!"]
|
|
53
53
|
)
|
|
54
|
-
print(
|
|
54
|
+
print(resps[0].completion)
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
## Configuration
|
|
@@ -84,14 +84,17 @@ await client.process_prompts_async(
|
|
|
84
84
|
|
|
85
85
|
### Queueing individual prompts
|
|
86
86
|
|
|
87
|
-
You can queue prompts one at a time and track progress explicitly
|
|
87
|
+
You can queue prompts one at a time and track progress explicitly. Iterate over
|
|
88
|
+
results as they finish with `as_completed` (or gather them all at once with
|
|
89
|
+
`wait_for_all`):
|
|
88
90
|
|
|
89
91
|
```python
|
|
90
92
|
client = LLMClient("gpt-4.1-mini", progress="tqdm")
|
|
91
93
|
client.open()
|
|
92
|
-
|
|
94
|
+
client.start_nowait("hello there")
|
|
93
95
|
# ... queue more tasks ...
|
|
94
|
-
|
|
96
|
+
async for task_id, result in client.as_completed():
|
|
97
|
+
print(task_id, result.completion)
|
|
95
98
|
client.close()
|
|
96
99
|
```
|
|
97
100
|
|
|
@@ -102,7 +105,7 @@ Constructing conversations to pass to models is notoriously annoying. Each provi
|
|
|
102
105
|
```python
|
|
103
106
|
from lm_deluge import Message, Conversation
|
|
104
107
|
|
|
105
|
-
prompt = Conversation.system("You are a helpful assistant.").add(
|
|
108
|
+
prompt = Conversation().system("You are a helpful assistant.").add(
|
|
106
109
|
Message.user("What's in this image?").add_image("tests/image.jpg")
|
|
107
110
|
)
|
|
108
111
|
|
|
@@ -123,7 +126,7 @@ from lm_deluge import LLMClient, Conversation
|
|
|
123
126
|
|
|
124
127
|
# Simple file upload
|
|
125
128
|
client = LLMClient("gpt-4.1-mini")
|
|
126
|
-
conversation = Conversation.user(
|
|
129
|
+
conversation = Conversation().user(
|
|
127
130
|
"Please summarize this document",
|
|
128
131
|
file="path/to/document.pdf"
|
|
129
132
|
)
|
|
@@ -132,7 +135,7 @@ resps = client.process_prompts_sync([conversation])
|
|
|
132
135
|
# You can also create File objects for more control
|
|
133
136
|
from lm_deluge import File
|
|
134
137
|
file = File("path/to/report.pdf", filename="Q4_Report.pdf")
|
|
135
|
-
conversation = Conversation.user("Analyze this financial report")
|
|
138
|
+
conversation = Conversation().user("Analyze this financial report")
|
|
136
139
|
conversation.messages[0].parts.append(file)
|
|
137
140
|
```
|
|
138
141
|
|
|
@@ -149,7 +152,7 @@ def get_weather(city: str) -> str:
|
|
|
149
152
|
return f"The weather in {city} is sunny and 72°F"
|
|
150
153
|
|
|
151
154
|
tool = Tool.from_function(get_weather)
|
|
152
|
-
client = LLMClient("claude-
|
|
155
|
+
client = LLMClient("claude-4.5-haiku")
|
|
153
156
|
resps = client.process_prompts_sync(
|
|
154
157
|
["What's the weather in Paris?"],
|
|
155
158
|
tools=[tool]
|
|
@@ -202,7 +205,7 @@ for tool_call in resps[0].tool_calls:
|
|
|
202
205
|
import asyncio
|
|
203
206
|
|
|
204
207
|
async def main():
|
|
205
|
-
conv = Conversation.user("List the files in the current directory")
|
|
208
|
+
conv = Conversation().user("List the files in the current directory")
|
|
206
209
|
conv, resp = await client.run_agent_loop(conv, tools=tools)
|
|
207
210
|
print(resp.content.completion)
|
|
208
211
|
|
|
@@ -218,12 +221,12 @@ from lm_deluge import LLMClient, Conversation, Message
|
|
|
218
221
|
|
|
219
222
|
# Create a conversation with system message
|
|
220
223
|
conv = (
|
|
221
|
-
Conversation.system("You are an expert Python developer with deep knowledge of async programming.")
|
|
224
|
+
Conversation().system("You are an expert Python developer with deep knowledge of async programming.")
|
|
222
225
|
.add(Message.user("How do I use asyncio.gather?"))
|
|
223
226
|
)
|
|
224
227
|
|
|
225
228
|
# Use prompt caching to cache system message and tools
|
|
226
|
-
client = LLMClient("claude-
|
|
229
|
+
client = LLMClient("claude-4.5-sonnet")
|
|
227
230
|
resps = client.process_prompts_sync(
|
|
228
231
|
[conv],
|
|
229
232
|
cache="system_and_tools" # Cache system message and any tools
|
|
@@ -264,7 +267,7 @@ We support structured outputs via `json_mode` parameter provided to `SamplingPar
|
|
|
264
267
|
|
|
265
268
|
## Built‑in tools
|
|
266
269
|
|
|
267
|
-
The `lm_deluge.
|
|
270
|
+
The `lm_deluge.pipelines` module exposes a few helper functions that combine LLMClient with prompt and output parsing to accomplish tasks:
|
|
268
271
|
|
|
269
272
|
- `extract` – structure text or images into a Pydantic model based on a schema.
|
|
270
273
|
- `translate` – translate a list of strings to English.
|
|
@@ -3,7 +3,7 @@ requires = ["setuptools", "wheel"]
|
|
|
3
3
|
|
|
4
4
|
[project]
|
|
5
5
|
name = "lm_deluge"
|
|
6
|
-
version = "0.0.
|
|
6
|
+
version = "0.0.106"
|
|
7
7
|
authors = [{ name = "Benjamin Anderson", email = "ben@trytaylor.ai" }]
|
|
8
8
|
description = "Python utility for using LLM API models."
|
|
9
9
|
readme = "README.md"
|
|
@@ -15,7 +15,6 @@ dependencies = [
|
|
|
15
15
|
"python-dotenv",
|
|
16
16
|
"json5",
|
|
17
17
|
"PyYAML",
|
|
18
|
-
"pandas",
|
|
19
18
|
"aiohttp",
|
|
20
19
|
"tiktoken",
|
|
21
20
|
"xxhash",
|
|
@@ -27,6 +26,20 @@ dependencies = [
|
|
|
27
26
|
"lxml",
|
|
28
27
|
"pdf2image",
|
|
29
28
|
"pillow",
|
|
30
|
-
"fastmcp>=2.4",
|
|
31
29
|
"rich"
|
|
32
30
|
]
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
aws = ["boto3>=1.28.0"]
|
|
34
|
+
docker = ["docker>=7.0.0"]
|
|
35
|
+
full_text_search = ["tantivy>=0.21.0", "lenlp>=0.1.0"]
|
|
36
|
+
sandbox = ["modal>=0.64.0", "daytona-sdk>=0.1.4", "docker>=7.0.0"]
|
|
37
|
+
server = ["fastapi>=0.100.0", "uvicorn>=0.20.0"]
|
|
38
|
+
dev = ["ty", "pre-commit"]
|
|
39
|
+
|
|
40
|
+
[project.scripts]
|
|
41
|
+
deluge = "lm_deluge.cli:main"
|
|
42
|
+
deluge-server = "lm_deluge.server.__main__:main"
|
|
43
|
+
|
|
44
|
+
[tool.setuptools.package-data]
|
|
45
|
+
lm_deluge = ["skill/*.md"]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from .client import AgentLoopCallback, APIResponse, LLMClient, SamplingParams
|
|
2
|
+
from .prompt import Conversation, Message, File
|
|
3
|
+
from .tool import Tool, MCPServer, Skill, execute_tool_calls
|
|
4
|
+
|
|
5
|
+
# dotenv.load_dotenv() - don't do this, fucks with other packages
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"LLMClient",
|
|
9
|
+
"SamplingParams",
|
|
10
|
+
"APIResponse",
|
|
11
|
+
"AgentLoopCallback",
|
|
12
|
+
"Conversation",
|
|
13
|
+
"Message",
|
|
14
|
+
"Tool",
|
|
15
|
+
"MCPServer",
|
|
16
|
+
"Skill",
|
|
17
|
+
"File",
|
|
18
|
+
"execute_tool_calls",
|
|
19
|
+
]
|