mbxai 0.5.3__py3-none-any.whl → 0.5.5__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 CHANGED
@@ -2,4 +2,4 @@
2
2
  MBX AI package.
3
3
  """
4
4
 
5
- __version__ = "0.5.3"
5
+ __version__ = "0.5.5"
mbxai/mcp/client.py CHANGED
@@ -24,9 +24,12 @@ class MCPTool(Tool):
24
24
  def to_openai_function(self) -> dict[str, Any]:
25
25
  """Convert the tool to an OpenAI function definition."""
26
26
  return {
27
- "name": self.name,
28
- "description": self.description,
29
- "parameters": self._convert_to_openai_schema(self.input_schema)
27
+ "type": "function",
28
+ "function": {
29
+ "name": self.name,
30
+ "description": self.description,
31
+ "parameters": self._convert_to_openai_schema(self.input_schema)
32
+ }
30
33
  }
31
34
 
32
35
  def _convert_to_openai_schema(self, mcp_schema: dict[str, Any]) -> dict[str, Any]:
mbxai/mcp/server.py CHANGED
@@ -31,7 +31,7 @@ class MCPServer:
31
31
  self.app = FastAPI(
32
32
  title=self.name,
33
33
  description=self.description,
34
- version="0.5.3",
34
+ version="0.5.5",
35
35
  )
36
36
 
37
37
  # Initialize MCP server
mbxai/tools/client.py CHANGED
@@ -3,10 +3,13 @@ ToolClient implementation for MBX AI.
3
3
  """
4
4
 
5
5
  from typing import Any, Callable, TypeVar, cast
6
+ import logging
6
7
  from pydantic import BaseModel
7
8
  from ..openrouter import OpenRouterClient
8
9
  from .types import Tool, ToolCall
9
10
 
11
+ logger = logging.getLogger(__name__)
12
+
10
13
  T = TypeVar("T", bound=BaseModel)
11
14
 
12
15
  class ToolClient:
@@ -43,6 +46,7 @@ class ToolClient:
43
46
  schema=schema,
44
47
  )
45
48
  self._tools[name] = tool
49
+ logger.debug(f"Registered tool: {name}")
46
50
 
