@xsai/generate-text 0.4.2 → 0.4.3

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.
Files changed (2) hide show
  1. package/dist/index.js +6 -4
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -23,14 +23,16 @@ const rawGenerateText = async (options) => chat({
23
23
  toolCallsLength: msgToolCalls.length
24
24
  });
25
25
  messages.push(message);
26
- if (finishReason !== "stop" && stepType !== "done") {
27
- for (const toolCall of msgToolCalls) {
28
- const { completionToolCall, completionToolResult, message: message2 } = await executeTool({
26
+ if (finishReason !== "stop" && stepType !== "done" && msgToolCalls.length > 0) {
27
+ const results = await Promise.all(
28
+ msgToolCalls.map(async (toolCall) => executeTool({
29
29
  abortSignal: options.abortSignal,
30
30
  messages,
31
31
  toolCall,
32
32
  tools: options.tools
33
- });
33
+ }))
34
+ );
35
+ for (const { completionToolCall, completionToolResult, message: message2 } of results) {
34
36
  toolCalls.push(completionToolCall);
35
37
  toolResults.push(completionToolResult);
36
38
  messages.push(message2);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xsai/generate-text",
3
3
  "type": "module",
4
- "version": "0.4.2",
4
+ "version": "0.4.3",
5
5
  "description": "extra-small AI SDK.",
6
6
  "author": "Moeru AI",
7
7
  "license": "MIT",
@@ -29,12 +29,12 @@
29
29
  "dist"
30
30
  ],
31
31
  "dependencies": {
32
- "@xsai/shared": "~0.4.2",
33
- "@xsai/shared-chat": "~0.4.2"
32
+ "@xsai/shared": "~0.4.3",
33
+ "@xsai/shared-chat": "~0.4.3"
34
34
  },
35
35
  "devDependencies": {
36
36
  "valibot": "^1.0.0",
37
- "@xsai/tool": "~0.4.2"
37
+ "@xsai/tool": "~0.4.3"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "pkgroll",