@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,45 @@
|
|
|
1
|
+
import type { FinishReason } from "./FinishReason";
|
|
2
|
+
import type { GenerateContent } from "./GenerateContent";
|
|
3
|
+
import type { ResponseMetadata } from "./ResponseMetadata";
|
|
4
|
+
import type { Usage } from "./Usage";
|
|
5
|
+
import type { Warning } from "./Warning";
|
|
6
|
+
import type { JsonValue } from "./serde_json/JsonValue";
|
|
7
|
+
/**
|
|
8
|
+
* Result of `LanguageModel::do_generate` (non-streaming).
|
|
9
|
+
*/
|
|
10
|
+
export type GenerateResult = {
|
|
11
|
+
/**
|
|
12
|
+
* Generated content items (text, tool calls, etc.).
|
|
13
|
+
*/
|
|
14
|
+
content: Array<GenerateContent>;
|
|
15
|
+
/**
|
|
16
|
+
* Why generation stopped.
|
|
17
|
+
*/
|
|
18
|
+
finish_reason: FinishReason;
|
|
19
|
+
/**
|
|
20
|
+
* Token usage.
|
|
21
|
+
*/
|
|
22
|
+
usage: Usage;
|
|
23
|
+
/**
|
|
24
|
+
* Warnings issued by the provider.
|
|
25
|
+
*/
|
|
26
|
+
warnings: Array<Warning>;
|
|
27
|
+
/**
|
|
28
|
+
* Provider-specific metadata.
|
|
29
|
+
*/
|
|
30
|
+
provider_metadata: JsonValue | null;
|
|
31
|
+
/**
|
|
32
|
+
* Response metadata (id, timestamp, model_id).
|
|
33
|
+
*/
|
|
34
|
+
response: ResponseMetadata;
|
|
35
|
+
/**
|
|
36
|
+
* The request body that was sent (for debugging).
|
|
37
|
+
*/
|
|
38
|
+
request_body: JsonValue | null;
|
|
39
|
+
/**
|
|
40
|
+
* Response headers.
|
|
41
|
+
*/
|
|
42
|
+
response_headers: {
|
|
43
|
+
[key in string]: string;
|
|
44
|
+
} | null;
|
|
45
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ReasoningEffort } from "./ReasoningEffort";
|
|
2
|
+
import type { ResponseFormat } from "./ResponseFormat";
|
|
3
|
+
import type { Tool } from "./Tool";
|
|
4
|
+
import type { ToolChoice } from "./ToolChoice";
|
|
5
|
+
import type { JsonValue } from "./serde_json/JsonValue";
|
|
6
|
+
/**
|
|
7
|
+
* User-facing options for `generate_text` and `stream_text`.
|
|
8
|
+
*
|
|
9
|
+
* Unlike `CallOptions` (provider-facing), this does not include `prompt`
|
|
10
|
+
* (passed separately) and defaults are more ergonomic.
|
|
11
|
+
*/
|
|
12
|
+
export type GenerateTextOptions = {
|
|
13
|
+
max_output_tokens: number | null;
|
|
14
|
+
temperature: number | null;
|
|
15
|
+
stop_sequences: Array<string> | null;
|
|
16
|
+
top_p: number | null;
|
|
17
|
+
top_k: number | null;
|
|
18
|
+
presence_penalty: number | null;
|
|
19
|
+
frequency_penalty: number | null;
|
|
20
|
+
response_format: ResponseFormat | null;
|
|
21
|
+
seed: bigint | null;
|
|
22
|
+
tools: Array<Tool> | null;
|
|
23
|
+
tool_choice: ToolChoice | null;
|
|
24
|
+
headers: {
|
|
25
|
+
[key in string]: string;
|
|
26
|
+
} | null;
|
|
27
|
+
provider_options: {
|
|
28
|
+
[key in string]: JsonValue;
|
|
29
|
+
} | null;
|
|
30
|
+
/**
|
|
31
|
+
* Top-level reasoning effort.
|
|
32
|
+
*/
|
|
33
|
+
reasoning: ReasoningEffort | null;
|
|
34
|
+
/**
|
|
35
|
+
* System instructions prepended to the prompt.
|
|
36
|
+
*/
|
|
37
|
+
instructions: string | null;
|
|
38
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { FinishReason } from "./FinishReason";
|
|
2
|
+
import type { GenerateResult } from "./GenerateResult";
|
|
3
|
+
import type { ToolCall } from "./ToolCall";
|
|
4
|
+
import type { Usage } from "./Usage";
|
|
5
|
+
import type { Warning } from "./Warning";
|
|
6
|
+
/**
|
|
7
|
+
* Result of `generate_text` (user-facing).
|
|
8
|
+
*/
|
|
9
|
+
export type GenerateTextResult = {
|
|
10
|
+
/**
|
|
11
|
+
* The generated text (concatenated from all text content parts).
|
|
12
|
+
*/
|
|
13
|
+
text: string;
|
|
14
|
+
/**
|
|
15
|
+
* Tool calls requested by the model.
|
|
16
|
+
*/
|
|
17
|
+
tool_calls: Array<ToolCall>;
|
|
18
|
+
/**
|
|
19
|
+
* Why generation stopped.
|
|
20
|
+
*/
|
|
21
|
+
finish_reason: FinishReason;
|
|
22
|
+
/**
|
|
23
|
+
* Token usage.
|
|
24
|
+
*/
|
|
25
|
+
usage: Usage;
|
|
26
|
+
/**
|
|
27
|
+
* Warnings from the provider.
|
|
28
|
+
*/
|
|
29
|
+
warnings: Array<Warning>;
|
|
30
|
+
/**
|
|
31
|
+
* Raw provider result (for advanced use).
|
|
32
|
+
*/
|
|
33
|
+
raw: GenerateResult;
|
|
34
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { AspectRatio } from "./AspectRatio";
|
|
2
|
+
import type { ImageFile } from "./ImageFile";
|
|
3
|
+
import type { Size } from "./Size";
|
|
4
|
+
import type { JsonValue } from "./serde_json/JsonValue";
|
|
5
|
+
/**
|
|
6
|
+
* Options passed to [`ImageModel::do_generate`].
|
|
7
|
+
*
|
|
8
|
+
* Aligned with V4 `ImageModelV4CallOptions`.
|
|
9
|
+
*/
|
|
10
|
+
export type ImageCallOptions = {
|
|
11
|
+
/**
|
|
12
|
+
* Prompt for the image generation. `None` for operations (e.g. upscaling)
|
|
13
|
+
* that do not require a prompt.
|
|
14
|
+
*/
|
|
15
|
+
prompt: string | null;
|
|
16
|
+
/**
|
|
17
|
+
* Number of images to generate.
|
|
18
|
+
*/
|
|
19
|
+
n: number;
|
|
20
|
+
/**
|
|
21
|
+
* Size of the images, in `{width}x{height}` format.
|
|
22
|
+
* `None` uses the provider's default size.
|
|
23
|
+
*/
|
|
24
|
+
size: Size | null;
|
|
25
|
+
/**
|
|
26
|
+
* Aspect ratio of the images, in `{width}:{height}` format.
|
|
27
|
+
* `None` uses the provider's default aspect ratio.
|
|
28
|
+
*/
|
|
29
|
+
aspect_ratio: AspectRatio | null;
|
|
30
|
+
/**
|
|
31
|
+
* Seed for deterministic generation. `None` uses the provider's default.
|
|
32
|
+
*/
|
|
33
|
+
seed: bigint | null;
|
|
34
|
+
/**
|
|
35
|
+
* Images for image editing or variation generation.
|
|
36
|
+
*/
|
|
37
|
+
files: Array<ImageFile> | null;
|
|
38
|
+
/**
|
|
39
|
+
* Mask image for inpainting operations.
|
|
40
|
+
*/
|
|
41
|
+
mask: ImageFile | null;
|
|
42
|
+
/**
|
|
43
|
+
* Additional provider-specific options, keyed by provider name.
|
|
44
|
+
*/
|
|
45
|
+
provider_options: {
|
|
46
|
+
[key in string]: JsonValue;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Additional HTTP headers to send with the request.
|
|
50
|
+
*/
|
|
51
|
+
headers: {
|
|
52
|
+
[key in string]: string;
|
|
53
|
+
} | null;
|
|
54
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ImageFileData } from "./ImageFileData";
|
|
2
|
+
/**
|
|
3
|
+
* An image file used for image editing or variation generation.
|
|
4
|
+
*
|
|
5
|
+
* Aligned with V4 `ImageModelV4File`.
|
|
6
|
+
*/
|
|
7
|
+
export type ImageFile = {
|
|
8
|
+
"File": {
|
|
9
|
+
/**
|
|
10
|
+
* IANA media type, e.g. `"image/png"`.
|
|
11
|
+
*/
|
|
12
|
+
media_type: string;
|
|
13
|
+
/**
|
|
14
|
+
* File data as base64 string or binary bytes.
|
|
15
|
+
*/
|
|
16
|
+
data: ImageFileData;
|
|
17
|
+
};
|
|
18
|
+
} | {
|
|
19
|
+
"Url": {
|
|
20
|
+
/**
|
|
21
|
+
* The URL of the image file.
|
|
22
|
+
*/
|
|
23
|
+
url: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The generated images, returned as a homogeneous collection.
|
|
3
|
+
*
|
|
4
|
+
* The TS result type is `Array<string> | Array<Uint8Array>` — i.e. either all
|
|
5
|
+
* base64 strings or all binary blobs, never mixed. This enum models that
|
|
6
|
+
* union. Providers should return data without unnecessary conversion: if the
|
|
7
|
+
* upstream API returns base64, return [`ImageOutputs::Base64`]; if binary,
|
|
8
|
+
* return [`ImageOutputs::Binary`].
|
|
9
|
+
*/
|
|
10
|
+
export type ImageOutputs = {
|
|
11
|
+
"Base64": Array<string>;
|
|
12
|
+
} | {
|
|
13
|
+
"Binary": Array<Array<number>>;
|
|
14
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response information for an image generation call.
|
|
3
|
+
*/
|
|
4
|
+
export type ImageResponse = {
|
|
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,34 @@
|
|
|
1
|
+
import type { ImageOutputs } from "./ImageOutputs";
|
|
2
|
+
import type { ImageResponse } from "./ImageResponse";
|
|
3
|
+
import type { ImageUsage } from "./ImageUsage";
|
|
4
|
+
import type { Warning } from "./Warning";
|
|
5
|
+
import type { JsonValue } from "./serde_json/JsonValue";
|
|
6
|
+
/**
|
|
7
|
+
* The result of [`ImageModel::do_generate`].
|
|
8
|
+
*
|
|
9
|
+
* Aligned with V4 `ImageModelV4Result`.
|
|
10
|
+
*/
|
|
11
|
+
export type ImageResult = {
|
|
12
|
+
/**
|
|
13
|
+
* Generated images (base64 strings or binary data).
|
|
14
|
+
*/
|
|
15
|
+
images: ImageOutputs;
|
|
16
|
+
/**
|
|
17
|
+
* Warnings for the call, e.g. unsupported features.
|
|
18
|
+
*/
|
|
19
|
+
warnings: Array<Warning>;
|
|
20
|
+
/**
|
|
21
|
+
* Additional provider-specific metadata, keyed by provider name.
|
|
22
|
+
*/
|
|
23
|
+
provider_metadata: {
|
|
24
|
+
[key in string]: JsonValue;
|
|
25
|
+
} | null;
|
|
26
|
+
/**
|
|
27
|
+
* Response information for telemetry and debugging.
|
|
28
|
+
*/
|
|
29
|
+
response: ImageResponse;
|
|
30
|
+
/**
|
|
31
|
+
* Optional token usage for the call (if the provider reports it).
|
|
32
|
+
*/
|
|
33
|
+
usage: ImageUsage | null;
|
|
34
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token usage for an image generation call (if the provider reports it).
|
|
3
|
+
*
|
|
4
|
+
* Aligned with V4 `ImageModelV4Usage`.
|
|
5
|
+
*/
|
|
6
|
+
export type ImageUsage = {
|
|
7
|
+
/**
|
|
8
|
+
* Number of input (prompt) tokens used.
|
|
9
|
+
*/
|
|
10
|
+
input_tokens: number | null;
|
|
11
|
+
/**
|
|
12
|
+
* Number of output tokens used, if reported.
|
|
13
|
+
*/
|
|
14
|
+
output_tokens: number | null;
|
|
15
|
+
/**
|
|
16
|
+
* Total tokens as reported by the provider.
|
|
17
|
+
*/
|
|
18
|
+
total_tokens: number | null;
|
|
19
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The input audio format for a streaming transcription request.
|
|
3
|
+
*/
|
|
4
|
+
export type InputAudioFormat = {
|
|
5
|
+
/**
|
|
6
|
+
* Audio format type, e.g. `"audio/pcm"`, `"audio/pcmu"`, `"audio/pcma"`.
|
|
7
|
+
*/
|
|
8
|
+
format_type: string;
|
|
9
|
+
/**
|
|
10
|
+
* Sample rate in Hz. Only applicable for formats that require a rate.
|
|
11
|
+
*/
|
|
12
|
+
rate: number | null;
|
|
13
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ContentPart } from "./ContentPart";
|
|
2
|
+
import type { Role } from "./Role";
|
|
3
|
+
import type { JsonValue } from "./serde_json/JsonValue";
|
|
4
|
+
/**
|
|
5
|
+
* A single provider-facing message.
|
|
6
|
+
*
|
|
7
|
+
* Unlike `ModelMessage` (which can have string content), this always has
|
|
8
|
+
* `content: Vec<ContentPart>` — strings are normalized to `ContentPart::Text`.
|
|
9
|
+
*/
|
|
10
|
+
export type LanguageModelPromptMessage = {
|
|
11
|
+
role: Role;
|
|
12
|
+
content: Array<ContentPart>;
|
|
13
|
+
/**
|
|
14
|
+
* Message-level provider-specific options (e.g.
|
|
15
|
+
* `anthropic.cacheControl`), applied to the last part of the message when
|
|
16
|
+
* converting to a provider prompt. Mirrors the Vercel AI SDK
|
|
17
|
+
* `LanguageModelV4Message.providerOptions`.
|
|
18
|
+
*/
|
|
19
|
+
provider_options: JsonValue | null;
|
|
20
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ModelMessage } from "./ModelMessage";
|
|
2
|
+
/**
|
|
3
|
+
* What the user passes as `prompt` to `generate_text` / `stream_text`.
|
|
4
|
+
*
|
|
5
|
+
* Can be a simple string (converted to a single user message) or a list of messages.
|
|
6
|
+
*/
|
|
7
|
+
export type ModelPrompt = string | Array<ModelMessage>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { JsonValue } from "./serde_json/JsonValue";
|
|
2
|
+
/**
|
|
3
|
+
* A provider-defined tool (e.g. `anthropic.web_search_20250305`,
|
|
4
|
+
* `google.googleSearch`). Mirrors the V4 `LanguageModelV4ProviderTool`.
|
|
5
|
+
*
|
|
6
|
+
* Provider tools are specific to a certain provider. The input and output
|
|
7
|
+
* schemas are defined by the provider, and some are executed on the provider's
|
|
8
|
+
* servers (e.g. web search, code execution).
|
|
9
|
+
*/
|
|
10
|
+
export type ProviderTool = {
|
|
11
|
+
/**
|
|
12
|
+
* The ID of the tool, following the format `<provider-id>.<unique-tool-name>`.
|
|
13
|
+
*/
|
|
14
|
+
id: string;
|
|
15
|
+
/**
|
|
16
|
+
* The name of the tool, unique within this model call.
|
|
17
|
+
*/
|
|
18
|
+
name: string;
|
|
19
|
+
/**
|
|
20
|
+
* The arguments for configuring the tool. Must match the expected
|
|
21
|
+
* arguments defined by the provider for this tool.
|
|
22
|
+
*/
|
|
23
|
+
args: JsonValue;
|
|
24
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reasoning effort level (aligned with V4 `reasoning` option).
|
|
3
|
+
*
|
|
4
|
+
* Controls how much reasoning/thinking the model performs. Maps to
|
|
5
|
+
* OpenAI `reasoning_effort` and Anthropic `thinking` config.
|
|
6
|
+
*/
|
|
7
|
+
export type ReasoningEffort = "provider-default" | "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { JsonValue } from "./serde_json/JsonValue";
|
|
2
|
+
/**
|
|
3
|
+
* Optional request information for telemetry and debugging.
|
|
4
|
+
*
|
|
5
|
+
* Aligned with the `request?` object that appears on some V4 model results.
|
|
6
|
+
*/
|
|
7
|
+
export type RequestInfo = {
|
|
8
|
+
/**
|
|
9
|
+
* The request body that was sent (opaque JSON).
|
|
10
|
+
*/
|
|
11
|
+
body: JsonValue | null;
|
|
12
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { RerankingDocuments } from "./RerankingDocuments";
|
|
2
|
+
import type { JsonValue } from "./serde_json/JsonValue";
|
|
3
|
+
/**
|
|
4
|
+
* Options passed to [`RerankingModel::do_rerank`].
|
|
5
|
+
*
|
|
6
|
+
* Aligned with V4 `RerankingModelV4CallOptions`.
|
|
7
|
+
*/
|
|
8
|
+
export type RerankingCallOptions = {
|
|
9
|
+
/**
|
|
10
|
+
* Documents to rerank.
|
|
11
|
+
*/
|
|
12
|
+
documents: RerankingDocuments;
|
|
13
|
+
/**
|
|
14
|
+
* The query to rerank the documents against.
|
|
15
|
+
*/
|
|
16
|
+
query: string;
|
|
17
|
+
/**
|
|
18
|
+
* Optional limit: return only the top `n` documents.
|
|
19
|
+
*/
|
|
20
|
+
top_n: number | null;
|
|
21
|
+
/**
|
|
22
|
+
* Additional provider-specific options, keyed by provider name.
|
|
23
|
+
*/
|
|
24
|
+
provider_options: {
|
|
25
|
+
[key in string]: JsonValue;
|
|
26
|
+
} | null;
|
|
27
|
+
/**
|
|
28
|
+
* Additional HTTP headers to send with the request.
|
|
29
|
+
*/
|
|
30
|
+
headers: {
|
|
31
|
+
[key in string]: string;
|
|
32
|
+
} | null;
|
|
33
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { JsonValue } from "./serde_json/JsonValue";
|
|
2
|
+
/**
|
|
3
|
+
* Documents to rerank: either a list of texts or a list of JSON objects.
|
|
4
|
+
*
|
|
5
|
+
* Aligned with V4 `RerankingModelV4CallOptions.documents`.
|
|
6
|
+
*/
|
|
7
|
+
export type RerankingDocuments = {
|
|
8
|
+
"Text": {
|
|
9
|
+
values: Array<string>;
|
|
10
|
+
};
|
|
11
|
+
} | {
|
|
12
|
+
"Object": {
|
|
13
|
+
values: Array<JsonValue>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single reranked entry: the original index and its relevance score.
|
|
3
|
+
*/
|
|
4
|
+
export type RerankingRank = {
|
|
5
|
+
/**
|
|
6
|
+
* The index of the document in the original list (before reranking).
|
|
7
|
+
*/
|
|
8
|
+
index: number;
|
|
9
|
+
/**
|
|
10
|
+
* The relevance score of the document after reranking.
|
|
11
|
+
*/
|
|
12
|
+
relevance_score: number;
|
|
13
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { JsonValue } from "./serde_json/JsonValue";
|
|
2
|
+
/**
|
|
3
|
+
* Optional response information for a reranking call.
|
|
4
|
+
*/
|
|
5
|
+
export type RerankingResponse = {
|
|
6
|
+
/**
|
|
7
|
+
* ID for the generated response, if the provider sends one.
|
|
8
|
+
*/
|
|
9
|
+
id: string | null;
|
|
10
|
+
/**
|
|
11
|
+
* Timestamp for the start of the generated response (ISO 8601 string).
|
|
12
|
+
*/
|
|
13
|
+
timestamp: string | null;
|
|
14
|
+
/**
|
|
15
|
+
* The ID of the model that was used to generate the response.
|
|
16
|
+
*/
|
|
17
|
+
model_id: string | null;
|
|
18
|
+
/**
|
|
19
|
+
* Response headers.
|
|
20
|
+
*/
|
|
21
|
+
headers: {
|
|
22
|
+
[key in string]: string;
|
|
23
|
+
} | null;
|
|
24
|
+
/**
|
|
25
|
+
* Response body (opaque JSON).
|
|
26
|
+
*/
|
|
27
|
+
body: JsonValue | null;
|
|
28
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { RerankingRank } from "./RerankingRank";
|
|
2
|
+
import type { RerankingResponse } from "./RerankingResponse";
|
|
3
|
+
import type { Warning } from "./Warning";
|
|
4
|
+
import type { JsonValue } from "./serde_json/JsonValue";
|
|
5
|
+
/**
|
|
6
|
+
* The result of [`RerankingModel::do_rerank`].
|
|
7
|
+
*
|
|
8
|
+
* Aligned with V4 `RerankingModelV4Result`.
|
|
9
|
+
*/
|
|
10
|
+
export type RerankingResult = {
|
|
11
|
+
/**
|
|
12
|
+
* Ordered list of reranked documents, sorted by descending relevance
|
|
13
|
+
* score. Each entry's `index` refers to the position in the original
|
|
14
|
+
* `documents` list.
|
|
15
|
+
*/
|
|
16
|
+
ranking: Array<RerankingRank>;
|
|
17
|
+
/**
|
|
18
|
+
* Additional provider-specific metadata, keyed by provider name.
|
|
19
|
+
*/
|
|
20
|
+
provider_metadata: {
|
|
21
|
+
[key in string]: JsonValue;
|
|
22
|
+
} | null;
|
|
23
|
+
/**
|
|
24
|
+
* Warnings for the call, e.g. unsupported settings.
|
|
25
|
+
*/
|
|
26
|
+
warnings: Array<Warning> | null;
|
|
27
|
+
/**
|
|
28
|
+
* Optional response information for debugging.
|
|
29
|
+
*/
|
|
30
|
+
response: RerankingResponse | null;
|
|
31
|
+
};
|