@ai-sdk/perplexity 5.0.2 → 5.0.4
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/CHANGELOG.md +18 -0
- package/dist/index.d.ts +161 -156
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1075 -1339
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/perplexity-provider.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @ai-sdk/perplexity
|
|
2
2
|
|
|
3
|
+
## 5.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- dabd5fa: Add Perplexity integration attribution to provider requests.
|
|
8
|
+
- ede5b89: chore: migrate package builds from tsup to tsdown
|
|
9
|
+
- Updated dependencies [ede5b89]
|
|
10
|
+
- @ai-sdk/provider@4.0.20
|
|
11
|
+
- @ai-sdk/provider-utils@5.0.52
|
|
12
|
+
|
|
13
|
+
## 5.0.3
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- c2511c1: fix: use standards-compliant User-Agent header
|
|
18
|
+
- Updated dependencies [c2511c1]
|
|
19
|
+
- @ai-sdk/provider-utils@5.0.51
|
|
20
|
+
|
|
3
21
|
## 5.0.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,170 +1,175 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FetchFunction } from
|
|
3
|
-
import { z } from
|
|
4
|
-
|
|
1
|
+
import { EmbeddingModelV4, LanguageModelV4, ProviderV4 } from "@ai-sdk/provider";
|
|
2
|
+
import { FetchFunction } from "@ai-sdk/provider-utils";
|
|
3
|
+
import { z } from "zod/v4";
|
|
4
|
+
//#region src/perplexity-embedding-model-options.d.ts
|
|
5
5
|
type PerplexityEmbeddingModelId = 'pplx-embed-v1-0.6b' | 'pplx-embed-v1-4b' | (string & {});
|
|
6
6
|
declare const perplexityEmbeddingModelOptions: z.ZodObject<{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
dimensions: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
encodingFormat: z.ZodOptional<z.ZodEnum<{
|
|
9
|
+
base64_int8: "base64_int8";
|
|
10
|
+
base64_binary: "base64_binary";
|
|
11
|
+
}>>;
|
|
12
12
|
}, z.core.$strip>;
|
|
13
13
|
type PerplexityEmbeddingModelOptions = z.infer<typeof perplexityEmbeddingModelOptions>;
|
|
14
|
-
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/perplexity-options.d.ts
|
|
15
16
|
type PerplexityAgentPreset = 'fast' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
16
17
|
type PerplexityLanguageModelId = PerplexityAgentPreset | 'perplexity/sonar' | (string & {});
|
|
17
|
-
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/perplexity-provider.d.ts
|
|
18
20
|
interface PerplexityProvider extends ProviderV4 {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Creates a Perplexity Agent API model or preset for text generation.
|
|
23
|
+
*/
|
|
24
|
+
(modelId: PerplexityLanguageModelId): LanguageModelV4;
|
|
25
|
+
/**
|
|
26
|
+
* Creates a Perplexity Agent API model or preset for text generation.
|
|
27
|
+
*/
|
|
28
|
+
languageModel(modelId: PerplexityLanguageModelId): LanguageModelV4;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a Perplexity model for text embeddings.
|
|
31
|
+
*/
|
|
32
|
+
embedding(modelId: PerplexityEmbeddingModelId): EmbeddingModelV4;
|
|
33
|
+
/**
|
|
34
|
+
* Creates a Perplexity model for text embeddings.
|
|
35
|
+
*/
|
|
36
|
+
embeddingModel(modelId: PerplexityEmbeddingModelId): EmbeddingModelV4;
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Use `embeddingModel` instead.
|
|
39
|
+
*/
|
|
40
|
+
textEmbeddingModel(modelId: PerplexityEmbeddingModelId): EmbeddingModelV4;
|
|
39
41
|
}
|
|
40
42
|
interface PerplexityProviderSettings {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Base URL for Perplexity API calls.
|
|
45
|
+
*/
|
|
46
|
+
baseURL?: string;
|
|
47
|
+
/**
|
|
48
|
+
* API key for authenticating requests.
|
|
49
|
+
*/
|
|
50
|
+
apiKey?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Custom headers to include in the requests.
|
|
53
|
+
*/
|
|
54
|
+
headers?: Record<string, string>;
|
|
55
|
+
/**
|
|
56
|
+
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
57
|
+
* or to provide a custom fetch implementation for e.g. testing.
|
|
58
|
+
*/
|
|
59
|
+
fetch?: FetchFunction;
|
|
58
60
|
}
|
|
59
|
-
declare function createPerplexity(options?: PerplexityProviderSettings): PerplexityProvider;
|
|
60
|
-
declare const perplexity: PerplexityProvider;
|
|
61
|
-
|
|
61
|
+
export declare function createPerplexity(options?: PerplexityProviderSettings): PerplexityProvider;
|
|
62
|
+
export declare const perplexity: PerplexityProvider;
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/perplexity-language-model-options.d.ts
|
|
62
65
|
declare const perplexityLanguageModelOptions: z.ZodObject<{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}, z.core.$loose>>;
|
|
100
|
-
}, z.core.$loose>, z.ZodObject<{
|
|
101
|
-
type: z.ZodLiteral<"fetch_url">;
|
|
102
|
-
max_urls: z.ZodOptional<z.ZodNumber>;
|
|
103
|
-
}, z.core.$loose>, z.ZodObject<{
|
|
104
|
-
type: z.ZodLiteral<"people_search">;
|
|
105
|
-
}, z.core.$loose>, z.ZodObject<{
|
|
106
|
-
type: z.ZodLiteral<"finance_search">;
|
|
107
|
-
}, z.core.$loose>, z.ZodObject<{
|
|
108
|
-
type: z.ZodLiteral<"sandbox">;
|
|
109
|
-
}, z.core.$loose>, z.ZodObject<{
|
|
110
|
-
type: z.ZodLiteral<"mcp">;
|
|
111
|
-
server_label: z.ZodString;
|
|
112
|
-
server_url: z.ZodString;
|
|
113
|
-
allowed_tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
114
|
-
authorization: z.ZodOptional<z.ZodString>;
|
|
115
|
-
defer_loading: z.ZodOptional<z.ZodBoolean>;
|
|
116
|
-
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
117
|
-
}, z.core.$loose>, z.ZodObject<{
|
|
118
|
-
type: z.ZodLiteral<"connector">;
|
|
119
|
-
id: z.ZodString;
|
|
120
|
-
server_label: z.ZodString;
|
|
121
|
-
server_description: z.ZodOptional<z.ZodString>;
|
|
122
|
-
allowed_tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
123
|
-
}, z.core.$loose>]>>>;
|
|
124
|
-
/** A fallback model list for Agent API routing. */
|
|
125
|
-
models: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
126
|
-
/** Maximum number of agentic steps. */
|
|
127
|
-
max_steps: z.ZodOptional<z.ZodNumber>;
|
|
128
|
-
/** Maximum number of native tool calls. */
|
|
129
|
-
max_tool_calls: z.ZodOptional<z.ZodNumber>;
|
|
130
|
-
/** Continue a conversation from an earlier Agent API response. */
|
|
131
|
-
previous_response_id: z.ZodOptional<z.ZodString>;
|
|
132
|
-
/**
|
|
133
|
-
* Whether the response can be retrieved later. Setting this to false does
|
|
134
|
-
* not disable persistence or prevent previous_response_id continuations.
|
|
135
|
-
*/
|
|
136
|
-
store: z.ZodOptional<z.ZodBoolean>;
|
|
137
|
-
/** Preferred response language as an ISO 639-1 language code. */
|
|
138
|
-
language_preference: z.ZodOptional<z.ZodString>;
|
|
139
|
-
/** Agent API reasoning configuration. */
|
|
140
|
-
reasoning: z.ZodOptional<z.ZodObject<{
|
|
141
|
-
effort: z.ZodOptional<z.ZodEnum<{
|
|
142
|
-
low: "low";
|
|
143
|
-
medium: "medium";
|
|
144
|
-
high: "high";
|
|
145
|
-
minimal: "minimal";
|
|
146
|
-
xhigh: "xhigh";
|
|
147
|
-
}>>;
|
|
66
|
+
/** Top-level Agent API instructions. */
|
|
67
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
68
|
+
/**
|
|
69
|
+
* Native Agent API tools. AI SDK function tools can also be supplied through
|
|
70
|
+
* the top-level `tools` option on `generateText` and `streamText`.
|
|
71
|
+
*/
|
|
72
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
73
|
+
type: z.ZodLiteral<"web_search">;
|
|
74
|
+
filters: z.ZodOptional<z.ZodObject<{
|
|
75
|
+
search_domain_filter: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
76
|
+
search_recency_filter: z.ZodOptional<z.ZodEnum<{
|
|
77
|
+
hour: "hour";
|
|
78
|
+
day: "day";
|
|
79
|
+
week: "week";
|
|
80
|
+
month: "month";
|
|
81
|
+
year: "year";
|
|
82
|
+
}>>;
|
|
83
|
+
search_after_date_filter: z.ZodOptional<z.ZodString>;
|
|
84
|
+
search_before_date_filter: z.ZodOptional<z.ZodString>;
|
|
85
|
+
last_updated_after_filter: z.ZodOptional<z.ZodString>;
|
|
86
|
+
last_updated_before_filter: z.ZodOptional<z.ZodString>;
|
|
87
|
+
}, z.core.$loose>>;
|
|
88
|
+
max_results: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
max_tokens: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
max_tokens_per_page: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
search_context_size: z.ZodOptional<z.ZodEnum<{
|
|
92
|
+
low: "low";
|
|
93
|
+
medium: "medium";
|
|
94
|
+
high: "high";
|
|
95
|
+
}>>;
|
|
96
|
+
user_location: z.ZodOptional<z.ZodObject<{
|
|
97
|
+
latitude: z.ZodOptional<z.ZodNumber>;
|
|
98
|
+
longitude: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
country: z.ZodOptional<z.ZodString>;
|
|
100
|
+
city: z.ZodOptional<z.ZodString>;
|
|
101
|
+
region: z.ZodOptional<z.ZodString>;
|
|
148
102
|
}, z.core.$loose>>;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
103
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
104
|
+
type: z.ZodLiteral<"fetch_url">;
|
|
105
|
+
max_urls: z.ZodOptional<z.ZodNumber>;
|
|
106
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
107
|
+
type: z.ZodLiteral<"people_search">;
|
|
108
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
109
|
+
type: z.ZodLiteral<"finance_search">;
|
|
110
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
111
|
+
type: z.ZodLiteral<"sandbox">;
|
|
112
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
113
|
+
type: z.ZodLiteral<"mcp">;
|
|
114
|
+
server_label: z.ZodString;
|
|
115
|
+
server_url: z.ZodString;
|
|
116
|
+
allowed_tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
117
|
+
authorization: z.ZodOptional<z.ZodString>;
|
|
118
|
+
defer_loading: z.ZodOptional<z.ZodBoolean>;
|
|
119
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
120
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
121
|
+
type: z.ZodLiteral<"connector">;
|
|
122
|
+
id: z.ZodString;
|
|
123
|
+
server_label: z.ZodString;
|
|
124
|
+
server_description: z.ZodOptional<z.ZodString>;
|
|
125
|
+
allowed_tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
126
|
+
}, z.core.$loose>]>>>;
|
|
127
|
+
/** A fallback model list for Agent API routing. */
|
|
128
|
+
models: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
129
|
+
/** Maximum number of agentic steps. */
|
|
130
|
+
max_steps: z.ZodOptional<z.ZodNumber>;
|
|
131
|
+
/** Maximum number of native tool calls. */
|
|
132
|
+
max_tool_calls: z.ZodOptional<z.ZodNumber>;
|
|
133
|
+
/** Continue a conversation from an earlier Agent API response. */
|
|
134
|
+
previous_response_id: z.ZodOptional<z.ZodString>;
|
|
135
|
+
/**
|
|
136
|
+
* Whether the response can be retrieved later. Setting this to false does
|
|
137
|
+
* not disable persistence or prevent previous_response_id continuations.
|
|
138
|
+
*/
|
|
139
|
+
store: z.ZodOptional<z.ZodBoolean>;
|
|
140
|
+
/** Preferred response language as an ISO 639-1 language code. */
|
|
141
|
+
language_preference: z.ZodOptional<z.ZodString>;
|
|
142
|
+
/** Agent API reasoning configuration. */
|
|
143
|
+
reasoning: z.ZodOptional<z.ZodObject<{
|
|
144
|
+
effort: z.ZodOptional<z.ZodEnum<{
|
|
145
|
+
low: "low";
|
|
146
|
+
medium: "medium";
|
|
147
|
+
high: "high";
|
|
148
|
+
minimal: "minimal";
|
|
149
|
+
xhigh: "xhigh";
|
|
150
|
+
}>>;
|
|
151
|
+
}, z.core.$loose>>;
|
|
152
|
+
/** Agent API skill configuration. */
|
|
153
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
154
|
+
type: z.ZodLiteral<"builtin">;
|
|
155
|
+
name: z.ZodEnum<{
|
|
156
|
+
office: "office";
|
|
157
|
+
"office/docx": "office/docx";
|
|
158
|
+
"office/pdf": "office/pdf";
|
|
159
|
+
"office/pptx": "office/pptx";
|
|
160
|
+
"office/xlsx": "office/xlsx";
|
|
161
|
+
}>;
|
|
162
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
163
|
+
type: z.ZodLiteral<"inline">;
|
|
164
|
+
name: z.ZodString;
|
|
165
|
+
description: z.ZodString;
|
|
166
|
+
instructions: z.ZodString;
|
|
167
|
+
}, z.core.$loose>]>>>;
|
|
165
168
|
}, z.core.$loose>;
|
|
166
169
|
type PerplexityLanguageModelOptions = z.infer<typeof perplexityLanguageModelOptions>;
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/version.d.ts
|
|
172
|
+
export declare const VERSION: string;
|
|
173
|
+
//#endregion
|
|
174
|
+
export type { PerplexityAgentPreset, PerplexityEmbeddingModelId, PerplexityEmbeddingModelOptions, PerplexityLanguageModelId, PerplexityLanguageModelOptions, PerplexityProvider, PerplexityProviderSettings };
|
|
175
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/perplexity-embedding-model-options.ts","../src/perplexity-options.ts","../src/perplexity-provider.ts","../src/perplexity-language-model-options.ts","../src/version.ts"],"mappings":";;;;KAGY;cAKC,iCAA+B,EAAA;;;;;;GAe1C,EAAA,KAAA;KAEU,kCAAkC,EAAE,aACvC;;;KC1BG;KAOA,4BACR;;;UCWa,2BAA2B;;;;GAIzC,SAAS,4BAA4B;;;;EAKtC,cAAc,SAAS,4BAA4B;;;;EAKnD,UAAU,SAAS,6BAA6B;;;;EAKhD,eAAe,SAAS,6BAA6B;;;;EAKrD,mBAAmB,SAAS,6BAA6B;;UAG1C;;;;EAIf;;;;EAKA;;;;EAKA,UAAU;;;;;EAMV,QAAQ;;wBAGM,iBACd,UAAS,6BACR;qBAoDU,YAAU;;;cCjEV,gCAA8B,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DzC,EAAA,KAAA;KAEU,iCAAiC,EAAE,aACtC;;;qBCxHI"}
|