47
51
  def chat(
48
52
  self,
@@ -65,12 +69,12 @@ class ToolClient:
65
69
  """
66
70
  tools = [tool.to_openai_function() for tool in self._tools.values()]
67
71
 
72
+ if tools:
73
+ logger.debug(f"Using tools: {tools}")
74
+ kwargs["tools"] = tools
75
+ kwargs["tool_choice"] = "auto"
76
+
68
77
  while True:
69
- # Add tools to the request if we have any
70
- if tools:
71
- kwargs["tools"] = tools
72
- kwargs["tool_choice"] = "auto"
73
-
74
78
  # Get the model's response
75
79
  response = self._client.chat_completion(
76
80
  messages=messages,
@@ -129,12 +133,12 @@ class ToolClient:
129
133
  """
130
134
  tools = [tool.to_openai_function() for tool in self._tools.values()]
131
135
 
136
+ if tools:
137
+ logger.debug(f"Using tools: {tools}")
138
+ kwargs["tools"] = tools
139
+ kwargs["tool_choice"] = "auto"
140
+
132
141
  while True:
133
- # Add tools to the request if we have any
134
- if tools:
135
- kwargs["tools"] = tools
136
- kwargs["tool_choice"] = "auto"
137
-
138
142
  # Get the model's response
139
143
  response = self._client.chat_completion_parse(
140
144
  messages=messages,
mbxai/tools/types.py CHANGED
@@ -2,15 +2,9 @@
2
2
  Type definitions for the tools package.
3
3
  """
4
4
 
5
- from typing import Any, Callable, TypedDict, NotRequired
5
+ from typing import Any, Callable
6
6
  from pydantic import BaseModel
7
7
 
8
- class ToolFunction(TypedDict):
9
- """OpenAI function definition for a tool."""
10
- name: str
11
- description: str
12
- parameters: dict[str, Any]
13
-
14
8
  class ToolCall(BaseModel):
15
9
  """A tool call from the model."""
16
10
  id: str
@@ -24,10 +18,13 @@ class Tool(BaseModel):
24
18
  function: Callable[..., Any]
25
19
  schema: dict[str, Any]
26
20
 
27
- def to_openai_function(self) -> ToolFunction:
21
+ def to_openai_function(self) -> dict[str, Any]:
28
22
  """Convert the tool to an OpenAI function definition."""
29
23
  return {
30
- "name": self.name,
31
- "description": self.description,
32
- "parameters": self.schema,
24
+ "type": "function",
25
+ "function": {
26
+ "name": self.name,
27
+ "description": self.description,
28
+ "parameters": self.schema
29
+ }
33
30
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mbxai
3
- Version: 0.5.3
3
+ Version: 0.5.5
4
4
  Summary: MBX AI SDK
5
5
  Project-URL: Homepage, https://www.mibexx.de
6
6
  Project-URL: Documentation, https://www.mibexx.de
@@ -1,18 +1,18 @@
1
- mbxai/__init__.py,sha256=ujlMlgvQNlXgDy1c5g83G6iKTxzV6_pMRXKUjX-pNRs,47
1
+ mbxai/__init__.py,sha256=9R6hwrMZv42Y8AiBgP0KTxJvokh8rDG_HHmedMSnNDE,47
2
2
  mbxai/core.py,sha256=WMvmU9TTa7M_m-qWsUew4xH8Ul6xseCZ2iBCXJTW-Bs,196
3
3
  mbxai/mcp/__init__.py,sha256=_ek9iYdYqW5saKetj4qDci11jxesQDiHPJRpHMKkxgU,175
4
- mbxai/mcp/client.py,sha256=CYm_5HiB3hZUYfahzM_senilPgH2oZwSevf2up1JTF0,5506
4
+ mbxai/mcp/client.py,sha256=QxVeQRBQryeEGXDU8X_9qQBfT-ubDd9L9KSc5-P354U,5590
5
5
  mbxai/mcp/example.py,sha256=oaol7AvvZnX86JWNz64KvPjab5gg1VjVN3G8eFSzuaE,2350
6
- mbxai/mcp/server.py,sha256=Kn4zY_aBiQMfcUAOnWehhITB_5usSYZi8zSNU4QhLMM,3462
6
+ mbxai/mcp/server.py,sha256=EJwK4GRsUG2xLfZocFsHpp31qu4GGWvwH7s50AG4qH8,3462
7
7
  mbxai/openrouter/__init__.py,sha256=Ito9Qp_B6q-RLGAQcYyTJVWwR2YAZvNqE-HIYXxhtD8,298
8
8
  mbxai/openrouter/client.py,sha256=XLRMRNRJH96Jl6_af0KkzRDdLJnixh8I3RvEEcFuXyg,10840
9
9
  mbxai/openrouter/config.py,sha256=MTX_YHsFrM7JYqovJSkEF6JzVyIdajeI5Dja2CALH58,2874
10
10
  mbxai/openrouter/models.py,sha256=b3IjjtZAjeGOf2rLsdnCD1HacjTnS8jmv_ZXorc-KJQ,2604
11
11
  mbxai/tools/__init__.py,sha256=QUFaXhDm-UKcuAtT1rbKzhBkvyRBVokcQIOf9cxIuwc,160
12
- mbxai/tools/client.py,sha256=PDkDTvpwAs8-F8CcF6wjjq2Z-VhYpjA9RXTK64Rwa3Y,5418
12
+ mbxai/tools/client.py,sha256=t4qjiKtWeiV5s6Dj_eh7VLm1YmmKN2zVMDAf6DRmADw,5504
13
13
  mbxai/tools/example.py,sha256=1HgKK39zzUuwFbnp3f0ThyWVfA_8P28PZcTwaUw5K78,2232
14
- mbxai/tools/types.py,sha256=ZHnmiDXpH6wZhiZ-Tj9PiPMJaW1aiDAq5It2gpiwNp0,831
15
- mbxai-0.5.3.dist-info/METADATA,sha256=HNDLbRGqN3rT-m0kA7DGI5fWQUH8uGiNh70xzriM6Bs,4107
16
- mbxai-0.5.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
17
- mbxai-0.5.3.dist-info/licenses/LICENSE,sha256=hEyhc4FxwYo3NQ40yNgZ7STqwVk-1_XcTXOnAPbGJAw,1069
18
- mbxai-0.5.3.dist-info/RECORD,,
14
+ mbxai/tools/types.py,sha256=fo5t9UbsHGynhA88vD_ecgDqL8iLvt2E1h1ym43Rrgk,745
15
+ mbxai-0.5.5.dist-info/METADATA,sha256=EwoHlZOsXYdG8fI7uEXu-sA2uHqeKP_k3vaGUo-sp8M,4107
16
+ mbxai-0.5.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
17
+ mbxai-0.5.5.dist-info/licenses/LICENSE,sha256=hEyhc4FxwYo3NQ40yNgZ7STqwVk-1_XcTXOnAPbGJAw,1069
18
+ mbxai-0.5.5.dist-info/RECORD,,
File without changes