mbxai 1.0.7__tar.gz → 1.0.9__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.
Files changed (26) hide show
  1. {mbxai-1.0.7 → mbxai-1.0.9}/PKG-INFO +1 -1
  2. {mbxai-1.0.7 → mbxai-1.0.9}/pyproject.toml +1 -1
  3. {mbxai-1.0.7 → mbxai-1.0.9}/setup.py +1 -1
  4. {mbxai-1.0.7 → mbxai-1.0.9}/src/mbxai/__init__.py +1 -1
  5. {mbxai-1.0.7 → mbxai-1.0.9}/src/mbxai/mcp/server.py +1 -1
  6. {mbxai-1.0.7 → mbxai-1.0.9}/src/mbxai/openrouter/client.py +37 -3
  7. {mbxai-1.0.7 → mbxai-1.0.9}/.gitignore +0 -0
  8. {mbxai-1.0.7 → mbxai-1.0.9}/LICENSE +0 -0
  9. {mbxai-1.0.7 → mbxai-1.0.9}/README.md +0 -0
  10. {mbxai-1.0.7 → mbxai-1.0.9}/src/mbxai/core.py +0 -0
  11. {mbxai-1.0.7 → mbxai-1.0.9}/src/mbxai/examples/mcp/mcp_client_example.py +0 -0
  12. {mbxai-1.0.7 → mbxai-1.0.9}/src/mbxai/examples/mcp/mcp_server_example.py +0 -0
  13. {mbxai-1.0.7 → mbxai-1.0.9}/src/mbxai/examples/openrouter_example.py +0 -0
  14. {mbxai-1.0.7 → mbxai-1.0.9}/src/mbxai/examples/parse_example.py +0 -0
  15. {mbxai-1.0.7 → mbxai-1.0.9}/src/mbxai/examples/parse_tool_example.py +0 -0
  16. {mbxai-1.0.7 → mbxai-1.0.9}/src/mbxai/examples/tool_client_example.py +0 -0
  17. {mbxai-1.0.7 → mbxai-1.0.9}/src/mbxai/mcp/__init__.py +0 -0
  18. {mbxai-1.0.7 → mbxai-1.0.9}/src/mbxai/mcp/client.py +0 -0
  19. {mbxai-1.0.7 → mbxai-1.0.9}/src/mbxai/mcp/example.py +0 -0
  20. {mbxai-1.0.7 → mbxai-1.0.9}/src/mbxai/openrouter/__init__.py +0 -0
  21. {mbxai-1.0.7 → mbxai-1.0.9}/src/mbxai/openrouter/config.py +0 -0
  22. {mbxai-1.0.7 → mbxai-1.0.9}/src/mbxai/openrouter/models.py +0 -0
  23. {mbxai-1.0.7 → mbxai-1.0.9}/src/mbxai/tools/__init__.py +0 -0
  24. {mbxai-1.0.7 → mbxai-1.0.9}/src/mbxai/tools/client.py +0 -0
  25. {mbxai-1.0.7 → mbxai-1.0.9}/src/mbxai/tools/example.py +0 -0
  26. {mbxai-1.0.7 → mbxai-1.0.9}/src/mbxai/tools/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mbxai
3
- Version: 1.0.7
3
+ Version: 1.0.9
4
4
  Summary: MBX AI SDK
5
5
  Project-URL: Homepage, https://www.mibexx.de
6
6
  Project-URL: Documentation, https://www.mibexx.de
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "mbxai"
7
- version = "1.0.7"
7
+ version = "1.0.9"
8
8
  authors = [
9
9
  { name = "MBX AI" }
10
10
  ]
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="mbxai",
5
- version="1.0.7",
5
+ version="1.0.9",
6
6
  author="MBX AI",
7
7
  description="MBX AI SDK",
8
8
  long_description=open("README.md").read(),
@@ -2,4 +2,4 @@
2
2
  MBX AI package.
3
3
  """
4
4
 
5
- __version__ = "1.0.7"
5
+ __version__ = "1.0.9"
@@ -31,7 +31,7 @@ class MCPServer:
31
31
  self.app = FastAPI(
32
32
  title=self.name,
33
33
  description=self.description,
34
- version="1.0.7",
34
+ version="1.0.9",
35
35
  )
36
36
 
37
37
  # Initialize MCP server
@@ -3,7 +3,7 @@ OpenRouter client implementation.
3
3
  """
4
4
 
5
5
  from typing import Any, Optional, Union
6
- from openai import OpenAI, OpenAIError
6
+ from openai import OpenAI, OpenAIError, RateLimitError, APITimeoutError, APIConnectionError, BadRequestError, AuthenticationError
7
7
  from .models import OpenRouterModel, OpenRouterModelRegistry
8
8
  from .config import OpenRouterConfig
9
9
  import logging
@@ -271,14 +271,48 @@ class OpenRouterClient:
271
271
  **kwargs,
272
272
  }
273
273
 
274
- response = self._client.beta.chat.completions.parse(**request)
274
+ # Log the full request for debugging
275
+ logger.debug(f"Full request: {request}")
275
276
 
276
- logger.debug(f"FullResponse: {response}")
277
+ try:
278
+ response = self._client.beta.chat.completions.parse(**request)
279
+ except RateLimitError as e:
280
+ logger.error(f"Rate limit exceeded: {str(e)}")
281
+ raise OpenRouterAPIError(f"Rate limit exceeded: {str(e)}")
282
+ except APITimeoutError as e:
283
+ logger.error(f"API timeout: {str(e)}")
284
+ raise OpenRouterConnectionError(f"API timeout: {str(e)}")
285
+ except APIConnectionError as e:
286
+ logger.error(f"API connection error: {str(e)}")
287
+ raise OpenRouterConnectionError(f"API connection error: {str(e)}")
288
+ except AuthenticationError as e:
289
+ logger.error(f"Authentication error: {str(e)}")
290
+ raise OpenRouterAPIError(f"Authentication error: {str(e)}")
291
+ except BadRequestError as e:
292
+ logger.error(f"Bad request: {str(e)}")
293
+ raise OpenRouterAPIError(f"Bad request: {str(e)}")
294
+ except OpenAIError as e:
295
+ logger.error(f"OpenAI error: {str(e)}")
296
+ raise OpenRouterAPIError(f"OpenAI error: {str(e)}")
297
+
298
+ # Log raw response for debugging
299
+ logger.debug(f"Raw response: {response}")
300
+ if hasattr(response, '__dict__'):
301
+ logger.debug(f"Response attributes: {dir(response)}")
302
+ logger.debug(f"Response dict: {response.__dict__}")
277
303
 
278
304
  if response is None:
279
305
  logger.error("Received None response from OpenRouter API")
280
306
  raise OpenRouterAPIError("Received None response from OpenRouter API")
281
307
 
308
+ # Try to get the raw response content if available
309
+ if hasattr(response, '_response'):
310
+ try:
311
+ raw_content = response._response.text
312
+ logger.debug(f"Raw response content: {raw_content[:1000]}...")
313
+ except Exception as e:
314
+ logger.debug(f"Could not get raw response content: {e}")
315
+
282
316
  # Validate response structure
283
317
  if not hasattr(response, 'choices'):
284
318
  logger.error(f"Response missing 'choices' attribute. Available attributes: {dir(response)}")
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