mbxai 1.0.2__tar.gz → 1.0.4__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.2 → mbxai-1.0.4}/PKG-INFO +1 -1
  2. {mbxai-1.0.2 → mbxai-1.0.4}/pyproject.toml +1 -1
  3. {mbxai-1.0.2 → mbxai-1.0.4}/setup.py +1 -1
  4. {mbxai-1.0.2 → mbxai-1.0.4}/src/mbxai/__init__.py +1 -1
  5. {mbxai-1.0.2 → mbxai-1.0.4}/src/mbxai/mcp/server.py +1 -1
  6. {mbxai-1.0.2 → mbxai-1.0.4}/src/mbxai/openrouter/client.py +31 -1
  7. {mbxai-1.0.2 → mbxai-1.0.4}/.gitignore +0 -0
  8. {mbxai-1.0.2 → mbxai-1.0.4}/LICENSE +0 -0
  9. {mbxai-1.0.2 → mbxai-1.0.4}/README.md +0 -0
  10. {mbxai-1.0.2 → mbxai-1.0.4}/src/mbxai/core.py +0 -0
  11. {mbxai-1.0.2 → mbxai-1.0.4}/src/mbxai/examples/mcp/mcp_client_example.py +0 -0
  12. {mbxai-1.0.2 → mbxai-1.0.4}/src/mbxai/examples/mcp/mcp_server_example.py +0 -0
  13. {mbxai-1.0.2 → mbxai-1.0.4}/src/mbxai/examples/openrouter_example.py +0 -0
  14. {mbxai-1.0.2 → mbxai-1.0.4}/src/mbxai/examples/parse_example.py +0 -0
  15. {mbxai-1.0.2 → mbxai-1.0.4}/src/mbxai/examples/parse_tool_example.py +0 -0
  16. {mbxai-1.0.2 → mbxai-1.0.4}/src/mbxai/examples/tool_client_example.py +0 -0
  17. {mbxai-1.0.2 → mbxai-1.0.4}/src/mbxai/mcp/__init__.py +0 -0
  18. {mbxai-1.0.2 → mbxai-1.0.4}/src/mbxai/mcp/client.py +0 -0
  19. {mbxai-1.0.2 → mbxai-1.0.4}/src/mbxai/mcp/example.py +0 -0
  20. {mbxai-1.0.2 → mbxai-1.0.4}/src/mbxai/openrouter/__init__.py +0 -0
  21. {mbxai-1.0.2 → mbxai-1.0.4}/src/mbxai/openrouter/config.py +0 -0
  22. {mbxai-1.0.2 → mbxai-1.0.4}/src/mbxai/openrouter/models.py +0 -0
  23. {mbxai-1.0.2 → mbxai-1.0.4}/src/mbxai/tools/__init__.py +0 -0
  24. {mbxai-1.0.2 → mbxai-1.0.4}/src/mbxai/tools/client.py +0 -0
  25. {mbxai-1.0.2 → mbxai-1.0.4}/src/mbxai/tools/example.py +0 -0
  26. {mbxai-1.0.2 → mbxai-1.0.4}/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.2
3
+ Version: 1.0.4
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.2"
7
+ version = "1.0.4"
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.2",
5
+ version="1.0.4",
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.2"
5
+ __version__ = "1.0.4"
@@ -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.2",
34
+ version="1.0.4",
35
35
  )
36
36
 
37
37
  # Initialize MCP server
@@ -268,6 +268,8 @@ class OpenRouterClient:
268
268
 
269
269
  response = self._client.beta.chat.completions.parse(**request)
270
270
 
271
+ logger.debug(f"Full Response: {response}")
272
+
271
273
  if response is None:
272
274
  logger.error("Received None response from OpenRouter API")
273
275
  raise OpenRouterAPIError("Received None response from OpenRouter API")
@@ -275,10 +277,38 @@ class OpenRouterClient:
275
277
  logger.info(f"Response type: {type(response)}")
276
278
  logger.info(f"Response attributes: {dir(response)}")
277
279
 
280
+ # Validate response structure
278
281
  if not hasattr(response, 'choices'):
279
282
  logger.error(f"Response missing 'choices' attribute. Available attributes: {dir(response)}")
280
283
  raise OpenRouterAPIError("Invalid response format: missing 'choices' attribute")
281
-
284
+
285
+ if not response.choices:
286
+ logger.error("Response has empty choices list")
287
+ raise OpenRouterAPIError("Invalid response format: empty choices list")
288
+
289
+ if not hasattr(response.choices[0], 'message'):
290
+ logger.error(f"First choice missing 'message' attribute. Available attributes: {dir(response.choices[0])}")
291
+ raise OpenRouterAPIError("Invalid response format: missing 'message' attribute in first choice")
292
+
293
+ # Check if the message has a parsed attribute or content
294
+ if not hasattr(response.choices[0].message, 'parsed') and not hasattr(response.choices[0].message, 'content'):
295
+ logger.error(f"Message missing both 'parsed' and 'content' attributes. Available attributes: {dir(response.choices[0].message)}")
296
+ raise OpenRouterAPIError("Invalid response format: message must have either 'parsed' or 'content' attribute")
297
+
298
+ # If there's no parsed attribute but there is content, try to parse it
299
+ if not hasattr(response.choices[0].message, 'parsed') and hasattr(response.choices[0].message, 'content'):
300
+ try:
301
+ import json
302
+ content = response.choices[0].message.content
303
+ if isinstance(content, str):
304
+ parsed = json.loads(content)
305
+ response.choices[0].message.parsed = parsed
306
+ else:
307
+ response.choices[0].message.parsed = content
308
+ except Exception as e:
309
+ logger.error(f"Failed to parse message content: {str(e)}")
310
+ raise OpenRouterAPIError(f"Failed to parse message content: {str(e)}")
311
+
282
312
  logger.info(f"Received response from OpenRouter: {len(response.choices)} choices")
283
313
 
284
314
  return 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