mbxai 1.3.0__tar.gz → 1.4.0__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 (30) hide show
  1. {mbxai-1.3.0 → mbxai-1.4.0}/PKG-INFO +1 -1
  2. {mbxai-1.3.0 → mbxai-1.4.0}/pyproject.toml +2 -2
  3. {mbxai-1.3.0 → mbxai-1.4.0}/setup.py +1 -1
  4. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/__init__.py +1 -1
  5. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/examples/mcp/mcp_client_example.py +4 -0
  6. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/mcp/server.py +1 -1
  7. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/openrouter/client.py +18 -41
  8. {mbxai-1.3.0 → mbxai-1.4.0}/.gitignore +0 -0
  9. {mbxai-1.3.0 → mbxai-1.4.0}/LICENSE +0 -0
  10. {mbxai-1.3.0 → mbxai-1.4.0}/README.md +0 -0
  11. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/core.py +0 -0
  12. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/examples/mcp/mcp_server_example.py +0 -0
  13. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/examples/openrouter_example.py +0 -0
  14. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/examples/parse_example.py +0 -0
  15. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/examples/parse_tool_example.py +0 -0
  16. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/examples/request.json +0 -0
  17. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/examples/response.json +0 -0
  18. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/examples/send_request.py +0 -0
  19. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/examples/tool_client_example.py +0 -0
  20. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/mcp/__init__.py +0 -0
  21. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/mcp/client.py +0 -0
  22. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/mcp/example.py +0 -0
  23. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/openrouter/__init__.py +0 -0
  24. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/openrouter/config.py +0 -0
  25. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/openrouter/models.py +0 -0
  26. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/openrouter/schema.py +0 -0
  27. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/tools/__init__.py +0 -0
  28. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/tools/client.py +0 -0
  29. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/tools/example.py +0 -0
  30. {mbxai-1.3.0 → mbxai-1.4.0}/src/mbxai/tools/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mbxai
3
- Version: 1.3.0
3
+ Version: 1.4.0
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.3.0"
7
+ version = "1.4.0"
8
8
  authors = [
9
9
  { name = "MBX AI" }
10
10
  ]
@@ -82,6 +82,6 @@ strict_equality = true
82
82
 
83
83
  [dependency-groups]
84
84
  dev = [
85
- "build>=1.3.0.post1",
85
+ "build>=1.4.0.post1",
86
86
  "twine>=6.1.0",
87
87
  ]
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="mbxai",
5
- version="1.3.0",
5
+ version="1.4.0",
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.3.0"
5
+ __version__ = "1.4.0"
@@ -51,6 +51,10 @@ def main():
51
51
  if not hasattr(response, 'choices'):
52
52
  logger.error(f"Invalid response format - no choices attribute: {response}")
53
53
  return
54
+
55
+ if response.choices is None:
56
+ logger.error("Response choices is None")
57
+ return
54
58
 
55
59
  if not response.choices:
56
60
  logger.error("No choices in response")
@@ -31,7 +31,7 @@ class MCPServer:
31
31
  self.app = FastAPI(
32
32
  title=self.name,
33
33
  description=self.description,
34
- version="1.3.0",
34
+ version="1.4.0",
35
35
  )
36
36
 
37
37
  # Initialize MCP server
@@ -234,6 +234,15 @@ class OpenRouterClient:
234
234
  logger.error("Received None response from OpenRouter API")
235
235
  raise OpenRouterAPIError("Received None response from OpenRouter API")
236
236
 
237
+ # Validate response structure
238
+ if not hasattr(response, 'choices'):
239
+ logger.error(f"Response missing 'choices' attribute. Available attributes: {dir(response)}")
240
+ raise OpenRouterAPIError("Invalid response format: missing 'choices' attribute")
241
+
242
+ if response.choices is None:
243
+ logger.error("Response choices is None")
244
+ raise OpenRouterAPIError("Invalid response format: choices is None")
245
+
237
246
  logger.debug(f"Response type: {type(response)}")
238
247
  logger.debug(f"Response attributes: {dir(response)}")
239
248
  logger.debug(f"Received response from OpenRouter: {len(response.choices)} choices")
@@ -320,47 +329,6 @@ class OpenRouterClient:
320
329
  logger.error("Received None response from OpenRouter API")
321
330
  raise OpenRouterAPIError("Received None response from OpenRouter API")
322
331
 
323
- # Try to get the raw response content if available
324
- if hasattr(response, '_response'):
325
- try:
326
- raw_content = response._response.text
327
- logger.debug(f"Raw response content: {raw_content[:1000]}...")
328
- except Exception as e:
329
- logger.debug(f"Could not get raw response content: {e}")
330
-
331
- # Validate response structure
332
- if not hasattr(response, 'choices'):
333
- logger.error(f"Response missing 'choices' attribute. Available attributes: {dir(response)}")
334
- raise OpenRouterAPIError("Invalid response format: missing 'choices' attribute")
335
-
336
- if not response.choices:
337
- logger.error("Response has empty choices list")
338
- raise OpenRouterAPIError("Invalid response format: empty choices list")
339
-
340
- if not hasattr(response.choices[0], 'message'):
341
- logger.error(f"First choice missing 'message' attribute. Available attributes: {dir(response.choices[0])}")
342
- raise OpenRouterAPIError("Invalid response format: missing 'message' attribute in first choice")
343
-
344
- # Check if the message has a parsed attribute or content
345
- if not hasattr(response.choices[0].message, 'parsed') and not hasattr(response.choices[0].message, 'content'):
346
- logger.error(f"Message missing both 'parsed' and 'content' attributes. Available attributes: {dir(response.choices[0].message)}")
347
- raise OpenRouterAPIError("Invalid response format: message must have either 'parsed' or 'content' attribute")
348
-
349
- # If there's no parsed attribute but there is content, try to parse it
350
- if not hasattr(response.choices[0].message, 'parsed') and hasattr(response.choices[0].message, 'content'):
351
- try:
352
- content = response.choices[0].message.content
353
- if isinstance(content, str):
354
- parsed = json.loads(content)
355
- response.choices[0].message.parsed = parsed
356
- else:
357
- response.choices[0].message.parsed = content
358
- except Exception as e:
359
- stack_trace = traceback.format_exc()
360
- logger.error(f"Failed to parse message content: {str(e)}")
361
- logger.error(f"Stack trace:\n{stack_trace}")
362
- raise OpenRouterAPIError(f"Failed to parse message content: {str(e)}\nStack trace:\n{stack_trace}")
363
-
364
332
  logger.debug(f"Received response from OpenRouter: {len(response.choices)} choices")
365
333
 
366
334
  return response
@@ -431,6 +399,15 @@ class OpenRouterClient:
431
399
  logger.error("Received None response from OpenRouter API")
432
400
  raise OpenRouterAPIError("Received None response from OpenRouter API")
433
401
 
402
+ # Validate response structure
403
+ if not hasattr(response, 'choices'):
404
+ logger.error(f"Response missing 'choices' attribute. Available attributes: {dir(response)}")
405
+ raise OpenRouterAPIError("Invalid response format: missing 'choices' attribute")
406
+
407
+ if response.choices is None:
408
+ logger.error("Response choices is None")
409
+ raise OpenRouterAPIError("Invalid response format: choices is None")
410
+
434
411
  logger.debug(f"Response type: {type(response)}")
435
412
  logger.debug(f"Response attributes: {dir(response)}")
436
413
  logger.debug(f"Received response from OpenRouter: {len(response.choices)} choices")
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