@mlx-node/lm 0.0.6 → 0.0.7

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.
@@ -40,7 +40,8 @@
40
40
  * @param description - Description of what the function does
41
41
  * @param properties - Object defining the function parameters (will be JSON stringified)
42
42
  * @param required - Array of required parameter names
43
- * @returns A properly formatted ToolDefinition ready for use with model.chat()
43
+ * @returns A properly formatted ToolDefinition ready to pass via `ChatConfig.tools`
44
+ * on `ChatSession.send()` / `sendToolResult()`.
44
45
  *
45
46
  * @example
46
47
  * ```typescript
@@ -49,12 +50,12 @@
49
50
  * 'Get weather information for a location',
50
51
  * {
51
52
  * location: { type: 'string', description: 'City name' },
52
- * units: { type: 'string', enum: ['celsius', 'fahrenheit'] }
53
+ * units: { type: 'string', enum: ['celsius', 'fahrenheit'] },
53
54
  * },
54
- * ['location']
55
+ * ['location'],
55
56
  * );
56
57
  *
57
- * const result = await model.chat(messages, { tools: [weatherTool] });
58
+ * const result = await session.send(userPrompt, { config: { tools: [weatherTool] } });
58
59
  * ```
59
60
  */
60
61
  export function createToolDefinition(name, description, properties, required) {
@@ -73,29 +74,3 @@ export function createToolDefinition(name, description, properties, required) {
73
74
  },
74
75
  };
75
76
  }
76
- /**
77
- * Format a tool response for inclusion in a message
78
- *
79
- * Creates a properly formatted tool response string that can be used
80
- * in tool messages when continuing a conversation after a tool call.
81
- *
82
- * @param content - The response content (will be JSON stringified if object)
83
- * @returns Formatted tool response string wrapped in `<tool_response>` tags
84
- *
85
- * @example
86
- * ```typescript
87
- * // After executing a tool call from model.chat()
88
- * const toolResult = await executeMyTool(call.arguments);
89
- * const responseMessage = {
90
- * role: 'user',
91
- * content: formatToolResponse(toolResult)
92
- * };
93
- * const finalResult = await model.chat([...messages, responseMessage]);
94
- * ```
95
- */
96
- export function formatToolResponse(content) {
97
- const contentStr = typeof content === 'string' ? content : JSON.stringify(content);
98
- // Qwen3/3.5 expects <tool_response> XML wrapping for tool results.
99
- // Other model families may require a different format.
100
- return `<tool_response>\n${contentStr}\n</tool_response>`;
101
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlx-node/lm",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "homepage": "https://github.com/mlx-node/mlx-node",
5
5
  "bugs": {
6
6
  "url": "https://github.com/mlx-node/mlx-node/issues"
@@ -28,9 +28,9 @@
28
28
  "test": "vite test run"
29
29
  },
30
30
  "dependencies": {
31
- "@mlx-node/core": "0.0.6"
31
+ "@mlx-node/core": "0.0.7"
32
32
  },
33
33
  "devDependencies": {
34
- "@types/node": "@types/node@25.5.0"
34
+ "@types/node": "^25.6.0"
35
35
  }
36
36
  }