@xsai/shared-chat 0.4.0-beta.1 → 0.4.0-beta.11
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 +17 -8
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CommonRequestOptions } from '@xsai/shared';
|
|
1
|
+
import { WithUnknown, CommonRequestOptions } from '@xsai/shared';
|
|
2
2
|
|
|
3
3
|
type FinishReason = 'content_filter' | 'error' | 'length' | 'other' | 'stop' | 'tool-calls' | (string & {});
|
|
4
4
|
|
|
@@ -36,13 +36,22 @@ interface TextContentPart {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
interface ToolCall {
|
|
39
|
-
function:
|
|
40
|
-
arguments: string;
|
|
41
|
-
name: string;
|
|
42
|
-
};
|
|
39
|
+
function: ToolCallFunction | ToolCallFunctionWithoutArguments | ToolCallFunctionWithoutName;
|
|
43
40
|
id: string;
|
|
44
41
|
type: 'function';
|
|
45
42
|
}
|
|
43
|
+
interface ToolCallFunction {
|
|
44
|
+
arguments: string;
|
|
45
|
+
name: string;
|
|
46
|
+
}
|
|
47
|
+
interface ToolCallFunctionWithoutArguments {
|
|
48
|
+
arguments?: never;
|
|
49
|
+
name: string;
|
|
50
|
+
}
|
|
51
|
+
interface ToolCallFunctionWithoutName {
|
|
52
|
+
arguments: string;
|
|
53
|
+
name?: never;
|
|
54
|
+
}
|
|
46
55
|
|
|
47
56
|
interface AssistantMessage {
|
|
48
57
|
content?: (RefusalContentPart | TextContentPart)[] | string;
|
|
@@ -139,7 +148,6 @@ interface ToolChoiceTool {
|
|
|
139
148
|
|
|
140
149
|
/** @see {@link https://platform.openai.com/docs/api-reference/chat/create} */
|
|
141
150
|
interface ChatOptions extends CommonRequestOptions {
|
|
142
|
-
[key: string]: unknown;
|
|
143
151
|
/**
|
|
144
152
|
* number between -2.0 and 2.0.
|
|
145
153
|
* @default 0
|
|
@@ -164,7 +172,7 @@ interface ChatOptions extends CommonRequestOptions {
|
|
|
164
172
|
/** @default 1 */
|
|
165
173
|
topP?: number;
|
|
166
174
|
}
|
|
167
|
-
declare const chat: <T extends ChatOptions
|
|
175
|
+
declare const chat: <T extends WithUnknown<ChatOptions>>(options: T) => Promise<Response>;
|
|
168
176
|
|
|
169
177
|
interface DetermineStepTypeOptions {
|
|
170
178
|
finishReason: FinishReason;
|
|
@@ -188,4 +196,5 @@ interface ExecuteToolResult {
|
|
|
188
196
|
}
|
|
189
197
|
declare const executeTool: ({ abortSignal, messages, toolCall, tools }: ExecuteToolOptions) => Promise<ExecuteToolResult>;
|
|
190
198
|
|
|
191
|
-
export {
|
|
199
|
+
export { chat, determineStepType, executeTool };
|
|
200
|
+
export type { AssistantMessage, AudioContentPart, ChatOptions, CommonContentPart, CompletionStep, CompletionStepType, CompletionToolCall, CompletionToolResult, DetermineStepTypeOptions, DeveloperMessage, ExecuteToolOptions, ExecuteToolResult, FileContentPart, FinishReason, ImageContentPart, Message, RefusalContentPart, SystemMessage, TextContentPart, Tool, ToolCall, ToolChoice, ToolExecuteOptions, ToolExecuteResult, ToolMessage, Usage, UserMessage };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsai/shared-chat",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.0-beta.
|
|
4
|
+
"version": "0.4.0-beta.11",
|
|
5
5
|
"description": "extra-small AI SDK.",
|
|
6
6
|
"author": "Moeru AI",
|
|
7
7
|
"license": "MIT",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@xsai/shared": "~0.4.0-beta.
|
|
32
|
+
"@xsai/shared": "~0.4.0-beta.11"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "pkgroll"
|