@xsai/text 1.0.0-beta.4 → 1.0.0-beta.5
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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as StepEndDoneEvent, T as ToolCallPart, a as ToolResultPart, U as Usage, b as TextEvent, M as Message, L as LanguageModelOptions, c as LanguageModel, d as ToolExecuteOptions } from './language-model-
|
|
2
|
-
export { A as AssistantMessage, e as AssistantMessageContent, C as CombinedStandardSchema,
|
|
1
|
+
import { S as StepEndDoneEvent, T as ToolCallPart, a as ToolResultPart, U as Usage, b as TextEvent, M as Message, L as LanguageModelOptions, c as LanguageModel, d as ToolExecuteOptions } from './language-model-Dne8NRLD.js';
|
|
2
|
+
export { A as AssistantMessage, e as AssistantMessageContent, f as AudioPart, C as CombinedStandardSchema, g as Content, h as ContentEndEvent, i as ContentMap, j as ContentStartEvent, k as ContentType, D as DeveloperMessage, l as DeveloperMessageContent, E as ExecutableTool, F as FilePart, m as FinishReason, I as ImagePart, n as InferSchemaInput, o as InferSchemaOutput, J as JSONSchema7, p as JSONSchema7Definition, q as LanguageModelProviderOptions, r as MessageMap, s as MessageProviderMetadata, t as MessageType, P as PartProviderMetadata, u as ProviderPart, R as RawEvent, v as ReasoningDeltaEvent, w as ReasoningPart, x as ReasoningPartContent, y as RefusalDeltaEvent, z as RefusalPart, B as ResolvedSchema, G as StepEndEvent, H as StepEndFailEvent, K as StepStartEvent, N as StepStatus, O as SystemMessage, Q as SystemMessageContent, V as TextDeltaEvent, W as TextEventMap, X as TextEventType, Y as TextPart, Z as Tool, _ as ToolCallDeltaEvent, $ as ToolChoice, a0 as ToolOptions, a1 as ToolResultPartContent, a2 as UnresolvedSchema, a3 as UserMessage, a4 as UserMessageContent, a5 as resolveSchema, a6 as tool } from './language-model-Dne8NRLD.js';
|
|
3
3
|
import { Promisable } from '@xsai/shared';
|
|
4
4
|
export { HttpError, XSAIError, XSAIErrorCause, XSAIErrorCauseMap, XSAIErrorCode, XSAIErrorOptions } from '@xsai/shared';
|
|
5
5
|
|
package/dist/index.js
CHANGED
|
@@ -89,7 +89,7 @@ const catchToolError = async (call, signal, callback) => {
|
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
91
|
const executeTool = async (call, { postToolCall, preToolCall, signal, tools }) => {
|
|
92
|
-
const executeOptions = { signal };
|
|
92
|
+
const executeOptions = { callId: call.callId, signal };
|
|
93
93
|
const preToolCallResult = await catchToolError(call, signal, async () => preToolCall?.(call, executeOptions));
|
|
94
94
|
if (preToolCallResult != null) {
|
|
95
95
|
assertSameCallId(call.callId, preToolCallResult.callId);
|
|
@@ -121,7 +121,7 @@ const executeTool = async (call, { postToolCall, preToolCall, signal, tools }) =
|
|
|
121
121
|
shouldPostToolCall = true;
|
|
122
122
|
return {
|
|
123
123
|
callId: call.callId,
|
|
124
|
-
output: await executableTool.execute(validatedInput,
|
|
124
|
+
output: await executableTool.execute(validatedInput, executeOptions),
|
|
125
125
|
type: "tool-result"
|
|
126
126
|
};
|
|
127
127
|
});
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StepStatus, FinishReason, AssistantMessage, AssistantMessageContent, PartProviderMetadata, Usage, TextEvent, LanguageModelOptions } from './index.js';
|
|
2
|
-
export { C as CombinedStandardSchema,
|
|
2
|
+
export { C as CombinedStandardSchema, n as InferSchemaInput, o as InferSchemaOutput, J as JSONSchema7, p as JSONSchema7Definition, B as ResolvedSchema, a2 as UnresolvedSchema, a5 as resolveSchema } from './language-model-Dne8NRLD.js';
|
|
3
3
|
import { XSAIError, EventSourceMessage, SendRequestOptions, HttpOptions } from '@xsai/shared';
|
|
4
4
|
|
|
5
5
|
interface EventBuilder {
|
|
@@ -5,8 +5,14 @@ interface MessageProviderMetadata {
|
|
|
5
5
|
interface PartProviderMetadata {
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
interface AudioPart {
|
|
9
|
+
data: string;
|
|
10
|
+
format: 'mp3' | 'wav';
|
|
11
|
+
type: 'audio';
|
|
12
|
+
}
|
|
8
13
|
type Content = ContentMap[ContentType];
|
|
9
14
|
interface ContentMap {
|
|
15
|
+
'audio': AudioPart;
|
|
10
16
|
'file': FilePart;
|
|
11
17
|
'image': ImagePart;
|
|
12
18
|
'provider': ProviderPart;
|
|
@@ -96,7 +102,7 @@ interface UserMessage {
|
|
|
96
102
|
content: readonly UserMessageContent[] | string;
|
|
97
103
|
role: 'user';
|
|
98
104
|
}
|
|
99
|
-
type UserMessageContent = FilePart | ImagePart | TextPart | ToolResultPart;
|
|
105
|
+
type UserMessageContent = AudioPart | FilePart | ImagePart | TextPart | ToolResultPart;
|
|
100
106
|
|
|
101
107
|
interface Usage {
|
|
102
108
|
cacheCreationInputTokens?: number;
|
|
@@ -487,6 +493,7 @@ interface Tool {
|
|
|
487
493
|
outputSchema?: ResolvedSchema;
|
|
488
494
|
}
|
|
489
495
|
interface ToolExecuteOptions {
|
|
496
|
+
callId: string;
|
|
490
497
|
signal?: AbortSignal;
|
|
491
498
|
}
|
|
492
499
|
interface ToolOptions<TInput extends UnresolvedSchema, TOutput extends undefined | UnresolvedSchema = undefined> {
|
|
@@ -525,5 +532,5 @@ type ToolChoice = 'auto' | 'none' | 'required' | {
|
|
|
525
532
|
name: string;
|
|
526
533
|
};
|
|
527
534
|
|
|
528
|
-
export { resolveSchema as
|
|
529
|
-
export type {
|
|
535
|
+
export { resolveSchema as a5, tool as a6 };
|
|
536
|
+
export type { ToolChoice as $, AssistantMessage as A, ResolvedSchema as B, CombinedStandardSchema as C, DeveloperMessage as D, ExecutableTool as E, FilePart as F, StepEndEvent as G, StepEndFailEvent as H, ImagePart as I, JSONSchema7 as J, StepStartEvent as K, LanguageModelOptions as L, Message as M, StepStatus as N, SystemMessage as O, PartProviderMetadata as P, SystemMessageContent as Q, RawEvent as R, StepEndDoneEvent as S, ToolCallPart as T, Usage as U, TextDeltaEvent as V, TextEventMap as W, TextEventType as X, TextPart as Y, Tool as Z, ToolCallDeltaEvent as _, ToolResultPart as a, ToolOptions as a0, ToolResultPartContent as a1, UnresolvedSchema as a2, UserMessage as a3, UserMessageContent as a4, TextEvent as b, LanguageModel as c, ToolExecuteOptions as d, AssistantMessageContent as e, AudioPart as f, Content as g, ContentEndEvent as h, ContentMap as i, ContentStartEvent as j, ContentType as k, DeveloperMessageContent as l, FinishReason as m, InferSchemaInput as n, InferSchemaOutput as o, JSONSchema7Definition as p, LanguageModelProviderOptions as q, MessageMap as r, MessageProviderMetadata as s, MessageType as t, ProviderPart as u, ReasoningDeltaEvent as v, ReasoningPart as w, ReasoningPartContent as x, RefusalDeltaEvent as y, RefusalPart as z };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsai/text",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.5",
|
|
5
5
|
"description": "extra-small AI SDK: provider-agnostic text generation, streaming and tool calling.",
|
|
6
6
|
"author": "Moeru AI",
|
|
7
7
|
"license": "MIT",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"node": ">=26"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@xsai/shared": "1.0.0-beta.
|
|
44
|
+
"@xsai/shared": "1.0.0-beta.5"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@standard-schema/spec": "1.1.0",
|