mbxai 0.6.24__py3-none-any.whl → 0.6.25__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/tools/types.py +7 -17
- {mbxai-0.6.24.dist-info → mbxai-0.6.25.dist-info}/METADATA +1 -1
- {mbxai-0.6.24.dist-info → mbxai-0.6.25.dist-info}/RECORD +7 -7
- {mbxai-0.6.24.dist-info → mbxai-0.6.25.dist-info}/WHEEL +0 -0
- {mbxai-0.6.24.dist-info → mbxai-0.6.25.dist-info}/licenses/LICENSE +0 -0
mbxai/__init__.py
CHANGED
mbxai/mcp/server.py
CHANGED
mbxai/tools/types.py
CHANGED
@@ -20,9 +20,6 @@ def convert_to_strict_schema(schema: dict[str, Any], strict: bool = True, keep_i
|
|
20
20
|
Returns:
|
21
21
|
A schema in strict format
|
22
22
|
"""
|
23
|
-
logger.info(f"Converting schema to strict format. Input schema: {json.dumps(schema, indent=2)}")
|
24
|
-
logger.info(f"Strict mode: {strict}, Keep input wrapper: {keep_input_wrapper}")
|
25
|
-
|
26
23
|
if not schema:
|
27
24
|
return {"type": "object", "properties": {}, "required": []}
|
28
25
|
|
@@ -40,13 +37,11 @@ def convert_to_strict_schema(schema: dict[str, Any], strict: bool = True, keep_i
|
|
40
37
|
# Handle input wrapper
|
41
38
|
if "properties" in schema and "input" in schema["properties"]:
|
42
39
|
input_schema = schema["properties"]["input"]
|
43
|
-
logger.info(f"Found input wrapper. Input schema: {json.dumps(input_schema, indent=2)}")
|
44
40
|
|
45
41
|
# If input has a $ref, resolve it
|
46
42
|
if "$ref" in input_schema:
|
47
43
|
ref = input_schema["$ref"].split("/")[-1]
|
48
44
|
input_schema = schema.get("$defs", {}).get(ref, {})
|
49
|
-
logger.info(f"Resolved $ref to: {json.dumps(input_schema, indent=2)}")
|
50
45
|
|
51
46
|
if keep_input_wrapper:
|
52
47
|
# Create the input property schema
|
@@ -70,12 +65,10 @@ def convert_to_strict_schema(schema: dict[str, Any], strict: bool = True, keep_i
|
|
70
65
|
}
|
71
66
|
|
72
67
|
input_prop_schema["properties"][prop_name] = new_prop
|
73
|
-
logger.info(f"Added property {prop_name}: {json.dumps(new_prop, indent=2)}")
|
74
68
|
|
75
69
|
# Copy over required fields for input schema
|
76
70
|
if "required" in input_schema:
|
77
71
|
input_prop_schema["required"] = input_schema["required"]
|
78
|
-
logger.info(f"Added required fields for input schema: {input_prop_schema['required']}")
|
79
72
|
|
80
73
|
# Add the input property to the main schema
|
81
74
|
strict_schema["properties"]["input"] = input_prop_schema
|
@@ -83,7 +76,6 @@ def convert_to_strict_schema(schema: dict[str, Any], strict: bool = True, keep_i
|
|
83
76
|
# Copy over required fields for main schema
|
84
77
|
if "required" in schema:
|
85
78
|
strict_schema["required"] = schema["required"]
|
86
|
-
logger.info(f"Added required fields for main schema: {strict_schema['required']}")
|
87
79
|
else:
|
88
80
|
# If not keeping input wrapper, use input schema directly
|
89
81
|
if "properties" in input_schema:
|
@@ -95,12 +87,10 @@ def convert_to_strict_schema(schema: dict[str, Any], strict: bool = True, keep_i
|
|
95
87
|
}
|
96
88
|
|
97
89
|
strict_schema["properties"][prop_name] = new_prop
|
98
|
-
logger.info(f"Added property {prop_name}: {json.dumps(new_prop, indent=2)}")
|
99
90
|
|
100
91
|
# Copy over required fields
|
101
92
|
if "required" in input_schema:
|
102
93
|
strict_schema["required"] = input_schema["required"]
|
103
|
-
logger.info(f"Added required fields: {strict_schema['required']}")
|
104
94
|
else:
|
105
95
|
# If no input wrapper, use the schema as is
|
106
96
|
if "properties" in schema:
|
@@ -112,14 +102,11 @@ def convert_to_strict_schema(schema: dict[str, Any], strict: bool = True, keep_i
|
|
112
102
|
}
|
113
103
|
|
114
104
|
strict_schema["properties"][prop_name] = new_prop
|
115
|
-
logger.info(f"Added property {prop_name}: {json.dumps(new_prop, indent=2)}")
|
116
105
|
|
117
106
|
# Copy over required fields
|
118
107
|
if "required" in schema:
|
119
108
|
strict_schema["required"] = schema["required"]
|
120
|
-
logger.info(f"Added required fields: {strict_schema['required']}")
|
121
109
|
|
122
|
-
logger.info(f"Final strict schema: {json.dumps(strict_schema, indent=2)}")
|
123
110
|
return strict_schema
|
124
111
|
|
125
112
|
class ToolCall(BaseModel):
|
@@ -139,13 +126,16 @@ class Tool(BaseModel):
|
|
139
126
|
"""Convert the tool to an OpenAI function definition."""
|
140
127
|
# Ensure schema is in strict format
|
141
128
|
strict_schema = convert_to_strict_schema(self.schema)
|
142
|
-
logger.info(f"Converted schema for {self.name}: {json.dumps(strict_schema, indent=2)}")
|
143
129
|
|
144
|
-
|
130
|
+
function_def = {
|
145
131
|
"type": "function",
|
146
132
|
"function": {
|
147
133
|
"name": self.name,
|
148
134
|
"description": self.description,
|
149
|
-
"parameters": strict_schema
|
135
|
+
"parameters": strict_schema,
|
136
|
+
"strict": True
|
150
137
|
}
|
151
|
-
}
|
138
|
+
}
|
139
|
+
|
140
|
+
logger.info(f"Created function definition for {self.name}: {json.dumps(function_def, indent=2)}")
|
141
|
+
return function_def
|
@@ -1,9 +1,9 @@
|
|
1
|
-
mbxai/__init__.py,sha256=
|
1
|
+
mbxai/__init__.py,sha256=6vHreY64-wqGS1CLp7IVi74XGMm2QdXvqPyQ7TLyKSc,48
|
2
2
|
mbxai/core.py,sha256=WMvmU9TTa7M_m-qWsUew4xH8Ul6xseCZ2iBCXJTW-Bs,196
|
3
3
|
mbxai/mcp/__init__.py,sha256=_ek9iYdYqW5saKetj4qDci11jxesQDiHPJRpHMKkxgU,175
|
4
4
|
mbxai/mcp/client.py,sha256=2aX5zMe0vSxZSdvfxoHDA5p_aQSqV1bhX_-QopG2uX8,8477
|
5
5
|
mbxai/mcp/example.py,sha256=oaol7AvvZnX86JWNz64KvPjab5gg1VjVN3G8eFSzuaE,2350
|
6
|
-
mbxai/mcp/server.py,sha256=
|
6
|
+
mbxai/mcp/server.py,sha256=F2K5NY2_8V7wFUfZyLzQhJN0zTAwY7I2FOY2S_9nqE8,3463
|
7
7
|
mbxai/openrouter/__init__.py,sha256=Ito9Qp_B6q-RLGAQcYyTJVWwR2YAZvNqE-HIYXxhtD8,298
|
8
8
|
mbxai/openrouter/client.py,sha256=nusxYObyLAMGQd6J9u2uLfkRXyE5kZmdIGdlU-76HPo,13529
|
9
9
|
mbxai/openrouter/config.py,sha256=Ia93s-auim9Sq71eunVDbn9ET5xX2zusXpV4JBdHAzs,3251
|
@@ -11,8 +11,8 @@ mbxai/openrouter/models.py,sha256=b3IjjtZAjeGOf2rLsdnCD1HacjTnS8jmv_ZXorc-KJQ,26
|
|
11
11
|
mbxai/tools/__init__.py,sha256=ogxrHvgJ7OR62Lmd5x9Eh5d2C0jqWyQis7Zy3yKpZ78,218
|
12
12
|
mbxai/tools/client.py,sha256=qOf8MiQ8_flPUNiMioOyjeEaV8rN1EBWb98T8qTC3D4,17582
|
13
13
|
mbxai/tools/example.py,sha256=1HgKK39zzUuwFbnp3f0ThyWVfA_8P28PZcTwaUw5K78,2232
|
14
|
-
mbxai/tools/types.py,sha256=
|
15
|
-
mbxai-0.6.
|
16
|
-
mbxai-0.6.
|
17
|
-
mbxai-0.6.
|
18
|
-
mbxai-0.6.
|
14
|
+
mbxai/tools/types.py,sha256=PEJ2AxBqywbJCp689QZhG87rDHWNuKGnmB5CCQsAMlw,5251
|
15
|
+
mbxai-0.6.25.dist-info/METADATA,sha256=FijREYzBpQf7TLYqxUGThfKmrZvBl2Mjv2DsrRbZxxM,4148
|
16
|
+
mbxai-0.6.25.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
17
|
+
mbxai-0.6.25.dist-info/licenses/LICENSE,sha256=hEyhc4FxwYo3NQ40yNgZ7STqwVk-1_XcTXOnAPbGJAw,1069
|
18
|
+
mbxai-0.6.25.dist-info/RECORD,,
|
File without changes
|
File without changes
|