@aihubmix/ai-sdk-provider 0.0.3 → 0.0.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.mts +188 -14
- package/dist/index.d.ts +188 -14
- package/dist/index.js +291 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +289 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -9
package/dist/index.d.mts
CHANGED
|
@@ -1,28 +1,202 @@
|
|
|
1
1
|
import { ProviderV2, LanguageModelV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV2, SpeechModelV2 } from '@ai-sdk/provider';
|
|
2
|
+
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
2
3
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
-
import { z } from 'zod';
|
|
4
4
|
import { OpenAIProviderSettings } from '@ai-sdk/openai';
|
|
5
5
|
|
|
6
|
-
declare const
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
|
|
7
|
+
/**
|
|
8
|
+
* Filters for the search.
|
|
9
|
+
*/
|
|
10
|
+
filters?: {
|
|
11
|
+
/**
|
|
12
|
+
* Allowed domains for the search.
|
|
13
|
+
* If not provided, all domains are allowed.
|
|
14
|
+
* Subdomains of the provided domains are allowed as well.
|
|
15
|
+
*/
|
|
16
|
+
allowedDomains?: string[];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Search context size to use for the web search.
|
|
20
|
+
* - high: Most comprehensive context, highest cost, slower response
|
|
21
|
+
* - medium: Balanced context, cost, and latency (default)
|
|
22
|
+
* - low: Least context, lowest cost, fastest response
|
|
23
|
+
*/
|
|
24
|
+
searchContextSize?: "low" | "medium" | "high";
|
|
25
|
+
/**
|
|
26
|
+
* User location information to provide geographically relevant search results.
|
|
27
|
+
*/
|
|
9
28
|
userLocation?: {
|
|
10
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Type of location (always 'approximate')
|
|
31
|
+
*/
|
|
32
|
+
type: "approximate";
|
|
33
|
+
/**
|
|
34
|
+
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
35
|
+
*/
|
|
36
|
+
country?: string;
|
|
37
|
+
/**
|
|
38
|
+
* City name (free text, e.g., 'Minneapolis')
|
|
39
|
+
*/
|
|
11
40
|
city?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Region name (free text, e.g., 'Minnesota')
|
|
43
|
+
*/
|
|
12
44
|
region?: string;
|
|
13
|
-
|
|
45
|
+
/**
|
|
46
|
+
* IANA timezone (e.g., 'America/Chicago')
|
|
47
|
+
*/
|
|
14
48
|
timezone?: string;
|
|
15
49
|
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
50
|
+
}>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A filter used to compare a specified attribute key to a given value using a defined comparison operation.
|
|
54
|
+
*/
|
|
55
|
+
type OpenAIResponsesFileSearchToolComparisonFilter = {
|
|
56
|
+
/**
|
|
57
|
+
* The key to compare against the value.
|
|
58
|
+
*/
|
|
59
|
+
key: string;
|
|
60
|
+
/**
|
|
61
|
+
* Specifies the comparison operator: eq, ne, gt, gte, lt, lte.
|
|
62
|
+
*/
|
|
63
|
+
type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
64
|
+
/**
|
|
65
|
+
* The value to compare against the attribute key; supports string, number, or boolean types.
|
|
66
|
+
*/
|
|
67
|
+
value: string | number | boolean;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Combine multiple filters using and or or.
|
|
71
|
+
*/
|
|
72
|
+
type OpenAIResponsesFileSearchToolCompoundFilter = {
|
|
73
|
+
/**
|
|
74
|
+
* Type of operation: and or or.
|
|
75
|
+
*/
|
|
76
|
+
type: 'and' | 'or';
|
|
77
|
+
/**
|
|
78
|
+
* Array of filters to combine. Items can be ComparisonFilter or CompoundFilter.
|
|
79
|
+
*/
|
|
80
|
+
filters: Array<OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter>;
|
|
23
81
|
};
|
|
82
|
+
|
|
24
83
|
declare const aihubmixTools: {
|
|
25
|
-
|
|
84
|
+
/**
|
|
85
|
+
* The Code Interpreter tool allows models to write and run Python code in a
|
|
86
|
+
* sandboxed environment to solve complex problems in domains like data analysis,
|
|
87
|
+
* coding, and math.
|
|
88
|
+
*
|
|
89
|
+
* @param container - The container to use for the code interpreter.
|
|
90
|
+
*
|
|
91
|
+
* Must have name `code_interpreter`.
|
|
92
|
+
*/
|
|
93
|
+
codeInterpreter: (args?: {
|
|
94
|
+
container?: string | {
|
|
95
|
+
fileIds?: string[];
|
|
96
|
+
};
|
|
97
|
+
}) => _ai_sdk_provider_utils.Tool<{
|
|
98
|
+
code?: string | null;
|
|
99
|
+
containerId: string;
|
|
100
|
+
}, {
|
|
101
|
+
outputs?: Array<{
|
|
102
|
+
type: "logs";
|
|
103
|
+
logs: string;
|
|
104
|
+
} | {
|
|
105
|
+
type: "image";
|
|
106
|
+
url: string;
|
|
107
|
+
}> | null;
|
|
108
|
+
}>;
|
|
109
|
+
/**
|
|
110
|
+
* File search is a tool available in the Responses API. It enables models to
|
|
111
|
+
* retrieve information in a knowledge base of previously uploaded files through
|
|
112
|
+
* semantic and keyword search.
|
|
113
|
+
*
|
|
114
|
+
* Must have name `file_search`.
|
|
115
|
+
*
|
|
116
|
+
* @param vectorStoreIds - The vector store IDs to use for the file search.
|
|
117
|
+
* @param maxNumResults - The maximum number of results to return.
|
|
118
|
+
* @param ranking - The ranking options to use for the file search.
|
|
119
|
+
* @param filters - The filters to use for the file search.
|
|
120
|
+
*/
|
|
121
|
+
fileSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{}, {
|
|
122
|
+
queries: string[];
|
|
123
|
+
results: null | {
|
|
124
|
+
attributes: Record<string, unknown>;
|
|
125
|
+
fileId: string;
|
|
126
|
+
filename: string;
|
|
127
|
+
score: number;
|
|
128
|
+
text: string;
|
|
129
|
+
}[];
|
|
130
|
+
}, {
|
|
131
|
+
vectorStoreIds: string[];
|
|
132
|
+
maxNumResults?: number;
|
|
133
|
+
ranking?: {
|
|
134
|
+
ranker?: string;
|
|
135
|
+
scoreThreshold?: number;
|
|
136
|
+
};
|
|
137
|
+
filters?: OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter;
|
|
138
|
+
}>;
|
|
139
|
+
/**
|
|
140
|
+
* The image generation tool allows you to generate images using a text prompt,
|
|
141
|
+
* and optionally image inputs. It leverages the GPT Image model,
|
|
142
|
+
* and automatically optimizes text inputs for improved performance.
|
|
143
|
+
*
|
|
144
|
+
* Must have name `image_generation`.
|
|
145
|
+
*
|
|
146
|
+
* @param size - Image dimensions (e.g., 1024x1024, 1024x1536)
|
|
147
|
+
* @param quality - Rendering quality (e.g. low, medium, high)
|
|
148
|
+
* @param format - File output format
|
|
149
|
+
* @param compression - Compression level (0-100%) for JPEG and WebP formats
|
|
150
|
+
* @param background - Transparent or opaque
|
|
151
|
+
*/
|
|
152
|
+
imageGeneration: (args?: {
|
|
153
|
+
background?: "auto" | "opaque" | "transparent";
|
|
154
|
+
inputFidelity?: "low" | "high";
|
|
155
|
+
inputImageMask?: {
|
|
156
|
+
fileId?: string;
|
|
157
|
+
imageUrl?: string;
|
|
158
|
+
};
|
|
159
|
+
model?: string;
|
|
160
|
+
moderation?: "auto";
|
|
161
|
+
outputCompression?: number;
|
|
162
|
+
outputFormat?: "png" | "jpeg" | "webp";
|
|
163
|
+
quality?: "auto" | "low" | "medium" | "high";
|
|
164
|
+
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024";
|
|
165
|
+
}) => _ai_sdk_provider_utils.Tool<{}, {
|
|
166
|
+
result: string;
|
|
167
|
+
}>;
|
|
168
|
+
/**
|
|
169
|
+
* Web search allows models to access up-to-date information from the internet
|
|
170
|
+
* and provide answers with sourced citations.
|
|
171
|
+
*
|
|
172
|
+
* Must have name `web_search_preview`.
|
|
173
|
+
*
|
|
174
|
+
* @param searchContextSize - The search context size to use for the web search.
|
|
175
|
+
* @param userLocation - The user location to use for the web search.
|
|
176
|
+
*
|
|
177
|
+
* @deprecated Use `webSearch` instead.
|
|
178
|
+
*/
|
|
179
|
+
webSearchPreview: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
|
|
180
|
+
searchContextSize?: "low" | "medium" | "high";
|
|
181
|
+
userLocation?: {
|
|
182
|
+
type: "approximate";
|
|
183
|
+
country?: string;
|
|
184
|
+
city?: string;
|
|
185
|
+
region?: string;
|
|
186
|
+
timezone?: string;
|
|
187
|
+
};
|
|
188
|
+
}>;
|
|
189
|
+
/**
|
|
190
|
+
* Web search allows models to access up-to-date information from the internet
|
|
191
|
+
* and provide answers with sourced citations.
|
|
192
|
+
*
|
|
193
|
+
* Must have name `web_search`.
|
|
194
|
+
*
|
|
195
|
+
* @param filters - The filters to use for the web search.
|
|
196
|
+
* @param searchContextSize - The search context size to use for the web search.
|
|
197
|
+
* @param userLocation - The user location to use for the web search.
|
|
198
|
+
*/
|
|
199
|
+
webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, unknown>;
|
|
26
200
|
};
|
|
27
201
|
|
|
28
202
|
interface AihubmixProvider extends ProviderV2 {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,202 @@
|
|
|
1
1
|
import { ProviderV2, LanguageModelV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV2, SpeechModelV2 } from '@ai-sdk/provider';
|
|
2
|
+
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
2
3
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
-
import { z } from 'zod';
|
|
4
4
|
import { OpenAIProviderSettings } from '@ai-sdk/openai';
|
|
5
5
|
|
|
6
|
-
declare const
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
|
|
7
|
+
/**
|
|
8
|
+
* Filters for the search.
|
|
9
|
+
*/
|
|
10
|
+
filters?: {
|
|
11
|
+
/**
|
|
12
|
+
* Allowed domains for the search.
|
|
13
|
+
* If not provided, all domains are allowed.
|
|
14
|
+
* Subdomains of the provided domains are allowed as well.
|
|
15
|
+
*/
|
|
16
|
+
allowedDomains?: string[];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Search context size to use for the web search.
|
|
20
|
+
* - high: Most comprehensive context, highest cost, slower response
|
|
21
|
+
* - medium: Balanced context, cost, and latency (default)
|
|
22
|
+
* - low: Least context, lowest cost, fastest response
|
|
23
|
+
*/
|
|
24
|
+
searchContextSize?: "low" | "medium" | "high";
|
|
25
|
+
/**
|
|
26
|
+
* User location information to provide geographically relevant search results.
|
|
27
|
+
*/
|
|
9
28
|
userLocation?: {
|
|
10
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Type of location (always 'approximate')
|
|
31
|
+
*/
|
|
32
|
+
type: "approximate";
|
|
33
|
+
/**
|
|
34
|
+
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
35
|
+
*/
|
|
36
|
+
country?: string;
|
|
37
|
+
/**
|
|
38
|
+
* City name (free text, e.g., 'Minneapolis')
|
|
39
|
+
*/
|
|
11
40
|
city?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Region name (free text, e.g., 'Minnesota')
|
|
43
|
+
*/
|
|
12
44
|
region?: string;
|
|
13
|
-
|
|
45
|
+
/**
|
|
46
|
+
* IANA timezone (e.g., 'America/Chicago')
|
|
47
|
+
*/
|
|
14
48
|
timezone?: string;
|
|
15
49
|
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
50
|
+
}>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A filter used to compare a specified attribute key to a given value using a defined comparison operation.
|
|
54
|
+
*/
|
|
55
|
+
type OpenAIResponsesFileSearchToolComparisonFilter = {
|
|
56
|
+
/**
|
|
57
|
+
* The key to compare against the value.
|
|
58
|
+
*/
|
|
59
|
+
key: string;
|
|
60
|
+
/**
|
|
61
|
+
* Specifies the comparison operator: eq, ne, gt, gte, lt, lte.
|
|
62
|
+
*/
|
|
63
|
+
type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
64
|
+
/**
|
|
65
|
+
* The value to compare against the attribute key; supports string, number, or boolean types.
|
|
66
|
+
*/
|
|
67
|
+
value: string | number | boolean;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Combine multiple filters using and or or.
|
|
71
|
+
*/
|
|
72
|
+
type OpenAIResponsesFileSearchToolCompoundFilter = {
|
|
73
|
+
/**
|
|
74
|
+
* Type of operation: and or or.
|
|
75
|
+
*/
|
|
76
|
+
type: 'and' | 'or';
|
|
77
|
+
/**
|
|
78
|
+
* Array of filters to combine. Items can be ComparisonFilter or CompoundFilter.
|
|
79
|
+
*/
|
|
80
|
+
filters: Array<OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter>;
|
|
23
81
|
};
|
|
82
|
+
|
|
24
83
|
declare const aihubmixTools: {
|
|
25
|
-
|
|
84
|
+
/**
|
|
85
|
+
* The Code Interpreter tool allows models to write and run Python code in a
|
|
86
|
+
* sandboxed environment to solve complex problems in domains like data analysis,
|
|
87
|
+
* coding, and math.
|
|
88
|
+
*
|
|
89
|
+
* @param container - The container to use for the code interpreter.
|
|
90
|
+
*
|
|
91
|
+
* Must have name `code_interpreter`.
|
|
92
|
+
*/
|
|
93
|
+
codeInterpreter: (args?: {
|
|
94
|
+
container?: string | {
|
|
95
|
+
fileIds?: string[];
|
|
96
|
+
};
|
|
97
|
+
}) => _ai_sdk_provider_utils.Tool<{
|
|
98
|
+
code?: string | null;
|
|
99
|
+
containerId: string;
|
|
100
|
+
}, {
|
|
101
|
+
outputs?: Array<{
|
|
102
|
+
type: "logs";
|
|
103
|
+
logs: string;
|
|
104
|
+
} | {
|
|
105
|
+
type: "image";
|
|
106
|
+
url: string;
|
|
107
|
+
}> | null;
|
|
108
|
+
}>;
|
|
109
|
+
/**
|
|
110
|
+
* File search is a tool available in the Responses API. It enables models to
|
|
111
|
+
* retrieve information in a knowledge base of previously uploaded files through
|
|
112
|
+
* semantic and keyword search.
|
|
113
|
+
*
|
|
114
|
+
* Must have name `file_search`.
|
|
115
|
+
*
|
|
116
|
+
* @param vectorStoreIds - The vector store IDs to use for the file search.
|
|
117
|
+
* @param maxNumResults - The maximum number of results to return.
|
|
118
|
+
* @param ranking - The ranking options to use for the file search.
|
|
119
|
+
* @param filters - The filters to use for the file search.
|
|
120
|
+
*/
|
|
121
|
+
fileSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{}, {
|
|
122
|
+
queries: string[];
|
|
123
|
+
results: null | {
|
|
124
|
+
attributes: Record<string, unknown>;
|
|
125
|
+
fileId: string;
|
|
126
|
+
filename: string;
|
|
127
|
+
score: number;
|
|
128
|
+
text: string;
|
|
129
|
+
}[];
|
|
130
|
+
}, {
|
|
131
|
+
vectorStoreIds: string[];
|
|
132
|
+
maxNumResults?: number;
|
|
133
|
+
ranking?: {
|
|
134
|
+
ranker?: string;
|
|
135
|
+
scoreThreshold?: number;
|
|
136
|
+
};
|
|
137
|
+
filters?: OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter;
|
|
138
|
+
}>;
|
|
139
|
+
/**
|
|
140
|
+
* The image generation tool allows you to generate images using a text prompt,
|
|
141
|
+
* and optionally image inputs. It leverages the GPT Image model,
|
|
142
|
+
* and automatically optimizes text inputs for improved performance.
|
|
143
|
+
*
|
|
144
|
+
* Must have name `image_generation`.
|
|
145
|
+
*
|
|
146
|
+
* @param size - Image dimensions (e.g., 1024x1024, 1024x1536)
|
|
147
|
+
* @param quality - Rendering quality (e.g. low, medium, high)
|
|
148
|
+
* @param format - File output format
|
|
149
|
+
* @param compression - Compression level (0-100%) for JPEG and WebP formats
|
|
150
|
+
* @param background - Transparent or opaque
|
|
151
|
+
*/
|
|
152
|
+
imageGeneration: (args?: {
|
|
153
|
+
background?: "auto" | "opaque" | "transparent";
|
|
154
|
+
inputFidelity?: "low" | "high";
|
|
155
|
+
inputImageMask?: {
|
|
156
|
+
fileId?: string;
|
|
157
|
+
imageUrl?: string;
|
|
158
|
+
};
|
|
159
|
+
model?: string;
|
|
160
|
+
moderation?: "auto";
|
|
161
|
+
outputCompression?: number;
|
|
162
|
+
outputFormat?: "png" | "jpeg" | "webp";
|
|
163
|
+
quality?: "auto" | "low" | "medium" | "high";
|
|
164
|
+
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024";
|
|
165
|
+
}) => _ai_sdk_provider_utils.Tool<{}, {
|
|
166
|
+
result: string;
|
|
167
|
+
}>;
|
|
168
|
+
/**
|
|
169
|
+
* Web search allows models to access up-to-date information from the internet
|
|
170
|
+
* and provide answers with sourced citations.
|
|
171
|
+
*
|
|
172
|
+
* Must have name `web_search_preview`.
|
|
173
|
+
*
|
|
174
|
+
* @param searchContextSize - The search context size to use for the web search.
|
|
175
|
+
* @param userLocation - The user location to use for the web search.
|
|
176
|
+
*
|
|
177
|
+
* @deprecated Use `webSearch` instead.
|
|
178
|
+
*/
|
|
179
|
+
webSearchPreview: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
|
|
180
|
+
searchContextSize?: "low" | "medium" | "high";
|
|
181
|
+
userLocation?: {
|
|
182
|
+
type: "approximate";
|
|
183
|
+
country?: string;
|
|
184
|
+
city?: string;
|
|
185
|
+
region?: string;
|
|
186
|
+
timezone?: string;
|
|
187
|
+
};
|
|
188
|
+
}>;
|
|
189
|
+
/**
|
|
190
|
+
* Web search allows models to access up-to-date information from the internet
|
|
191
|
+
* and provide answers with sourced citations.
|
|
192
|
+
*
|
|
193
|
+
* Must have name `web_search`.
|
|
194
|
+
*
|
|
195
|
+
* @param filters - The filters to use for the web search.
|
|
196
|
+
* @param searchContextSize - The search context size to use for the web search.
|
|
197
|
+
* @param userLocation - The user location to use for the web search.
|
|
198
|
+
*/
|
|
199
|
+
webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, unknown>;
|
|
26
200
|
};
|
|
27
201
|
|
|
28
202
|
interface AihubmixProvider extends ProviderV2 {
|