lm-deluge 0.0.65__tar.gz → 0.0.67__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.
Potentially problematic release.
This version of lm-deluge might be problematic. Click here for more details.
- {lm_deluge-0.0.65/src/lm_deluge.egg-info → lm_deluge-0.0.67}/PKG-INFO +1 -1
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/pyproject.toml +1 -1
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/api_requests/anthropic.py +3 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/api_requests/openai.py +122 -108
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/prompt.py +12 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67/src/lm_deluge.egg-info}/PKG-INFO +1 -1
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/LICENSE +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/README.md +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/setup.cfg +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/__init__.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/api_requests/__init__.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/api_requests/base.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/api_requests/bedrock.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/api_requests/common.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/api_requests/deprecated/bedrock.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/api_requests/deprecated/cohere.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/api_requests/deprecated/deepseek.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/api_requests/deprecated/mistral.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/api_requests/deprecated/vertex.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/api_requests/gemini.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/api_requests/mistral.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/api_requests/response.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/batches.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/built_in_tools/anthropic/__init__.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/built_in_tools/anthropic/bash.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/built_in_tools/anthropic/computer_use.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/built_in_tools/anthropic/editor.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/built_in_tools/base.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/built_in_tools/openai.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/cache.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/cli.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/client.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/config.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/embed.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/errors.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/file.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/image.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/llm_tools/__init__.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/llm_tools/classify.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/llm_tools/extract.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/llm_tools/locate.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/llm_tools/ocr.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/llm_tools/score.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/llm_tools/translate.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/models/__init__.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/models/anthropic.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/models/bedrock.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/models/cerebras.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/models/cohere.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/models/deepseek.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/models/fireworks.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/models/google.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/models/grok.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/models/groq.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/models/meta.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/models/mistral.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/models/openai.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/models/openrouter.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/models/together.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/presets/cerebras.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/presets/meta.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/request_context.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/rerank.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/tool.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/tracker.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/usage.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/util/harmony.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/util/json.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/util/logprobs.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/util/spatial.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/util/validation.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/util/xml.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/warnings.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge.egg-info/SOURCES.txt +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge.egg-info/dependency_links.txt +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge.egg-info/requires.txt +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge.egg-info/top_level.txt +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/tests/test_builtin_tools.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/tests/test_file_upload.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/tests/test_native_mcp_server.py +0 -0
- {lm_deluge-0.0.65 → lm_deluge-0.0.67}/tests/test_openrouter_generic.py +0 -0
|
@@ -90,6 +90,9 @@ def _build_anthropic_request(
|
|
|
90
90
|
for tool in tools:
|
|
91
91
|
if isinstance(tool, Tool):
|
|
92
92
|
tool_definitions.append(tool.dump_for("anthropic"))
|
|
93
|
+
elif isinstance(tool, dict) and "url" in tool:
|
|
94
|
+
_add_beta(base_headers, "mcp-client-2025-04-04")
|
|
95
|
+
mcp_servers.append(tool)
|
|
93
96
|
elif isinstance(tool, dict):
|
|
94
97
|
tool_definitions.append(tool)
|
|
95
98
|
# add betas if needed
|
|
@@ -184,7 +184,8 @@ class OpenAIRequest(APIRequestBase):
|
|
|
184
184
|
|
|
185
185
|
content = Message("assistant", parts)
|
|
186
186
|
|
|
187
|
-
usage
|
|
187
|
+
if "usage" in data and data["usage"] is not None:
|
|
188
|
+
usage = Usage.from_openai_usage(data["usage"])
|
|
188
189
|
if (
|
|
189
190
|
self.context.sampling_params.logprobs
|
|
190
191
|
and "logprobs" in data["choices"][0]
|
|
@@ -349,7 +350,8 @@ class OpenAIResponsesRequest(APIRequestBase):
|
|
|
349
350
|
assert self.context.status_tracker
|
|
350
351
|
|
|
351
352
|
if status_code == 500:
|
|
352
|
-
|
|
353
|
+
res_text = await http_response.text()
|
|
354
|
+
print("Internal Server Error: ", res_text)
|
|
353
355
|
|
|
354
356
|
if status_code >= 200 and status_code < 300:
|
|
355
357
|
try:
|
|
@@ -361,126 +363,138 @@ class OpenAIResponsesRequest(APIRequestBase):
|
|
|
361
363
|
)
|
|
362
364
|
if not is_error:
|
|
363
365
|
assert data is not None, "data is None"
|
|
364
|
-
try:
|
|
365
|
-
# Parse Responses API format
|
|
366
|
-
parts = []
|
|
367
366
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
367
|
+
# Check if response is incomplete
|
|
368
|
+
if data.get("status") == "incomplete":
|
|
369
|
+
is_error = True
|
|
370
|
+
incomplete_reason = data.get("incomplete_details", {}).get(
|
|
371
|
+
"reason", "unknown"
|
|
372
|
+
)
|
|
373
|
+
error_message = f"Response incomplete: {incomplete_reason}"
|
|
374
|
+
|
|
375
|
+
if not is_error:
|
|
376
|
+
try:
|
|
377
|
+
# Parse Responses API format
|
|
378
|
+
parts = []
|
|
379
|
+
|
|
380
|
+
# Get the output array from the response
|
|
381
|
+
output = data.get("output", [])
|
|
382
|
+
if not output:
|
|
383
|
+
is_error = True
|
|
384
|
+
error_message = "No output in response"
|
|
385
|
+
else:
|
|
386
|
+
# Process each output item
|
|
387
|
+
for item in output:
|
|
388
|
+
if item.get("type") == "message":
|
|
389
|
+
message_content = item.get("content", [])
|
|
390
|
+
for content_item in message_content:
|
|
391
|
+
if content_item.get("type") == "output_text":
|
|
392
|
+
parts.append(Text(content_item["text"]))
|
|
393
|
+
elif content_item.get("type") == "refusal":
|
|
394
|
+
parts.append(Text(content_item["refusal"]))
|
|
395
|
+
elif item.get("type") == "reasoning":
|
|
396
|
+
summary = item["summary"]
|
|
397
|
+
if not summary:
|
|
398
|
+
continue
|
|
399
|
+
if isinstance(summary, list) and len(summary) > 0:
|
|
400
|
+
summary = summary[0]
|
|
401
|
+
assert isinstance(
|
|
402
|
+
summary, dict
|
|
403
|
+
), "summary isn't a dict"
|
|
404
|
+
parts.append(Thinking(summary["text"]))
|
|
405
|
+
elif item.get("type") == "function_call":
|
|
406
|
+
parts.append(
|
|
407
|
+
ToolCall(
|
|
408
|
+
id=item["call_id"],
|
|
409
|
+
name=item["name"],
|
|
410
|
+
arguments=json.loads(item["arguments"]),
|
|
411
|
+
)
|
|
397
412
|
)
|
|
398
|
-
)
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
413
|
+
elif item.get("type") == "mcp_call":
|
|
414
|
+
parts.append(
|
|
415
|
+
ToolCall(
|
|
416
|
+
id=item["id"],
|
|
417
|
+
name=item["name"],
|
|
418
|
+
arguments=json.loads(item["arguments"]),
|
|
419
|
+
built_in=True,
|
|
420
|
+
built_in_type="mcp_call",
|
|
421
|
+
extra_body={
|
|
422
|
+
"server_label": item["server_label"],
|
|
423
|
+
"error": item.get("error"),
|
|
424
|
+
"output": item.get("output"),
|
|
425
|
+
},
|
|
426
|
+
)
|
|
412
427
|
)
|
|
413
|
-
)
|
|
414
428
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
429
|
+
elif item.get("type") == "computer_call":
|
|
430
|
+
parts.append(
|
|
431
|
+
ToolCall(
|
|
432
|
+
id=item["call_id"],
|
|
433
|
+
name="computer_call",
|
|
434
|
+
arguments=item.get("action"),
|
|
435
|
+
built_in=True,
|
|
436
|
+
built_in_type="computer_call",
|
|
437
|
+
)
|
|
423
438
|
)
|
|
424
|
-
)
|
|
425
439
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
440
|
+
elif item.get("type") == "web_search_call":
|
|
441
|
+
parts.append(
|
|
442
|
+
ToolCall(
|
|
443
|
+
id=item["id"],
|
|
444
|
+
name="web_search_call",
|
|
445
|
+
arguments={},
|
|
446
|
+
built_in=True,
|
|
447
|
+
built_in_type="web_search_call",
|
|
448
|
+
extra_body={"status": item["status"]},
|
|
449
|
+
)
|
|
435
450
|
)
|
|
436
|
-
)
|
|
437
451
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
452
|
+
elif item.get("type") == "file_search_call":
|
|
453
|
+
parts.append(
|
|
454
|
+
ToolCall(
|
|
455
|
+
id=item["id"],
|
|
456
|
+
name="file_search_call",
|
|
457
|
+
arguments={"queries": item["queries"]},
|
|
458
|
+
built_in=True,
|
|
459
|
+
built_in_type="file_search_call",
|
|
460
|
+
extra_body={
|
|
461
|
+
"status": item["status"],
|
|
462
|
+
"results": item["results"],
|
|
463
|
+
},
|
|
464
|
+
)
|
|
450
465
|
)
|
|
451
|
-
)
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
466
|
+
elif item.get("type") == "image_generation_call":
|
|
467
|
+
parts.append(
|
|
468
|
+
ToolCall(
|
|
469
|
+
id=item["id"],
|
|
470
|
+
name="image_generation_call",
|
|
471
|
+
arguments={},
|
|
472
|
+
built_in=True,
|
|
473
|
+
built_in_type="image_generation_call",
|
|
474
|
+
extra_body={
|
|
475
|
+
"status": item["status"],
|
|
476
|
+
"result": item["result"],
|
|
477
|
+
},
|
|
478
|
+
)
|
|
464
479
|
)
|
|
465
|
-
)
|
|
466
480
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
481
|
+
# Handle reasoning if present
|
|
482
|
+
if "reasoning" in data and data["reasoning"].get("summary"):
|
|
483
|
+
thinking = data["reasoning"]["summary"]
|
|
484
|
+
parts.append(Thinking(thinking))
|
|
471
485
|
|
|
472
|
-
|
|
486
|
+
content = Message("assistant", parts)
|
|
473
487
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
488
|
+
# Extract usage information
|
|
489
|
+
if "usage" in data and data["usage"] is not None:
|
|
490
|
+
usage = Usage.from_openai_usage(data["usage"])
|
|
477
491
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
492
|
+
except Exception as e:
|
|
493
|
+
is_error = True
|
|
494
|
+
error_message = f"Error parsing {self.model.name} responses API response: {str(e)}"
|
|
495
|
+
print("got data:", data)
|
|
496
|
+
traceback = tb.format_exc()
|
|
497
|
+
print(f"Error details:\n{traceback}")
|
|
484
498
|
|
|
485
499
|
elif mimetype and "json" in mimetype.lower():
|
|
486
500
|
print("is_error True, json response")
|
|
@@ -329,6 +329,18 @@ class Message:
|
|
|
329
329
|
"""Get all thinking parts with proper typing."""
|
|
330
330
|
return [part for part in self.parts if part.type == "thinking"] # type: ignore
|
|
331
331
|
|
|
332
|
+
# @staticmethod
|
|
333
|
+
# def dump_part(part: Part):
|
|
334
|
+
# if isinstance(value, Text):
|
|
335
|
+
# return {"type": "text", "text": value.text}
|
|
336
|
+
# if isinstance(value, Image):
|
|
337
|
+
# w, h = value.size
|
|
338
|
+
# return {"type": "image", "tag": f"<Image ({w}×{h})>"}
|
|
339
|
+
# if isinstance(value, File):
|
|
340
|
+
# size = value.size
|
|
341
|
+
# return {"type": "file", "tag": f"<File ({size} bytes)>"}
|
|
342
|
+
# return repr(value)
|
|
343
|
+
|
|
332
344
|
def to_log(self) -> dict:
|
|
333
345
|
"""
|
|
334
346
|
Return a JSON-serialisable dict that fully captures the message.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lm_deluge-0.0.65 → lm_deluge-0.0.67}/src/lm_deluge/built_in_tools/anthropic/computer_use.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|