mbxai 1.0.0__tar.gz → 1.0.2__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.0 → mbxai-1.0.2}/PKG-INFO +1 -1
  2. {mbxai-1.0.0 → mbxai-1.0.2}/pyproject.toml +1 -1
  3. {mbxai-1.0.0 → mbxai-1.0.2}/setup.py +1 -1
  4. {mbxai-1.0.0 → mbxai-1.0.2}/src/mbxai/__init__.py +1 -1
  5. {mbxai-1.0.0 → mbxai-1.0.2}/src/mbxai/mcp/server.py +1 -1
  6. {mbxai-1.0.0 → mbxai-1.0.2}/src/mbxai/openrouter/client.py +27 -4
  7. {mbxai-1.0.0 → mbxai-1.0.2}/.gitignore +0 -0
  8. {mbxai-1.0.0 → mbxai-1.0.2}/LICENSE +0 -0
  9. {mbxai-1.0.0 → mbxai-1.0.2}/README.md +0 -0
  10. {mbxai-1.0.0 → mbxai-1.0.2}/src/mbxai/core.py +0 -0
  11. {mbxai-1.0.0 → mbxai-1.0.2}/src/mbxai/examples/mcp/mcp_client_example.py +0 -0
  12. {mbxai-1.0.0 → mbxai-1.0.2}/src/mbxai/examples/mcp/mcp_server_example.py +0 -0
  13. {mbxai-1.0.0 → mbxai-1.0.2}/src/mbxai/examples/openrouter_example.py +0 -0
  14. {mbxai-1.0.0 → mbxai-1.0.2}/src/mbxai/examples/parse_example.py +0 -0
  15. {mbxai-1.0.0 → mbxai-1.0.2}/src/mbxai/examples/parse_tool_example.py +0 -0
  16. {mbxai-1.0.0 → mbxai-1.0.2}/src/mbxai/examples/tool_client_example.py +0 -0
  17. {mbxai-1.0.0 → mbxai-1.0.2}/src/mbxai/mcp/__init__.py +0 -0
  18. {mbxai-1.0.0 → mbxai-1.0.2}/src/mbxai/mcp/client.py +0 -0
  19. {mbxai-1.0.0 → mbxai-1.0.2}/src/mbxai/mcp/example.py +0 -0
  20. {mbxai-1.0.0 → mbxai-1.0.2}/src/mbxai/openrouter/__init__.py +0 -0
  21. {mbxai-1.0.0 → mbxai-1.0.2}/src/mbxai/openrouter/config.py +0 -0
  22. {mbxai-1.0.0 → mbxai-1.0.2}/src/mbxai/openrouter/models.py +0 -0
  23. {mbxai-1.0.0 → mbxai-1.0.2}/src/mbxai/tools/__init__.py +0 -0
  24. {mbxai-1.0.0 → mbxai-1.0.2}/src/mbxai/tools/client.py +0 -0
  25. {mbxai-1.0.0 → mbxai-1.0.2}/src/mbxai/tools/example.py +0 -0
  26. {mbxai-1.0.0 → mbxai-1.0.2}/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.0
3
+ Version: 1.0.2
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.0"
7
+ version = "1.0.2"
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.0",
5
+ version="1.0.2",
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.0"
5
+ __version__ = "1.0.2"
@@ -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.0",
34
+ version="1.0.2",
35
35
  )
36
36
 
37
37
  # Initialize MCP server
@@ -213,14 +213,21 @@ class OpenRouterClient:
213
213
 
214
214
  response = self._client.chat.completions.create(**request)
215
215
 
216
- logger.info(f"Response: {response}")
216
+ if response is None:
217
+ logger.error("Received None response from OpenRouter API")
218
+ raise OpenRouterAPIError("Received None response from OpenRouter API")
217
219
 
220
+ logger.info(f"Response type: {type(response)}")
221
+ logger.info(f"Response attributes: {dir(response)}")
218
222
  logger.info(f"Received response from OpenRouter: {len(response.choices)} choices")
219
223
 
220
224
  return response
221
225
 
222
226
  except Exception as e:
223
227
  logger.error(f"Error in chat completion: {str(e)}")
228
+ logger.error(f"Request details: model={model or self.model}, stream={stream}, kwargs={kwargs}")
229
+ logger.error(f"Message structure: {[{'role': msg.get('role'), 'content_length': len(str(msg.get('content', '')))} for msg in messages]}")
230
+
224
231
  if hasattr(e, 'response') and e.response is not None:
225
232
  logger.error(f"Response status: {e.response.status_code}")
226
233
  logger.error(f"Response headers: {e.response.headers}")
@@ -244,8 +251,9 @@ class OpenRouterClient:
244
251
  """Get a chat completion from OpenRouter."""
245
252
  try:
246
253
  # Log the request details
247
- logger.info(f"Sending chat completion request to OpenRouter with model: {model or self.model}")
254
+ logger.info(f"Sending parse request to OpenRouter with model: {model or self.model}")
248
255
  logger.info(f"Message count: {len(messages)}")
256
+ logger.info(f"Response format: {response_format}")
249
257
 
250
258
  # Calculate total message size for logging
251
259
  total_size = sum(len(str(msg)) for msg in messages)
@@ -259,12 +267,27 @@ class OpenRouterClient:
259
267
  }
260
268
 
261
269
  response = self._client.beta.chat.completions.parse(**request)
270
+
271
+ if response is None:
272
+ logger.error("Received None response from OpenRouter API")
273
+ raise OpenRouterAPIError("Received None response from OpenRouter API")
274
+
275
+ logger.info(f"Response type: {type(response)}")
276
+ logger.info(f"Response attributes: {dir(response)}")
277
+
278
+ if not hasattr(response, 'choices'):
279
+ logger.error(f"Response missing 'choices' attribute. Available attributes: {dir(response)}")
280
+ raise OpenRouterAPIError("Invalid response format: missing 'choices' attribute")
281
+
262
282
  logger.info(f"Received response from OpenRouter: {len(response.choices)} choices")
263
283
 
264
284
  return response
265
285
 
266
286
  except Exception as e:
267
- logger.error(f"Error in chat completion: {str(e)}")
287
+ logger.error(f"Error in parse completion: {str(e)}")
288
+ logger.error(f"Request details: model={model or self.model}, response_format={response_format}, kwargs={kwargs}")
289
+ logger.error(f"Message structure: {[{'role': msg.get('role'), 'content_length': len(str(msg.get('content', '')))} for msg in messages]}")
290
+
268
291
  if hasattr(e, 'response') and e.response is not None:
269
292
  logger.error(f"Response status: {e.response.status_code}")
270
293
  logger.error(f"Response headers: {e.response.headers}")
@@ -274,7 +297,7 @@ class OpenRouterClient:
274
297
  logger.error(f"Response content preview: {content[:1000]}...")
275
298
  except:
276
299
  logger.error("Could not read response content")
277
- self._handle_api_error("chat completion", e)
300
+ self._handle_api_error("parse completion", e)
278
301
 
279
302
  @classmethod
280
303
  def register_model(cls, name: str, value: str) -> None:
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