utilitas 1998.2.28 → 1998.2.30

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.
package/lib/alan.mjs CHANGED
@@ -60,8 +60,8 @@ const [tool, provider, messages, text] = [
60
60
  messages => ({ messages }), text => ({ text }),
61
61
  ];
62
62
 
63
- const [name, user, system, assistant, MODEL, JSON_OBJECT]
64
- = ['Alan', 'user', 'system', 'assistant', 'model', 'json_object'];
63
+ const [name, user, system, assistant, MODEL, JSON_OBJECT, TOOL]
64
+ = ['Alan', 'user', 'system', 'assistant', 'model', 'json_object', 'tool'];
65
65
  const [CODE_INTERPRETER, RETRIEVAL, FUNCTION]
66
66
  = ['code_interpreter', 'retrieval', 'function'].map(tool);
67
67
  const [NOT_INIT, INVALID_FILE]
@@ -722,7 +722,7 @@ const handleToolsCall = async (msg, options) => {
722
722
  case CHATGPT: default:
723
723
  input = parseJson(fn?.function?.arguments);
724
724
  packMsg = (t, e) => ({
725
- role: 'tool', tool_call_id: fn.id, [e ? 'error' : 'content']: t
725
+ role: TOOL, tool_call_id: fn.id, [e ? 'error' : 'content']: t
726
726
  });
727
727
  break;
728
728
  }
@@ -735,7 +735,7 @@ const handleToolsCall = async (msg, options) => {
735
735
  continue;
736
736
  }
737
737
  try {
738
- content.push(packMsg(await func(input)));
738
+ content.push(packMsg((await func(input)) ?? 'OK'));
739
739
  } catch (err) {
740
740
  content.push(packMsg(`Function call failed: ${err.message}`, true));
741
741
  }
package/lib/manifest.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const manifest = {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "1998.2.28",
4
+ "version": "1998.2.30",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "1998.2.28",
4
+ "version": "1998.2.30",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",