mbxai 1.0.11__tar.gz → 1.0.13__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.
- {mbxai-1.0.11 → mbxai-1.0.13}/PKG-INFO +1 -1
- {mbxai-1.0.11 → mbxai-1.0.13}/pyproject.toml +1 -1
- {mbxai-1.0.11 → mbxai-1.0.13}/setup.py +1 -1
- {mbxai-1.0.11 → mbxai-1.0.13}/src/mbxai/__init__.py +1 -1
- {mbxai-1.0.11 → mbxai-1.0.13}/src/mbxai/mcp/server.py +1 -1
- {mbxai-1.0.11 → mbxai-1.0.13}/src/mbxai/openrouter/client.py +11 -2
- {mbxai-1.0.11 → mbxai-1.0.13}/.gitignore +0 -0
- {mbxai-1.0.11 → mbxai-1.0.13}/LICENSE +0 -0
- {mbxai-1.0.11 → mbxai-1.0.13}/README.md +0 -0
- {mbxai-1.0.11 → mbxai-1.0.13}/src/mbxai/core.py +0 -0
- {mbxai-1.0.11 → mbxai-1.0.13}/src/mbxai/examples/mcp/mcp_client_example.py +0 -0
- {mbxai-1.0.11 → mbxai-1.0.13}/src/mbxai/examples/mcp/mcp_server_example.py +0 -0
- {mbxai-1.0.11 → mbxai-1.0.13}/src/mbxai/examples/openrouter_example.py +0 -0
- {mbxai-1.0.11 → mbxai-1.0.13}/src/mbxai/examples/parse_example.py +0 -0
- {mbxai-1.0.11 → mbxai-1.0.13}/src/mbxai/examples/parse_tool_example.py +0 -0
- {mbxai-1.0.11 → mbxai-1.0.13}/src/mbxai/examples/tool_client_example.py +0 -0
- {mbxai-1.0.11 → mbxai-1.0.13}/src/mbxai/mcp/__init__.py +0 -0
- {mbxai-1.0.11 → mbxai-1.0.13}/src/mbxai/mcp/client.py +0 -0
- {mbxai-1.0.11 → mbxai-1.0.13}/src/mbxai/mcp/example.py +0 -0
- {mbxai-1.0.11 → mbxai-1.0.13}/src/mbxai/openrouter/__init__.py +0 -0
- {mbxai-1.0.11 → mbxai-1.0.13}/src/mbxai/openrouter/config.py +0 -0
- {mbxai-1.0.11 → mbxai-1.0.13}/src/mbxai/openrouter/models.py +0 -0
- {mbxai-1.0.11 → mbxai-1.0.13}/src/mbxai/tools/__init__.py +0 -0
- {mbxai-1.0.11 → mbxai-1.0.13}/src/mbxai/tools/client.py +0 -0
- {mbxai-1.0.11 → mbxai-1.0.13}/src/mbxai/tools/example.py +0 -0
- {mbxai-1.0.11 → mbxai-1.0.13}/src/mbxai/tools/types.py +0 -0
@@ -90,6 +90,16 @@ def with_retry(max_retries: int = 3, initial_delay: float = 1.0, max_delay: floa
|
|
90
90
|
return decorator
|
91
91
|
|
92
92
|
|
93
|
+
class CustomJSONEncoder(json.JSONEncoder):
|
94
|
+
"""Custom JSON encoder to handle special types."""
|
95
|
+
def default(self, obj):
|
96
|
+
if hasattr(obj, '__name__'):
|
97
|
+
return obj.__name__
|
98
|
+
if hasattr(obj, '__dict__'):
|
99
|
+
return obj.__dict__
|
100
|
+
return str(obj)
|
101
|
+
|
102
|
+
|
93
103
|
class OpenRouterClient:
|
94
104
|
"""Client for interacting with the OpenRouter API."""
|
95
105
|
|
@@ -336,7 +346,6 @@ class OpenRouterClient:
|
|
336
346
|
# If there's no parsed attribute but there is content, try to parse it
|
337
347
|
if not hasattr(response.choices[0].message, 'parsed') and hasattr(response.choices[0].message, 'content'):
|
338
348
|
try:
|
339
|
-
import json
|
340
349
|
content = response.choices[0].message.content
|
341
350
|
if isinstance(content, str):
|
342
351
|
parsed = json.loads(content)
|
@@ -356,7 +365,7 @@ class OpenRouterClient:
|
|
356
365
|
except Exception as e:
|
357
366
|
stack_trace = traceback.format_exc()
|
358
367
|
logger.error(f"Raising error: {e}")
|
359
|
-
logger.error(f"Full request from ERROR:\n{json.dumps(request, indent=2)}")
|
368
|
+
logger.error(f"Full request from ERROR:\n{json.dumps(request, indent=2, cls=CustomJSONEncoder)}")
|
360
369
|
logger.error(f"Error in parse completion: {str(e)}")
|
361
370
|
logger.error(f"Stack trace:\n{stack_trace}")
|
362
371
|
|
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
|