@xsai/generate-text 0.4.0-beta.9 → 0.4.1

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/dist/index.d.ts CHANGED
@@ -14,11 +14,7 @@ interface GenerateTextResponse {
14
14
  choices: {
15
15
  finish_reason: FinishReason;
16
16
  index: number;
17
- message: Omit<AssistantMessage, 'content' | 'name'> & {
18
- content?: string;
19
- /** @remarks OpenAI does not support this, but LiteLLM / DeepSeek does. */
20
- reasoning_content?: string;
21
- };
17
+ message: Omit<AssistantMessage, 'name'>;
22
18
  refusal?: string;
23
19
  }[];
24
20
  created: number;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { trampoline, responseJSON, clean } from '@xsai/shared';
1
+ import { trampoline, responseJSON } from '@xsai/shared';
2
2
  import { chat, determineStepType, executeTool } from '@xsai/shared-chat';
3
3
 
4
4
  const rawGenerateText = async (options) => chat({
@@ -22,10 +22,7 @@ const rawGenerateText = async (options) => chat({
22
22
  stepsLength: steps.length,
23
23
  toolCallsLength: msgToolCalls.length
24
24
  });
25
- messages.push(clean({
26
- ...message,
27
- reasoning_content: void 0
28
- }));
25
+ messages.push(message);
29
26
  if (finishReason !== "stop" && stepType !== "done") {
30
27
  for (const toolCall of msgToolCalls) {
31
28
  const { completionToolCall, completionToolResult, message: message2 } = await executeTool({
@@ -42,7 +39,7 @@ const rawGenerateText = async (options) => chat({
42
39
  const step = {
43
40
  finishReason,
44
41
  stepType,
45
- text: message.content,
42
+ text: Array.isArray(message.content) ? message.content.filter((m) => m.type === "text").map((m) => m.text).join("\n") : message.content,
46
43
  toolCalls,
47
44
  toolResults,
48
45
  usage
@@ -54,7 +51,7 @@ const rawGenerateText = async (options) => chat({
54
51
  return {
55
52
  finishReason: step.finishReason,
56
53
  messages,
57
- reasoningText: message.reasoning_content,
54
+ reasoningText: message.reasoning ?? message.reasoning_content,
58
55
  steps,
59
56
  text: step.text,
60
57
  toolCalls: step.toolCalls,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xsai/generate-text",
3
3
  "type": "module",
4
- "version": "0.4.0-beta.9",
4
+ "version": "0.4.1",
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.0-beta.9",
33
- "@xsai/shared-chat": "~0.4.0-beta.9"
32
+ "@xsai/shared": "~0.4.1",
33
+ "@xsai/shared-chat": "~0.4.1"
34
34
  },
35
35
  "devDependencies": {
36
36
  "valibot": "^1.0.0",
37
- "@xsai/tool": "~0.4.0-beta.9"
37
+ "@xsai/tool": "~0.4.1"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "pkgroll",