mbxai 1.0.1__py3-none-any.whl → 1.0.3__py3-none-any.whl
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/__init__.py +1 -1
- mbxai/mcp/server.py +1 -1
- mbxai/openrouter/client.py +33 -0
- {mbxai-1.0.1.dist-info → mbxai-1.0.3.dist-info}/METADATA +1 -1
- {mbxai-1.0.1.dist-info → mbxai-1.0.3.dist-info}/RECORD +7 -7
- {mbxai-1.0.1.dist-info → mbxai-1.0.3.dist-info}/WHEEL +0 -0
- {mbxai-1.0.1.dist-info → mbxai-1.0.3.dist-info}/licenses/LICENSE +0 -0
mbxai/__init__.py
CHANGED
mbxai/mcp/server.py
CHANGED
mbxai/openrouter/client.py
CHANGED
@@ -274,6 +274,39 @@ class OpenRouterClient:
|
|
274
274
|
|
275
275
|
logger.info(f"Response type: {type(response)}")
|
276
276
|
logger.info(f"Response attributes: {dir(response)}")
|
277
|
+
|
278
|
+
# Validate response structure
|
279
|
+
if not hasattr(response, 'choices'):
|
280
|
+
logger.error(f"Response missing 'choices' attribute. Available attributes: {dir(response)}")
|
281
|
+
raise OpenRouterAPIError("Invalid response format: missing 'choices' attribute")
|
282
|
+
|
283
|
+
if not response.choices:
|
284
|
+
logger.error("Response has empty choices list")
|
285
|
+
raise OpenRouterAPIError("Invalid response format: empty choices list")
|
286
|
+
|
287
|
+
if not hasattr(response.choices[0], 'message'):
|
288
|
+
logger.error(f"First choice missing 'message' attribute. Available attributes: {dir(response.choices[0])}")
|
289
|
+
raise OpenRouterAPIError("Invalid response format: missing 'message' attribute in first choice")
|
290
|
+
|
291
|
+
# Check if the message has a parsed attribute or content
|
292
|
+
if not hasattr(response.choices[0].message, 'parsed') and not hasattr(response.choices[0].message, 'content'):
|
293
|
+
logger.error(f"Message missing both 'parsed' and 'content' attributes. Available attributes: {dir(response.choices[0].message)}")
|
294
|
+
raise OpenRouterAPIError("Invalid response format: message must have either 'parsed' or 'content' attribute")
|
295
|
+
|
296
|
+
# If there's no parsed attribute but there is content, try to parse it
|
297
|
+
if not hasattr(response.choices[0].message, 'parsed') and hasattr(response.choices[0].message, 'content'):
|
298
|
+
try:
|
299
|
+
import json
|
300
|
+
content = response.choices[0].message.content
|
301
|
+
if isinstance(content, str):
|
302
|
+
parsed = json.loads(content)
|
303
|
+
response.choices[0].message.parsed = parsed
|
304
|
+
else:
|
305
|
+
response.choices[0].message.parsed = content
|
306
|
+
except Exception as e:
|
307
|
+
logger.error(f"Failed to parse message content: {str(e)}")
|
308
|
+
raise OpenRouterAPIError(f"Failed to parse message content: {str(e)}")
|
309
|
+
|
277
310
|
logger.info(f"Received response from OpenRouter: {len(response.choices)} choices")
|
278
311
|
|
279
312
|
return response
|
@@ -1,4 +1,4 @@
|
|
1
|
-
mbxai/__init__.py,sha256=
|
1
|
+
mbxai/__init__.py,sha256=AaCA5jcdBWBQk5Gn5DMpTbdoXCoEziSkEnuW3aX8Hwc,47
|
2
2
|
mbxai/core.py,sha256=WMvmU9TTa7M_m-qWsUew4xH8Ul6xseCZ2iBCXJTW-Bs,196
|
3
3
|
mbxai/examples/openrouter_example.py,sha256=-grXHKMmFLoh-yUIEMc31n8Gg1S7uSazBWCIOWxgbyQ,1317
|
4
4
|
mbxai/examples/parse_example.py,sha256=eCKMJoOl6qwo8sDP6Trc6ncgjPlgTqi5tPE2kB5_P0k,3821
|
@@ -9,16 +9,16 @@ mbxai/examples/mcp/mcp_server_example.py,sha256=BK2kaKncyeZ9KHvrBBPGZwNATVNgTFkQ
|
|
9
9
|
mbxai/mcp/__init__.py,sha256=_ek9iYdYqW5saKetj4qDci11jxesQDiHPJRpHMKkxgU,175
|
10
10
|
mbxai/mcp/client.py,sha256=BuKmKTupzbiLMFghseeYE6Ih6xCesJ8mIMHaXHiNwlo,5206
|
11
11
|
mbxai/mcp/example.py,sha256=oaol7AvvZnX86JWNz64KvPjab5gg1VjVN3G8eFSzuaE,2350
|
12
|
-
mbxai/mcp/server.py,sha256=
|
12
|
+
mbxai/mcp/server.py,sha256=3Js5Ic9U4mlsrwz-CmyWwCCZt1LtDoUaSZVo8JxPQBw,3462
|
13
13
|
mbxai/openrouter/__init__.py,sha256=Ito9Qp_B6q-RLGAQcYyTJVWwR2YAZvNqE-HIYXxhtD8,298
|
14
|
-
mbxai/openrouter/client.py,sha256=
|
14
|
+
mbxai/openrouter/client.py,sha256=Rq9x7LcN2p5BFT78-5P2ozdH3nP2Y2KmCdUm4a2b8uk,14398
|
15
15
|
mbxai/openrouter/config.py,sha256=Ia93s-auim9Sq71eunVDbn9ET5xX2zusXpV4JBdHAzs,3251
|
16
16
|
mbxai/openrouter/models.py,sha256=b3IjjtZAjeGOf2rLsdnCD1HacjTnS8jmv_ZXorc-KJQ,2604
|
17
17
|
mbxai/tools/__init__.py,sha256=ogxrHvgJ7OR62Lmd5x9Eh5d2C0jqWyQis7Zy3yKpZ78,218
|
18
18
|
mbxai/tools/client.py,sha256=h_1fxVDBq57f_OXNsj-TBp6-r367sv6Z5nk1qLFcLO8,14951
|
19
19
|
mbxai/tools/example.py,sha256=1HgKK39zzUuwFbnp3f0ThyWVfA_8P28PZcTwaUw5K78,2232
|
20
20
|
mbxai/tools/types.py,sha256=yUMvRlWiFy2KnEQLCerh4XioVKMKa2wHtb3fCDybg34,5878
|
21
|
-
mbxai-1.0.
|
22
|
-
mbxai-1.0.
|
23
|
-
mbxai-1.0.
|
24
|
-
mbxai-1.0.
|
21
|
+
mbxai-1.0.3.dist-info/METADATA,sha256=kWUh7NfXLaz9XBglOnvt1_P2bVU6mHfGct5uboOgImw,4147
|
22
|
+
mbxai-1.0.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
23
|
+
mbxai-1.0.3.dist-info/licenses/LICENSE,sha256=hEyhc4FxwYo3NQ40yNgZ7STqwVk-1_XcTXOnAPbGJAw,1069
|
24
|
+
mbxai-1.0.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|