lm-deluge 0.0.63__tar.gz → 0.0.64__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.63/src/lm_deluge.egg-info → lm_deluge-0.0.64}/PKG-INFO +1 -1
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/pyproject.toml +1 -1
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/tool.py +51 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64/src/lm_deluge.egg-info}/PKG-INFO +1 -1
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/LICENSE +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/README.md +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/setup.cfg +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/__init__.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/api_requests/__init__.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/api_requests/anthropic.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/api_requests/base.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/api_requests/bedrock.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/api_requests/common.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/api_requests/deprecated/bedrock.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/api_requests/deprecated/cohere.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/api_requests/deprecated/deepseek.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/api_requests/deprecated/mistral.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/api_requests/deprecated/vertex.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/api_requests/gemini.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/api_requests/mistral.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/api_requests/openai.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/api_requests/response.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/batches.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/built_in_tools/anthropic/__init__.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/built_in_tools/anthropic/bash.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/built_in_tools/anthropic/computer_use.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/built_in_tools/anthropic/editor.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/built_in_tools/base.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/built_in_tools/openai.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/cache.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/cli.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/client.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/config.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/embed.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/errors.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/file.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/image.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/llm_tools/__init__.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/llm_tools/classify.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/llm_tools/extract.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/llm_tools/locate.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/llm_tools/ocr.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/llm_tools/score.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/llm_tools/translate.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/models/__init__.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/models/anthropic.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/models/bedrock.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/models/cerebras.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/models/cohere.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/models/deepseek.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/models/fireworks.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/models/google.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/models/grok.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/models/groq.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/models/meta.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/models/mistral.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/models/openai.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/models/openrouter.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/models/together.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/presets/cerebras.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/presets/meta.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/prompt.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/request_context.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/rerank.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/tracker.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/usage.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/util/harmony.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/util/json.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/util/logprobs.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/util/spatial.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/util/validation.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/util/xml.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge/warnings.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge.egg-info/SOURCES.txt +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge.egg-info/dependency_links.txt +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge.egg-info/requires.txt +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/src/lm_deluge.egg-info/top_level.txt +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/tests/test_builtin_tools.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/tests/test_file_upload.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/tests/test_native_mcp_server.py +0 -0
- {lm_deluge-0.0.63 → lm_deluge-0.0.64}/tests/test_openrouter_generic.py +0 -0
|
@@ -239,6 +239,9 @@ async def _load_all_mcp_tools(client: Client) -> list["Tool"]:
|
|
|
239
239
|
|
|
240
240
|
tools: list[Tool] = []
|
|
241
241
|
for m in metas:
|
|
242
|
+
# Extract definitions from the schema (could be $defs or definitions)
|
|
243
|
+
definitions = m.inputSchema.get("$defs") or m.inputSchema.get("definitions")
|
|
244
|
+
|
|
242
245
|
tools.append(
|
|
243
246
|
Tool(
|
|
244
247
|
name=m.name,
|
|
@@ -246,6 +249,7 @@ async def _load_all_mcp_tools(client: Client) -> list["Tool"]:
|
|
|
246
249
|
parameters=m.inputSchema.get("properties", {}),
|
|
247
250
|
required=m.inputSchema.get("required", []),
|
|
248
251
|
additionalProperties=m.inputSchema.get("additionalProperties"),
|
|
252
|
+
definitions=definitions,
|
|
249
253
|
run=make_runner(m.name),
|
|
250
254
|
)
|
|
251
255
|
)
|
|
@@ -268,6 +272,8 @@ class Tool(BaseModel):
|
|
|
268
272
|
is_built_in: bool = False
|
|
269
273
|
type: str | None = None
|
|
270
274
|
built_in_args: dict[str, Any] = Field(default_factory=dict)
|
|
275
|
+
# JSON Schema definitions (for $ref support)
|
|
276
|
+
definitions: dict[str, Any] | None = None
|
|
271
277
|
|
|
272
278
|
@field_validator("name")
|
|
273
279
|
@classmethod
|
|
@@ -562,6 +568,34 @@ class Tool(BaseModel):
|
|
|
562
568
|
"""
|
|
563
569
|
return _python_type_to_json_schema_enhanced(python_type)
|
|
564
570
|
|
|
571
|
+
def _is_strict_mode_compatible(self) -> bool:
|
|
572
|
+
"""
|
|
573
|
+
Check if this tool's schema is compatible with OpenAI strict mode.
|
|
574
|
+
Strict mode requires all objects to have defined properties.
|
|
575
|
+
"""
|
|
576
|
+
|
|
577
|
+
def has_undefined_objects(schema: dict | list | Any) -> bool:
|
|
578
|
+
"""Recursively check for objects without defined properties."""
|
|
579
|
+
if isinstance(schema, dict):
|
|
580
|
+
# Check if this is an object type without properties
|
|
581
|
+
if schema.get("type") == "object":
|
|
582
|
+
# If additionalProperties is True or properties is missing/empty
|
|
583
|
+
if schema.get("additionalProperties") is True:
|
|
584
|
+
return True
|
|
585
|
+
if "properties" not in schema or not schema["properties"]:
|
|
586
|
+
return True
|
|
587
|
+
# Recursively check nested schemas
|
|
588
|
+
for value in schema.values():
|
|
589
|
+
if has_undefined_objects(value):
|
|
590
|
+
return True
|
|
591
|
+
elif isinstance(schema, list):
|
|
592
|
+
for item in schema:
|
|
593
|
+
if has_undefined_objects(item):
|
|
594
|
+
return True
|
|
595
|
+
return False
|
|
596
|
+
|
|
597
|
+
return not has_undefined_objects(self.parameters or {})
|
|
598
|
+
|
|
565
599
|
def _json_schema(
|
|
566
600
|
self, include_additional_properties=False, remove_defaults=False
|
|
567
601
|
) -> dict[str, Any]:
|
|
@@ -614,6 +648,14 @@ class Tool(BaseModel):
|
|
|
614
648
|
else:
|
|
615
649
|
processed_parameters = self.parameters
|
|
616
650
|
|
|
651
|
+
# Process definitions too
|
|
652
|
+
if self.definitions and include_additional_properties:
|
|
653
|
+
processed_definitions = _add_additional_properties_recursive(
|
|
654
|
+
self.definitions, remove_defaults
|
|
655
|
+
)
|
|
656
|
+
else:
|
|
657
|
+
processed_definitions = self.definitions
|
|
658
|
+
|
|
617
659
|
res = {
|
|
618
660
|
"type": "object",
|
|
619
661
|
"properties": processed_parameters,
|
|
@@ -623,6 +665,10 @@ class Tool(BaseModel):
|
|
|
623
665
|
if include_additional_properties:
|
|
624
666
|
res["additionalProperties"] = False
|
|
625
667
|
|
|
668
|
+
# Include definitions if present (for $ref support)
|
|
669
|
+
if processed_definitions:
|
|
670
|
+
res["$defs"] = processed_definitions
|
|
671
|
+
|
|
626
672
|
return res
|
|
627
673
|
|
|
628
674
|
# ---------- dumpers ----------
|
|
@@ -631,6 +677,11 @@ class Tool(BaseModel):
|
|
|
631
677
|
) -> dict[str, Any]:
|
|
632
678
|
if self.is_built_in:
|
|
633
679
|
return {"type": self.type, **self.built_in_args, **kwargs}
|
|
680
|
+
|
|
681
|
+
# Check if schema is compatible with strict mode
|
|
682
|
+
if strict and not self._is_strict_mode_compatible():
|
|
683
|
+
strict = False
|
|
684
|
+
|
|
634
685
|
if strict:
|
|
635
686
|
# For strict mode, remove defaults and make all parameters required
|
|
636
687
|
schema = self._json_schema(
|
|
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
|
{lm_deluge-0.0.63 → lm_deluge-0.0.64}/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
|