@xsai/shared-chat 0.1.0-beta.4 → 0.1.0-beta.6

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
@@ -83,6 +83,18 @@ interface ChatOptions extends CommonRequestOptions {
83
83
 
84
84
  type FinishReason = 'content_filter' | 'error' | 'length' | 'other' | 'stop' | 'tool-calls' | (string & {});
85
85
 
86
+ interface CompletionToolCall {
87
+ args: string;
88
+ toolCallId: string;
89
+ toolCallType: 'function';
90
+ toolName: string;
91
+ }
92
+ interface CompletionToolResult {
93
+ args: Record<string, unknown>;
94
+ result: string;
95
+ toolCallId: string;
96
+ toolName: string;
97
+ }
86
98
  interface Tool {
87
99
  execute: (input: unknown, options: ToolExecuteOptions) => Promise<string> | string;
88
100
  function: {
@@ -107,4 +119,4 @@ interface Usage {
107
119
 
108
120
  declare const chat: <T extends ChatOptions>(options: T) => Promise<Response>;
109
121
 
110
- export { type AssistantMessage, type AssistantMessagePart, type AssistantMessageResponse, type AudioBase64, type AudioPart, type ChatOptions, type CommonMessage, type CommonPart, type FinishReason, type ImagePart, type ImageURLorBase64, type Message, type Part, type RefusalPart, type SystemMessage, type SystemMessagePart, type TextPart, type Tool, type ToolCall, type ToolChoice, type ToolExecuteOptions, type ToolMessage, type ToolMessagePart, type Usage, type UserMessage, type UserMessagePart, chat };
122
+ export { type AssistantMessage, type AssistantMessagePart, type AssistantMessageResponse, type AudioBase64, type AudioPart, type ChatOptions, type CommonMessage, type CommonPart, type CompletionToolCall, type CompletionToolResult, type FinishReason, type ImagePart, type ImageURLorBase64, type Message, type Part, type RefusalPart, type SystemMessage, type SystemMessagePart, type TextPart, type Tool, type ToolCall, type ToolChoice, type ToolExecuteOptions, type ToolMessage, type ToolMessagePart, type Usage, type UserMessage, type UserMessagePart, chat };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { requestURL, requestBody, requestHeaders, responseCatch } from '@xsai/shared';
2
-
3
- const chat = async (options) => (options.fetch ?? globalThis.fetch)(requestURL("chat/completions", options.baseURL), {
1
+ // src/utils/chat.ts
2
+ import { requestBody, requestHeaders, requestURL, responseCatch } from "@xsai/shared";
3
+ var chat = async (options) => (options.fetch ?? globalThis.fetch)(requestURL("chat/completions", options.baseURL), {
4
4
  body: requestBody({
5
5
  ...options,
6
6
  tools: options.tools?.map((tool) => ({
@@ -15,5 +15,6 @@ const chat = async (options) => (options.fetch ?? globalThis.fetch)(requestURL("
15
15
  method: "POST",
16
16
  signal: options.abortSignal
17
17
  }).then(responseCatch);
18
-
19
- export { chat };
18
+ export {
19
+ chat
20
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xsai/shared-chat",
3
3
  "type": "module",
4
- "version": "0.1.0-beta.4",
4
+ "version": "0.1.0-beta.6",
5
5
  "description": "extra-small AI SDK for Browser, Node.js, Deno, Bun or Edge Runtime.",
6
6
  "author": "Moeru AI",
7
7
  "license": "MIT",
@@ -22,10 +22,9 @@
22
22
  ".": {
23
23
  "types": "./dist/index.d.ts",
24
24
  "default": "./dist/index.js"
25
- }
25
+ },
26
+ "./package.json": "./package.json"
26
27
  },
27
- "main": "./dist/index.js",
28
- "types": "./dist/index.d.ts",
29
28
  "files": [
30
29
  "dist"
31
30
  ],
@@ -33,7 +32,8 @@
33
32
  "@xsai/shared": ""
34
33
  },
35
34
  "scripts": {
36
- "build": "pkgroll",
37
- "build:watch": "pkgroll --watch"
38
- }
35
+ "build": "tsup"
36
+ },
37
+ "main": "./dist/index.js",
38
+ "types": "./dist/index.d.ts"
39
39
  }