@arcships/aimux 0.1.0 → 0.1.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/aimux.darwin-arm64.node +0 -0
- package/aimux.linux-x64-gnu.node +0 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +78 -0
- package/dist/types/AiMuxError.d.ts +34 -0
- package/dist/types/AiMuxError.js +3 -0
- package/dist/types/AspectRatio.d.ts +11 -0
- package/dist/types/AspectRatio.js +3 -0
- package/dist/types/AudioChunk.d.ts +8 -0
- package/dist/types/AudioChunk.js +3 -0
- package/dist/types/AudioData.d.ts +11 -0
- package/dist/types/AudioData.js +3 -0
- package/dist/types/AudioInput.d.ts +8 -0
- package/dist/types/AudioInput.js +3 -0
- package/dist/types/CallOptions.d.ts +80 -0
- package/dist/types/CallOptions.js +2 -0
- package/dist/types/ContentPart.d.ts +77 -0
- package/dist/types/ContentPart.js +2 -0
- package/dist/types/EmbeddingCallOptions.d.ts +24 -0
- package/dist/types/EmbeddingCallOptions.js +2 -0
- package/dist/types/EmbeddingResponse.d.ts +16 -0
- package/dist/types/EmbeddingResponse.js +2 -0
- package/dist/types/EmbeddingResult.d.ts +33 -0
- package/dist/types/EmbeddingResult.js +2 -0
- package/dist/types/EmbeddingUsage.d.ts +9 -0
- package/dist/types/EmbeddingUsage.js +3 -0
- package/dist/types/FileBytes.d.ts +12 -0
- package/dist/types/FileBytes.js +3 -0
- package/dist/types/FileData.d.ts +25 -0
- package/dist/types/FileData.js +2 -0
- package/dist/types/FinishReason.d.ts +14 -0
- package/dist/types/FinishReason.js +2 -0
- package/dist/types/FinishReasonUnified.d.ts +4 -0
- package/dist/types/FinishReasonUnified.js +3 -0
- package/dist/types/FunctionTool.d.ts +35 -0
- package/dist/types/FunctionTool.js +2 -0
- package/dist/types/GenerateContent.d.ts +33 -0
- package/dist/types/GenerateContent.js +2 -0
- package/dist/types/GenerateResult.d.ts +45 -0
- package/dist/types/GenerateResult.js +2 -0
- package/dist/types/GenerateTextOptions.d.ts +38 -0
- package/dist/types/GenerateTextOptions.js +2 -0
- package/dist/types/GenerateTextResult.d.ts +34 -0
- package/dist/types/GenerateTextResult.js +2 -0
- package/dist/types/ImageCallOptions.d.ts +54 -0
- package/dist/types/ImageCallOptions.js +2 -0
- package/dist/types/ImageFile.d.ts +25 -0
- package/dist/types/ImageFile.js +2 -0
- package/dist/types/ImageFileData.d.ts +8 -0
- package/dist/types/ImageFileData.js +3 -0
- package/dist/types/ImageOutputs.d.ts +14 -0
- package/dist/types/ImageOutputs.js +3 -0
- package/dist/types/ImageResponse.d.ts +19 -0
- package/dist/types/ImageResponse.js +3 -0
- package/dist/types/ImageResult.d.ts +34 -0
- package/dist/types/ImageResult.js +2 -0
- package/dist/types/ImageUsage.d.ts +19 -0
- package/dist/types/ImageUsage.js +3 -0
- package/dist/types/InputAudioFormat.d.ts +13 -0
- package/dist/types/InputAudioFormat.js +3 -0
- package/dist/types/LanguageModelPromptMessage.d.ts +20 -0
- package/dist/types/LanguageModelPromptMessage.js +2 -0
- package/dist/types/MessageContent.d.ts +5 -0
- package/dist/types/MessageContent.js +2 -0
- package/dist/types/ModelId.d.ts +7 -0
- package/dist/types/ModelId.js +3 -0
- package/dist/types/ModelMessage.d.ts +9 -0
- package/dist/types/ModelMessage.js +2 -0
- package/dist/types/ModelPrompt.d.ts +7 -0
- package/dist/types/ModelPrompt.js +2 -0
- package/dist/types/ProviderTool.d.ts +24 -0
- package/dist/types/ProviderTool.js +2 -0
- package/dist/types/ReasoningEffort.d.ts +7 -0
- package/dist/types/ReasoningEffort.js +3 -0
- package/dist/types/RequestInfo.d.ts +12 -0
- package/dist/types/RequestInfo.js +2 -0
- package/dist/types/RerankingCallOptions.d.ts +33 -0
- package/dist/types/RerankingCallOptions.js +2 -0
- package/dist/types/RerankingDocuments.d.ts +15 -0
- package/dist/types/RerankingDocuments.js +2 -0
- package/dist/types/RerankingRank.d.ts +13 -0
- package/dist/types/RerankingRank.js +3 -0
- package/dist/types/RerankingResponse.d.ts +28 -0
- package/dist/types/RerankingResponse.js +2 -0
- package/dist/types/RerankingResult.d.ts +31 -0
- package/dist/types/RerankingResult.js +2 -0
- package/dist/types/ResponseFormat.d.ts +11 -0
- package/dist/types/ResponseFormat.js +2 -0
- package/dist/types/ResponseInfo.d.ts +30 -0
- package/dist/types/ResponseInfo.js +2 -0
- package/dist/types/ResponseMetadata.d.ts +8 -0
- package/dist/types/ResponseMetadata.js +3 -0
- package/dist/types/Role.d.ts +4 -0
- package/dist/types/Role.js +3 -0
- package/dist/types/SearchCallOptions.d.ts +46 -0
- package/dist/types/SearchCallOptions.js +2 -0
- package/dist/types/SearchResponse.d.ts +16 -0
- package/dist/types/SearchResponse.js +2 -0
- package/dist/types/SearchResult.d.ts +32 -0
- package/dist/types/SearchResult.js +2 -0
- package/dist/types/SearchResultItem.d.ts +33 -0
- package/dist/types/SearchResultItem.js +2 -0
- package/dist/types/Size.d.ts +11 -0
- package/dist/types/Size.js +3 -0
- package/dist/types/SpeechCallOptions.d.ts +47 -0
- package/dist/types/SpeechCallOptions.js +2 -0
- package/dist/types/SpeechRequest.d.ts +10 -0
- package/dist/types/SpeechRequest.js +2 -0
- package/dist/types/SpeechResponse.d.ts +24 -0
- package/dist/types/SpeechResponse.js +2 -0
- package/dist/types/SpeechResult.d.ts +34 -0
- package/dist/types/SpeechResult.js +2 -0
- package/dist/types/StreamPart.d.ts +104 -0
- package/dist/types/StreamPart.js +2 -0
- package/dist/types/TokenUsage.d.ts +29 -0
- package/dist/types/TokenUsage.js +3 -0
- package/dist/types/Tool.d.ts +12 -0
- package/dist/types/Tool.js +2 -0
- package/dist/types/ToolCall.d.ts +18 -0
- package/dist/types/ToolCall.js +2 -0
- package/dist/types/ToolChoice.d.ts +12 -0
- package/dist/types/ToolChoice.js +3 -0
- package/dist/types/ToolResult.d.ts +14 -0
- package/dist/types/ToolResult.js +2 -0
- package/dist/types/UploadFileCallOptions.d.ts +27 -0
- package/dist/types/UploadFileCallOptions.js +2 -0
- package/dist/types/UploadFileData.d.ts +17 -0
- package/dist/types/UploadFileData.js +2 -0
- package/dist/types/UploadFileResult.d.ts +35 -0
- package/dist/types/UploadFileResult.js +2 -0
- package/dist/types/Usage.d.ts +8 -0
- package/dist/types/Usage.js +2 -0
- package/dist/types/VideoCallOptions.d.ts +69 -0
- package/dist/types/VideoCallOptions.js +2 -0
- package/dist/types/VideoData.d.ts +22 -0
- package/dist/types/VideoData.js +3 -0
- package/dist/types/VideoFile.d.ts +29 -0
- package/dist/types/VideoFile.js +2 -0
- package/dist/types/VideoFileData.d.ts +8 -0
- package/dist/types/VideoFileData.js +3 -0
- package/dist/types/VideoFrameImage.d.ts +17 -0
- package/dist/types/VideoFrameImage.js +2 -0
- package/dist/types/VideoFrameType.d.ts +6 -0
- package/dist/types/VideoFrameType.js +3 -0
- package/dist/types/VideoResponse.d.ts +19 -0
- package/dist/types/VideoResponse.js +3 -0
- package/dist/types/VideoResult.d.ts +29 -0
- package/dist/types/VideoResult.js +2 -0
- package/dist/types/Warning.d.ts +23 -0
- package/dist/types/Warning.js +3 -0
- package/dist/types/serde_json/JsonValue.d.ts +3 -0
- package/dist/types/serde_json/JsonValue.js +3 -0
- package/dist/types.d.ts +73 -0
- package/dist/types.js +5 -0
- package/package.json +8 -6
- package/src/index.ts +0 -134
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Warning } from "./Warning";
|
|
2
|
+
import type { JsonValue } from "./serde_json/JsonValue";
|
|
3
|
+
/**
|
|
4
|
+
* Result of [`Files::upload_file`].
|
|
5
|
+
*
|
|
6
|
+
* Aligned with V4 `FilesV4UploadFileResult`.
|
|
7
|
+
*/
|
|
8
|
+
export type UploadFileResult = {
|
|
9
|
+
/**
|
|
10
|
+
* A provider reference mapping provider names to provider-specific file
|
|
11
|
+
* identifiers.
|
|
12
|
+
*/
|
|
13
|
+
provider_reference: {
|
|
14
|
+
[key in string]: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The IANA media type of the uploaded file, if available from the
|
|
18
|
+
* provider.
|
|
19
|
+
*/
|
|
20
|
+
media_type: string | null;
|
|
21
|
+
/**
|
|
22
|
+
* The filename of the uploaded file, if available from the provider.
|
|
23
|
+
*/
|
|
24
|
+
filename: string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Additional provider-specific metadata, keyed by provider name.
|
|
27
|
+
*/
|
|
28
|
+
provider_metadata: {
|
|
29
|
+
[key in string]: JsonValue;
|
|
30
|
+
} | null;
|
|
31
|
+
/**
|
|
32
|
+
* Warnings from the provider.
|
|
33
|
+
*/
|
|
34
|
+
warnings: Array<Warning>;
|
|
35
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { AspectRatio } from "./AspectRatio";
|
|
2
|
+
import type { Size } from "./Size";
|
|
3
|
+
import type { VideoFile } from "./VideoFile";
|
|
4
|
+
import type { VideoFrameImage } from "./VideoFrameImage";
|
|
5
|
+
import type { JsonValue } from "./serde_json/JsonValue";
|
|
6
|
+
/**
|
|
7
|
+
* Options passed to [`VideoModel::do_generate`].
|
|
8
|
+
*
|
|
9
|
+
* Aligned with V4 `VideoModelV4CallOptions`.
|
|
10
|
+
*/
|
|
11
|
+
export type VideoCallOptions = {
|
|
12
|
+
/**
|
|
13
|
+
* Text prompt for the video generation. `None` when not required.
|
|
14
|
+
*/
|
|
15
|
+
prompt: string | null;
|
|
16
|
+
/**
|
|
17
|
+
* Number of videos to generate. Default `1`; most models only support
|
|
18
|
+
* `n = 1` due to computational cost.
|
|
19
|
+
*/
|
|
20
|
+
n: number;
|
|
21
|
+
/**
|
|
22
|
+
* Aspect ratio, in `{width}:{height}` format (e.g. `"16:9"`).
|
|
23
|
+
*/
|
|
24
|
+
aspect_ratio: AspectRatio | null;
|
|
25
|
+
/**
|
|
26
|
+
* Resolution, in `{width}x{height}` format (e.g. `"1280x720"`).
|
|
27
|
+
*/
|
|
28
|
+
resolution: Size | null;
|
|
29
|
+
/**
|
|
30
|
+
* Duration of the video in seconds. Typically 3–10 seconds.
|
|
31
|
+
*/
|
|
32
|
+
duration: number | null;
|
|
33
|
+
/**
|
|
34
|
+
* Frames per second. Common values: 24, 30, 60.
|
|
35
|
+
*/
|
|
36
|
+
fps: number | null;
|
|
37
|
+
/**
|
|
38
|
+
* Seed for deterministic generation. `None` uses a random seed.
|
|
39
|
+
*/
|
|
40
|
+
seed: bigint | null;
|
|
41
|
+
/**
|
|
42
|
+
* Input image for image-to-video generation (the starting frame).
|
|
43
|
+
*/
|
|
44
|
+
image: VideoFile | null;
|
|
45
|
+
/**
|
|
46
|
+
* Role-tagged image inputs for first-last-frame generation.
|
|
47
|
+
*/
|
|
48
|
+
frame_images: Array<VideoFrameImage> | null;
|
|
49
|
+
/**
|
|
50
|
+
* Reference inputs for reference-to-video generation (images or videos).
|
|
51
|
+
*/
|
|
52
|
+
input_references: Array<VideoFile> | null;
|
|
53
|
+
/**
|
|
54
|
+
* Whether the model should generate audio alongside the video.
|
|
55
|
+
*/
|
|
56
|
+
generate_audio: boolean | null;
|
|
57
|
+
/**
|
|
58
|
+
* Additional provider-specific options, keyed by provider name.
|
|
59
|
+
*/
|
|
60
|
+
provider_options: {
|
|
61
|
+
[key in string]: JsonValue;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Additional HTTP headers to send with the request.
|
|
65
|
+
*/
|
|
66
|
+
headers: {
|
|
67
|
+
[key in string]: string;
|
|
68
|
+
} | null;
|
|
69
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated video data: a URL, base64-encoded string, or binary data.
|
|
3
|
+
*
|
|
4
|
+
* Aligned with V4 `VideoModelV4VideoData`. Most providers return URLs due to
|
|
5
|
+
* large file sizes.
|
|
6
|
+
*/
|
|
7
|
+
export type VideoData = {
|
|
8
|
+
"Url": {
|
|
9
|
+
url: string;
|
|
10
|
+
media_type: string;
|
|
11
|
+
};
|
|
12
|
+
} | {
|
|
13
|
+
"Base64": {
|
|
14
|
+
data: string;
|
|
15
|
+
media_type: string;
|
|
16
|
+
};
|
|
17
|
+
} | {
|
|
18
|
+
"Binary": {
|
|
19
|
+
data: Array<number>;
|
|
20
|
+
media_type: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { VideoFileData } from "./VideoFileData";
|
|
2
|
+
/**
|
|
3
|
+
* A video or image file used for video editing or image-to-video generation.
|
|
4
|
+
*
|
|
5
|
+
* Aligned with V4 `VideoModelV4File`.
|
|
6
|
+
*/
|
|
7
|
+
export type VideoFile = {
|
|
8
|
+
"File": {
|
|
9
|
+
/**
|
|
10
|
+
* IANA media type, e.g. `"video/mp4"` or `"image/png"`.
|
|
11
|
+
*/
|
|
12
|
+
media_type: string;
|
|
13
|
+
/**
|
|
14
|
+
* File data as a base64 string or binary bytes.
|
|
15
|
+
*/
|
|
16
|
+
data: VideoFileData;
|
|
17
|
+
};
|
|
18
|
+
} | {
|
|
19
|
+
"Url": {
|
|
20
|
+
/**
|
|
21
|
+
* The URL of the video or image file.
|
|
22
|
+
*/
|
|
23
|
+
url: string;
|
|
24
|
+
/**
|
|
25
|
+
* The media type of the referenced file, when known.
|
|
26
|
+
*/
|
|
27
|
+
media_type: string | null;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { VideoFile } from "./VideoFile";
|
|
2
|
+
import type { VideoFrameType } from "./VideoFrameType";
|
|
3
|
+
/**
|
|
4
|
+
* A role-tagged image input for image-to-video and first-last-frame generation.
|
|
5
|
+
*
|
|
6
|
+
* Aligned with V4 `VideoModelV4FrameImage`.
|
|
7
|
+
*/
|
|
8
|
+
export type VideoFrameImage = {
|
|
9
|
+
/**
|
|
10
|
+
* The image file used for this frame.
|
|
11
|
+
*/
|
|
12
|
+
image: VideoFile;
|
|
13
|
+
/**
|
|
14
|
+
* Which frame this image represents.
|
|
15
|
+
*/
|
|
16
|
+
frame_type: VideoFrameType;
|
|
17
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response information for a video generation call.
|
|
3
|
+
*/
|
|
4
|
+
export type VideoResponse = {
|
|
5
|
+
/**
|
|
6
|
+
* Timestamp for the start of the generated response (ISO 8601 string).
|
|
7
|
+
*/
|
|
8
|
+
timestamp: string | null;
|
|
9
|
+
/**
|
|
10
|
+
* The ID of the model that was used to generate the response.
|
|
11
|
+
*/
|
|
12
|
+
model_id: string | null;
|
|
13
|
+
/**
|
|
14
|
+
* Response headers.
|
|
15
|
+
*/
|
|
16
|
+
headers: {
|
|
17
|
+
[key in string]: string;
|
|
18
|
+
} | null;
|
|
19
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { VideoData } from "./VideoData";
|
|
2
|
+
import type { VideoResponse } from "./VideoResponse";
|
|
3
|
+
import type { Warning } from "./Warning";
|
|
4
|
+
import type { JsonValue } from "./serde_json/JsonValue";
|
|
5
|
+
/**
|
|
6
|
+
* The result of [`VideoModel::do_generate`].
|
|
7
|
+
*
|
|
8
|
+
* Aligned with V4 `VideoModelV4Result`.
|
|
9
|
+
*/
|
|
10
|
+
export type VideoResult = {
|
|
11
|
+
/**
|
|
12
|
+
* Generated videos as URLs, base64 strings, or binary data.
|
|
13
|
+
*/
|
|
14
|
+
videos: Array<VideoData>;
|
|
15
|
+
/**
|
|
16
|
+
* Warnings for the call, e.g. unsupported features.
|
|
17
|
+
*/
|
|
18
|
+
warnings: Array<Warning>;
|
|
19
|
+
/**
|
|
20
|
+
* Additional provider-specific metadata, keyed by provider name.
|
|
21
|
+
*/
|
|
22
|
+
provider_metadata: {
|
|
23
|
+
[key in string]: JsonValue;
|
|
24
|
+
} | null;
|
|
25
|
+
/**
|
|
26
|
+
* Response information for telemetry and debugging.
|
|
27
|
+
*/
|
|
28
|
+
response: VideoResponse;
|
|
29
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A warning issued by the provider (e.g. unsupported parameter).
|
|
3
|
+
*/
|
|
4
|
+
export type Warning = {
|
|
5
|
+
"Unsupported": {
|
|
6
|
+
feature: string;
|
|
7
|
+
details: string | null;
|
|
8
|
+
};
|
|
9
|
+
} | {
|
|
10
|
+
"Compatibility": {
|
|
11
|
+
feature: string;
|
|
12
|
+
details: string | null;
|
|
13
|
+
};
|
|
14
|
+
} | {
|
|
15
|
+
"Deprecated": {
|
|
16
|
+
setting: string;
|
|
17
|
+
message: string;
|
|
18
|
+
};
|
|
19
|
+
} | {
|
|
20
|
+
"Other": {
|
|
21
|
+
message: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export type * from './types/AiMuxError';
|
|
2
|
+
export type * from './types/AspectRatio';
|
|
3
|
+
export type * from './types/AudioChunk';
|
|
4
|
+
export type * from './types/AudioData';
|
|
5
|
+
export type * from './types/AudioInput';
|
|
6
|
+
export type * from './types/CallOptions';
|
|
7
|
+
export type * from './types/ContentPart';
|
|
8
|
+
export type * from './types/EmbeddingCallOptions';
|
|
9
|
+
export type * from './types/EmbeddingResponse';
|
|
10
|
+
export type * from './types/EmbeddingResult';
|
|
11
|
+
export type * from './types/EmbeddingUsage';
|
|
12
|
+
export type * from './types/FileBytes';
|
|
13
|
+
export type * from './types/FileData';
|
|
14
|
+
export type * from './types/FinishReason';
|
|
15
|
+
export type * from './types/FinishReasonUnified';
|
|
16
|
+
export type * from './types/FunctionTool';
|
|
17
|
+
export type * from './types/GenerateContent';
|
|
18
|
+
export type * from './types/GenerateResult';
|
|
19
|
+
export type * from './types/GenerateTextOptions';
|
|
20
|
+
export type * from './types/GenerateTextResult';
|
|
21
|
+
export type * from './types/ImageCallOptions';
|
|
22
|
+
export type * from './types/ImageFile';
|
|
23
|
+
export type * from './types/ImageFileData';
|
|
24
|
+
export type * from './types/ImageOutputs';
|
|
25
|
+
export type * from './types/ImageResponse';
|
|
26
|
+
export type * from './types/ImageResult';
|
|
27
|
+
export type * from './types/ImageUsage';
|
|
28
|
+
export type * from './types/InputAudioFormat';
|
|
29
|
+
export type * from './types/LanguageModelPromptMessage';
|
|
30
|
+
export type * from './types/MessageContent';
|
|
31
|
+
export type * from './types/ModelId';
|
|
32
|
+
export type * from './types/ModelMessage';
|
|
33
|
+
export type * from './types/ModelPrompt';
|
|
34
|
+
export type * from './types/ProviderTool';
|
|
35
|
+
export type * from './types/ReasoningEffort';
|
|
36
|
+
export type * from './types/RerankingCallOptions';
|
|
37
|
+
export type * from './types/RerankingDocuments';
|
|
38
|
+
export type * from './types/RerankingRank';
|
|
39
|
+
export type * from './types/RerankingResponse';
|
|
40
|
+
export type * from './types/RerankingResult';
|
|
41
|
+
export type * from './types/ResponseFormat';
|
|
42
|
+
export type * from './types/ResponseInfo';
|
|
43
|
+
export type * from './types/ResponseMetadata';
|
|
44
|
+
export type * from './types/Role';
|
|
45
|
+
export type * from './types/SearchCallOptions';
|
|
46
|
+
export type * from './types/SearchResponse';
|
|
47
|
+
export type * from './types/SearchResult';
|
|
48
|
+
export type * from './types/SearchResultItem';
|
|
49
|
+
export type * from './types/Size';
|
|
50
|
+
export type * from './types/SpeechCallOptions';
|
|
51
|
+
export type * from './types/SpeechRequest';
|
|
52
|
+
export type * from './types/SpeechResponse';
|
|
53
|
+
export type * from './types/SpeechResult';
|
|
54
|
+
export type * from './types/StreamPart';
|
|
55
|
+
export type * from './types/TokenUsage';
|
|
56
|
+
export type * from './types/Tool';
|
|
57
|
+
export type * from './types/ToolCall';
|
|
58
|
+
export type * from './types/ToolChoice';
|
|
59
|
+
export type * from './types/ToolResult';
|
|
60
|
+
export type * from './types/UploadFileCallOptions';
|
|
61
|
+
export type * from './types/UploadFileData';
|
|
62
|
+
export type * from './types/UploadFileResult';
|
|
63
|
+
export type * from './types/Usage';
|
|
64
|
+
export type * from './types/VideoCallOptions';
|
|
65
|
+
export type * from './types/VideoData';
|
|
66
|
+
export type * from './types/VideoFile';
|
|
67
|
+
export type * from './types/VideoFileData';
|
|
68
|
+
export type * from './types/VideoFrameImage';
|
|
69
|
+
export type * from './types/VideoFrameType';
|
|
70
|
+
export type * from './types/VideoResponse';
|
|
71
|
+
export type * from './types/VideoResult';
|
|
72
|
+
export type * from './types/Warning';
|
|
73
|
+
export type * from './types/RequestInfo';
|
package/dist/types.js
ADDED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcships/aimux",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Unified LLM service layer — one API for 172+ AI providers (Rust core, Node.js binding)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"index.js",
|
|
9
9
|
"index.d.ts",
|
|
10
|
-
"
|
|
10
|
+
"dist/",
|
|
11
11
|
"*.node"
|
|
12
12
|
],
|
|
13
13
|
"os": [
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
},
|
|
25
25
|
"exports": {
|
|
26
26
|
".": {
|
|
27
|
-
"types": "./
|
|
28
|
-
"default": "./
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
29
|
},
|
|
30
30
|
"./raw": {
|
|
31
31
|
"types": "./index.d.ts",
|
|
@@ -42,12 +42,14 @@
|
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "napi build --platform --release",
|
|
44
44
|
"build:debug": "napi build --platform",
|
|
45
|
+
"build:typed": "tsc -p tsconfig.json",
|
|
45
46
|
"test": "ava",
|
|
46
|
-
"prepublishOnly": "napi prepublish -t npm"
|
|
47
|
+
"prepublishOnly": "npm run build:typed && napi prepublish -t npm"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
50
|
"@napi-rs/cli": "^3.8.0",
|
|
50
|
-
"ava": "^6.0.0"
|
|
51
|
+
"ava": "^6.0.0",
|
|
52
|
+
"typescript": "^5.5.0"
|
|
51
53
|
},
|
|
52
54
|
"engines": {
|
|
53
55
|
"node": ">= 18"
|
package/src/index.ts
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
// aimux — Typed wrapper layer for the Node.js (napi-rs) binding.
|
|
2
|
-
//
|
|
3
|
-
// The native binding speaks JSON strings:
|
|
4
|
-
// generateText(prompt: string, options?: string): Promise<string>
|
|
5
|
-
// streamText(prompt: string, options?: string): Promise<AsyncGenerator<string>>
|
|
6
|
-
// Users would otherwise have to JSON.stringify every input and JSON.parse every
|
|
7
|
-
// output, with no static types. This wrapper erases that JSON boundary: inputs
|
|
8
|
-
// and outputs are typed objects, using the ts-rs generated types from
|
|
9
|
-
// `aimux-core/bindings` (the single source of truth — NOT a local copy).
|
|
10
|
-
//
|
|
11
|
-
// The raw napi API (`index.js` / `index.d.ts`, auto-generated) is untouched.
|
|
12
|
-
// This is purely an extra TypeScript layer on top.
|
|
13
|
-
|
|
14
|
-
import type { Model } from '../index.js'
|
|
15
|
-
|
|
16
|
-
// Canonical ts-rs generated types. These are type-only imports, so they are
|
|
17
|
-
// fully erased at runtime (the wrapper only touches the raw `../index.js`).
|
|
18
|
-
import type { GenerateTextOptions } from '../../aimux-core/bindings/GenerateTextOptions.ts'
|
|
19
|
-
import type { GenerateTextResult } from '../../aimux-core/bindings/GenerateTextResult.ts'
|
|
20
|
-
import type { StreamPart } from '../../aimux-core/bindings/StreamPart.ts'
|
|
21
|
-
import type { ModelMessage } from '../../aimux-core/bindings/ModelMessage.ts'
|
|
22
|
-
import type { Tool } from '../../aimux-core/bindings/Tool.ts'
|
|
23
|
-
import type { ToolChoice } from '../../aimux-core/bindings/ToolChoice.ts'
|
|
24
|
-
import type { ToolCall } from '../../aimux-core/bindings/ToolCall.ts'
|
|
25
|
-
import type { ToolResult } from '../../aimux-core/bindings/ToolResult.ts'
|
|
26
|
-
import type { Usage } from '../../aimux-core/bindings/Usage.ts'
|
|
27
|
-
import type { FinishReason } from '../../aimux-core/bindings/FinishReason.ts'
|
|
28
|
-
import type { Warning } from '../../aimux-core/bindings/Warning.ts'
|
|
29
|
-
import type { Role } from '../../aimux-core/bindings/Role.ts'
|
|
30
|
-
import type { MessageContent } from '../../aimux-core/bindings/MessageContent.ts'
|
|
31
|
-
import type { ContentPart } from '../../aimux-core/bindings/ContentPart.ts'
|
|
32
|
-
import type { ResponseFormat } from '../../aimux-core/bindings/ResponseFormat.ts'
|
|
33
|
-
import type { ReasoningEffort } from '../../aimux-core/bindings/ReasoningEffort.ts'
|
|
34
|
-
import type { AiMuxError } from '../../aimux-core/bindings/AiMuxError.ts'
|
|
35
|
-
import type { GenerateResult } from '../../aimux-core/bindings/GenerateResult.ts'
|
|
36
|
-
import type { FunctionTool } from '../../aimux-core/bindings/FunctionTool.ts'
|
|
37
|
-
|
|
38
|
-
// Re-export the raw napi constructors/factories so consumers can do everything
|
|
39
|
-
// from a single import: `import { openai, generateText } from 'aimux'`.
|
|
40
|
-
export { Model, StreamTextGenerator, openai, anthropic, deepseek } from '../index.js'
|
|
41
|
-
|
|
42
|
-
// Public type surface — typed objects, no `any`.
|
|
43
|
-
export type {
|
|
44
|
-
GenerateTextOptions,
|
|
45
|
-
GenerateTextResult,
|
|
46
|
-
StreamPart,
|
|
47
|
-
ModelMessage,
|
|
48
|
-
Tool,
|
|
49
|
-
ToolChoice,
|
|
50
|
-
ToolCall,
|
|
51
|
-
ToolResult,
|
|
52
|
-
Usage,
|
|
53
|
-
FinishReason,
|
|
54
|
-
Warning,
|
|
55
|
-
Role,
|
|
56
|
-
MessageContent,
|
|
57
|
-
ContentPart,
|
|
58
|
-
ResponseFormat,
|
|
59
|
-
ReasoningEffort,
|
|
60
|
-
AiMuxError,
|
|
61
|
-
GenerateResult,
|
|
62
|
-
FunctionTool,
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* A raw napi `Model` instance returned by `openai()` / `anthropic()` / …
|
|
67
|
-
*
|
|
68
|
-
* The wrapper accepts one of these and hides the JSON-string boundary behind
|
|
69
|
-
* typed inputs and outputs. `RawModel` is just an alias for the napi `Model`
|
|
70
|
-
* class instance type — pass the exact object a provider factory gives you.
|
|
71
|
-
*/
|
|
72
|
-
export type RawModel = Model
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Generate text (non-streaming). Returns a typed {@link GenerateTextResult}.
|
|
76
|
-
*
|
|
77
|
-
* @param model - A raw model instance from `openai()`, `anthropic()`, etc.
|
|
78
|
-
* @param prompt - A plain string or an array of typed chat messages.
|
|
79
|
-
* @param options - Optional typed generation options (tools, tool_choice,
|
|
80
|
-
* temperature, response_format, …).
|
|
81
|
-
*
|
|
82
|
-
* Internally calls the raw
|
|
83
|
-
* `model.generateText(JSON.stringify(prompt), options ? JSON.stringify(options) : undefined)`
|
|
84
|
-
* and `JSON.parse`s the returned JSON into a typed object.
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* ```ts
|
|
88
|
-
* import { openai, generateText } from 'aimux'
|
|
89
|
-
* const model = await openai(apiKey, 'gpt-4o')
|
|
90
|
-
* const result = await generateText(model, 'What is Rust?')
|
|
91
|
-
* console.log(result.text, result.usage)
|
|
92
|
-
* ```
|
|
93
|
-
*/
|
|
94
|
-
export async function generateText(
|
|
95
|
-
model: RawModel,
|
|
96
|
-
prompt: string | ModelMessage[],
|
|
97
|
-
options?: GenerateTextOptions,
|
|
98
|
-
): Promise<GenerateTextResult> {
|
|
99
|
-
const optsJson = options ? JSON.stringify(options) : undefined
|
|
100
|
-
const resultJson = await model.generateText(JSON.stringify(prompt), optsJson)
|
|
101
|
-
return JSON.parse(resultJson) as GenerateTextResult
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Stream text from a model. Yields typed {@link StreamPart}s.
|
|
106
|
-
*
|
|
107
|
-
* @param model - A raw model instance from `openai()`, `anthropic()`, etc.
|
|
108
|
-
* @param prompt - A plain string or an array of typed chat messages.
|
|
109
|
-
* @param options - Optional typed generation options (tools, tool_choice, …).
|
|
110
|
-
*
|
|
111
|
-
* Internally drives the raw `model.streamText(JSON.stringify(prompt), …)`
|
|
112
|
-
* async generator and `JSON.parse`s each JSON-string chunk before yielding it
|
|
113
|
-
* as a typed `StreamPart`.
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
* ```ts
|
|
117
|
-
* import { openai, streamText } from 'aimux'
|
|
118
|
-
* const model = await openai(apiKey, 'gpt-4o')
|
|
119
|
-
* for await (const part of streamText(model, 'Write a haiku about Rust.')) {
|
|
120
|
-
* if ('TextDelta' in part) process.stdout.write(part.TextDelta.delta)
|
|
121
|
-
* }
|
|
122
|
-
* ```
|
|
123
|
-
*/
|
|
124
|
-
export async function* streamText(
|
|
125
|
-
model: RawModel,
|
|
126
|
-
prompt: string | ModelMessage[],
|
|
127
|
-
options?: GenerateTextOptions,
|
|
128
|
-
): AsyncGenerator<StreamPart> {
|
|
129
|
-
const optsJson = options ? JSON.stringify(options) : undefined
|
|
130
|
-
const gen = await model.streamText(JSON.stringify(prompt), optsJson)
|
|
131
|
-
for await (const json of gen) {
|
|
132
|
-
yield JSON.parse(json) as StreamPart
|
|
133
|
-
}
|
|
134
|
-
}
|