@ai-sdk/perplexity 2.1.3 → 2.1.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 +9 -0
- package/dist/index.d.mts +82 -107
- package/dist/index.d.ts +82 -107
- package/dist/index.js +140 -123
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +131 -108
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -28,11 +28,11 @@ module.exports = __toCommonJS(index_exports);
|
|
|
28
28
|
|
|
29
29
|
// src/perplexity-provider.ts
|
|
30
30
|
var import_provider3 = require("@ai-sdk/provider");
|
|
31
|
-
var
|
|
31
|
+
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
32
32
|
|
|
33
33
|
// src/perplexity-language-model.ts
|
|
34
34
|
var import_provider2 = require("@ai-sdk/provider");
|
|
35
|
-
var
|
|
35
|
+
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
36
36
|
|
|
37
37
|
// src/convert-perplexity-usage.ts
|
|
38
38
|
function convertPerplexityUsage(usage) {
|
|
@@ -232,8 +232,9 @@ function mapPerplexityFinishReason({
|
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
// src/perplexity-agent-api.ts
|
|
235
|
+
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
235
236
|
var import_v4 = require("zod/v4");
|
|
236
|
-
var perplexitySearchResultSchema = import_v4.z.looseObject({
|
|
237
|
+
var perplexitySearchResultSchema = () => import_v4.z.looseObject({
|
|
237
238
|
id: import_v4.z.number().optional(),
|
|
238
239
|
title: import_v4.z.string(),
|
|
239
240
|
url: import_v4.z.string(),
|
|
@@ -242,12 +243,12 @@ var perplexitySearchResultSchema = import_v4.z.looseObject({
|
|
|
242
243
|
last_updated: import_v4.z.string().nullish(),
|
|
243
244
|
source: import_v4.z.string().optional()
|
|
244
245
|
});
|
|
245
|
-
var perplexityFetchedContentSchema = import_v4.z.looseObject({
|
|
246
|
+
var perplexityFetchedContentSchema = () => import_v4.z.looseObject({
|
|
246
247
|
title: import_v4.z.string(),
|
|
247
248
|
url: import_v4.z.string(),
|
|
248
249
|
snippet: import_v4.z.string().optional()
|
|
249
250
|
});
|
|
250
|
-
var perplexityContentPartSchema = import_v4.z.looseObject({
|
|
251
|
+
var perplexityContentPartSchema = () => import_v4.z.looseObject({
|
|
251
252
|
type: import_v4.z.string(),
|
|
252
253
|
text: import_v4.z.string().optional(),
|
|
253
254
|
annotations: import_v4.z.array(
|
|
@@ -264,19 +265,19 @@ var handledOutputTypes = [
|
|
|
264
265
|
"fetch_url_results",
|
|
265
266
|
"function_call"
|
|
266
267
|
];
|
|
267
|
-
var perplexityOutputItemSchema = import_v4.z.union([
|
|
268
|
+
var perplexityOutputItemSchema = () => import_v4.z.union([
|
|
268
269
|
import_v4.z.looseObject({
|
|
269
270
|
type: import_v4.z.literal("message"),
|
|
270
271
|
id: import_v4.z.string().nullish(),
|
|
271
|
-
content: import_v4.z.array(perplexityContentPartSchema).nullish()
|
|
272
|
+
content: import_v4.z.array(perplexityContentPartSchema()).nullish()
|
|
272
273
|
}),
|
|
273
274
|
import_v4.z.looseObject({
|
|
274
275
|
type: import_v4.z.literal("search_results"),
|
|
275
|
-
results: import_v4.z.array(perplexitySearchResultSchema).nullish()
|
|
276
|
+
results: import_v4.z.array(perplexitySearchResultSchema()).nullish()
|
|
276
277
|
}),
|
|
277
278
|
import_v4.z.looseObject({
|
|
278
279
|
type: import_v4.z.literal("fetch_url_results"),
|
|
279
|
-
contents: import_v4.z.array(perplexityFetchedContentSchema).nullish()
|
|
280
|
+
contents: import_v4.z.array(perplexityFetchedContentSchema()).nullish()
|
|
280
281
|
}),
|
|
281
282
|
import_v4.z.looseObject({
|
|
282
283
|
type: import_v4.z.literal("function_call"),
|
|
@@ -293,7 +294,7 @@ var perplexityOutputItemSchema = import_v4.z.union([
|
|
|
293
294
|
type: import_v4.z.string().refine((type) => !handledOutputTypes.includes(type))
|
|
294
295
|
}).transform(() => ({ type: "unhandled" }))
|
|
295
296
|
]);
|
|
296
|
-
var perplexityCostSchema = import_v4.z.looseObject({
|
|
297
|
+
var perplexityCostSchema = () => import_v4.z.looseObject({
|
|
297
298
|
currency: import_v4.z.string().optional(),
|
|
298
299
|
input_cost: import_v4.z.number().optional(),
|
|
299
300
|
output_cost: import_v4.z.number().optional(),
|
|
@@ -302,7 +303,7 @@ var perplexityCostSchema = import_v4.z.looseObject({
|
|
|
302
303
|
cache_read_cost: import_v4.z.number().nullish(),
|
|
303
304
|
tool_calls_cost: import_v4.z.number().nullish()
|
|
304
305
|
});
|
|
305
|
-
var perplexityUsageSchema = import_v4.z.looseObject({
|
|
306
|
+
var perplexityUsageSchema = () => import_v4.z.looseObject({
|
|
306
307
|
input_tokens: import_v4.z.number(),
|
|
307
308
|
output_tokens: import_v4.z.number(),
|
|
308
309
|
total_tokens: import_v4.z.number(),
|
|
@@ -320,14 +321,14 @@ var perplexityUsageSchema = import_v4.z.looseObject({
|
|
|
320
321
|
invocation: import_v4.z.number().optional()
|
|
321
322
|
})
|
|
322
323
|
).nullish(),
|
|
323
|
-
cost: perplexityCostSchema.nullish()
|
|
324
|
+
cost: perplexityCostSchema().nullish()
|
|
324
325
|
});
|
|
325
|
-
var perplexityAgentResponseSchema = import_v4.z.looseObject({
|
|
326
|
+
var perplexityAgentResponseSchema = () => import_v4.z.looseObject({
|
|
326
327
|
id: import_v4.z.string(),
|
|
327
328
|
created_at: import_v4.z.number(),
|
|
328
329
|
model: import_v4.z.string(),
|
|
329
330
|
object: import_v4.z.literal("response"),
|
|
330
|
-
output: import_v4.z.array(perplexityOutputItemSchema),
|
|
331
|
+
output: import_v4.z.array(perplexityOutputItemSchema()),
|
|
331
332
|
status: import_v4.z.string(),
|
|
332
333
|
incomplete_details: import_v4.z.looseObject({
|
|
333
334
|
reason: import_v4.z.string()
|
|
@@ -337,48 +338,59 @@ var perplexityAgentResponseSchema = import_v4.z.looseObject({
|
|
|
337
338
|
message: import_v4.z.string(),
|
|
338
339
|
type: import_v4.z.string().optional()
|
|
339
340
|
}).nullish(),
|
|
340
|
-
usage: perplexityUsageSchema.nullish()
|
|
341
|
+
usage: perplexityUsageSchema().nullish()
|
|
341
342
|
});
|
|
342
|
-
var
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
output_index: import_v4.z.number().nullish(),
|
|
348
|
-
item_id: import_v4.z.string().nullish(),
|
|
349
|
-
content_index: import_v4.z.number().nullish(),
|
|
350
|
-
delta: import_v4.z.string().nullish(),
|
|
351
|
-
text: import_v4.z.string().nullish(),
|
|
352
|
-
thought: import_v4.z.string().nullish(),
|
|
353
|
-
queries: import_v4.z.array(import_v4.z.string()).nullish(),
|
|
354
|
-
urls: import_v4.z.array(import_v4.z.string()).nullish(),
|
|
355
|
-
results: import_v4.z.array(perplexitySearchResultSchema).nullish(),
|
|
356
|
-
contents: import_v4.z.array(perplexityFetchedContentSchema).nullish(),
|
|
357
|
-
error: import_v4.z.looseObject({
|
|
358
|
-
code: import_v4.z.string().nullish(),
|
|
359
|
-
message: import_v4.z.string(),
|
|
360
|
-
type: import_v4.z.string().nullish()
|
|
361
|
-
}).nullish()
|
|
362
|
-
});
|
|
363
|
-
var perplexityErrorSchema = import_v4.z.looseObject({
|
|
364
|
-
error: import_v4.z.union([
|
|
365
|
-
import_v4.z.string(),
|
|
343
|
+
var perplexityAgentResponseSchemaValidator = (0, import_provider_utils2.lazySchema)(
|
|
344
|
+
() => (0, import_provider_utils2.zodSchema)(perplexityAgentResponseSchema())
|
|
345
|
+
);
|
|
346
|
+
var perplexityAgentChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
347
|
+
() => (0, import_provider_utils2.zodSchema)(
|
|
366
348
|
import_v4.z.looseObject({
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
349
|
+
type: import_v4.z.string(),
|
|
350
|
+
sequence_number: import_v4.z.number().nullish(),
|
|
351
|
+
response: perplexityAgentResponseSchema().nullish(),
|
|
352
|
+
item: perplexityOutputItemSchema().nullish(),
|
|
353
|
+
output_index: import_v4.z.number().nullish(),
|
|
354
|
+
item_id: import_v4.z.string().nullish(),
|
|
355
|
+
content_index: import_v4.z.number().nullish(),
|
|
356
|
+
delta: import_v4.z.string().nullish(),
|
|
357
|
+
text: import_v4.z.string().nullish(),
|
|
358
|
+
thought: import_v4.z.string().nullish(),
|
|
359
|
+
queries: import_v4.z.array(import_v4.z.string()).nullish(),
|
|
360
|
+
urls: import_v4.z.array(import_v4.z.string()).nullish(),
|
|
361
|
+
results: import_v4.z.array(perplexitySearchResultSchema()).nullish(),
|
|
362
|
+
contents: import_v4.z.array(perplexityFetchedContentSchema()).nullish(),
|
|
363
|
+
error: import_v4.z.looseObject({
|
|
364
|
+
code: import_v4.z.string().nullish(),
|
|
365
|
+
message: import_v4.z.string(),
|
|
366
|
+
type: import_v4.z.string().nullish()
|
|
367
|
+
}).nullish()
|
|
370
368
|
})
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
369
|
+
)
|
|
370
|
+
);
|
|
371
|
+
var perplexityErrorSchema = (0, import_provider_utils2.lazySchema)(
|
|
372
|
+
() => (0, import_provider_utils2.zodSchema)(
|
|
373
|
+
import_v4.z.looseObject({
|
|
374
|
+
error: import_v4.z.union([
|
|
375
|
+
import_v4.z.string(),
|
|
376
|
+
import_v4.z.looseObject({
|
|
377
|
+
code: import_v4.z.union([import_v4.z.string(), import_v4.z.number()]).optional(),
|
|
378
|
+
message: import_v4.z.string().nullish(),
|
|
379
|
+
type: import_v4.z.string().nullish()
|
|
380
|
+
})
|
|
381
|
+
]).optional(),
|
|
382
|
+
detail: import_v4.z.union([
|
|
383
|
+
import_v4.z.string(),
|
|
384
|
+
import_v4.z.array(
|
|
385
|
+
import_v4.z.looseObject({
|
|
386
|
+
msg: import_v4.z.string()
|
|
387
|
+
})
|
|
388
|
+
)
|
|
389
|
+
]).optional(),
|
|
390
|
+
message: import_v4.z.string().optional()
|
|
391
|
+
})
|
|
392
|
+
)
|
|
393
|
+
);
|
|
382
394
|
function perplexityErrorToMessage(data) {
|
|
383
395
|
var _a, _b, _c;
|
|
384
396
|
if (typeof data.error === "string") {
|
|
@@ -397,15 +409,16 @@ function perplexityErrorToMessage(data) {
|
|
|
397
409
|
}
|
|
398
410
|
|
|
399
411
|
// src/perplexity-language-model-options.ts
|
|
412
|
+
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
400
413
|
var import_v42 = require("zod/v4");
|
|
401
|
-
var userLocationSchema = import_v42.z.looseObject({
|
|
414
|
+
var userLocationSchema = () => import_v42.z.looseObject({
|
|
402
415
|
latitude: import_v42.z.number().optional(),
|
|
403
416
|
longitude: import_v42.z.number().optional(),
|
|
404
417
|
country: import_v42.z.string().optional(),
|
|
405
418
|
city: import_v42.z.string().optional(),
|
|
406
419
|
region: import_v42.z.string().optional()
|
|
407
420
|
});
|
|
408
|
-
var webSearchFiltersSchema = import_v42.z.looseObject({
|
|
421
|
+
var webSearchFiltersSchema = () => import_v42.z.looseObject({
|
|
409
422
|
search_domain_filter: import_v42.z.array(import_v42.z.string()).optional(),
|
|
410
423
|
search_recency_filter: import_v42.z.enum(["hour", "day", "week", "month", "year"]).optional(),
|
|
411
424
|
search_after_date_filter: import_v42.z.string().optional(),
|
|
@@ -413,17 +426,17 @@ var webSearchFiltersSchema = import_v42.z.looseObject({
|
|
|
413
426
|
last_updated_after_filter: import_v42.z.string().optional(),
|
|
414
427
|
last_updated_before_filter: import_v42.z.string().optional()
|
|
415
428
|
});
|
|
416
|
-
var webSearchToolSchema = import_v42.z.looseObject({
|
|
429
|
+
var webSearchToolSchema = () => import_v42.z.looseObject({
|
|
417
430
|
type: import_v42.z.literal("web_search"),
|
|
418
|
-
filters: webSearchFiltersSchema.optional(),
|
|
431
|
+
filters: webSearchFiltersSchema().optional(),
|
|
419
432
|
max_results: import_v42.z.number().int().positive().optional(),
|
|
420
433
|
max_tokens: import_v42.z.number().optional(),
|
|
421
434
|
max_tokens_per_page: import_v42.z.number().optional(),
|
|
422
435
|
search_context_size: import_v42.z.enum(["low", "medium", "high"]).optional(),
|
|
423
|
-
user_location: userLocationSchema.optional()
|
|
436
|
+
user_location: userLocationSchema().optional()
|
|
424
437
|
});
|
|
425
|
-
var nativeToolSchema = import_v42.z.union([
|
|
426
|
-
webSearchToolSchema,
|
|
438
|
+
var nativeToolSchema = () => import_v42.z.union([
|
|
439
|
+
webSearchToolSchema(),
|
|
427
440
|
import_v42.z.looseObject({
|
|
428
441
|
type: import_v42.z.literal("fetch_url"),
|
|
429
442
|
max_urls: import_v42.z.number().optional()
|
|
@@ -448,55 +461,59 @@ var nativeToolSchema = import_v42.z.union([
|
|
|
448
461
|
allowed_tools: import_v42.z.array(import_v42.z.string()).optional()
|
|
449
462
|
})
|
|
450
463
|
]);
|
|
451
|
-
var perplexityLanguageModelOptions =
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
import_v42.z.
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
464
|
+
var perplexityLanguageModelOptions = (0, import_provider_utils3.lazySchema)(
|
|
465
|
+
() => (0, import_provider_utils3.zodSchema)(
|
|
466
|
+
import_v42.z.looseObject({
|
|
467
|
+
/** Top-level Agent API instructions. */
|
|
468
|
+
instructions: import_v42.z.string().optional(),
|
|
469
|
+
/**
|
|
470
|
+
* Native Agent API tools. AI SDK function tools can also be supplied through
|
|
471
|
+
* the top-level `tools` option on `generateText` and `streamText`.
|
|
472
|
+
*/
|
|
473
|
+
tools: import_v42.z.array(nativeToolSchema()).optional(),
|
|
474
|
+
/** A fallback model list for Agent API routing. */
|
|
475
|
+
models: import_v42.z.array(import_v42.z.string()).optional(),
|
|
476
|
+
/** Maximum number of agentic steps. */
|
|
477
|
+
max_steps: import_v42.z.number().int().positive().optional(),
|
|
478
|
+
/** Maximum number of native tool calls. */
|
|
479
|
+
max_tool_calls: import_v42.z.number().int().nonnegative().optional(),
|
|
480
|
+
/** Continue a conversation from an earlier Agent API response. */
|
|
481
|
+
previous_response_id: import_v42.z.string().optional(),
|
|
482
|
+
/**
|
|
483
|
+
* Whether the response can be retrieved later. Setting this to false does
|
|
484
|
+
* not disable persistence or prevent previous_response_id continuations.
|
|
485
|
+
*/
|
|
486
|
+
store: import_v42.z.boolean().optional(),
|
|
487
|
+
/** Preferred response language as an ISO 639-1 language code. */
|
|
488
|
+
language_preference: import_v42.z.string().optional(),
|
|
489
|
+
/** Agent API reasoning configuration. */
|
|
490
|
+
reasoning: import_v42.z.looseObject({
|
|
491
|
+
effort: import_v42.z.enum(["minimal", "low", "medium", "high", "xhigh"]).optional()
|
|
492
|
+
}).optional(),
|
|
493
|
+
/** Agent API skill configuration. */
|
|
494
|
+
skills: import_v42.z.array(
|
|
495
|
+
import_v42.z.union([
|
|
496
|
+
import_v42.z.looseObject({
|
|
497
|
+
type: import_v42.z.literal("builtin"),
|
|
498
|
+
name: import_v42.z.enum([
|
|
499
|
+
"office",
|
|
500
|
+
"office/docx",
|
|
501
|
+
"office/pdf",
|
|
502
|
+
"office/pptx",
|
|
503
|
+
"office/xlsx"
|
|
504
|
+
])
|
|
505
|
+
}),
|
|
506
|
+
import_v42.z.looseObject({
|
|
507
|
+
type: import_v42.z.literal("inline"),
|
|
508
|
+
name: import_v42.z.string(),
|
|
509
|
+
description: import_v42.z.string(),
|
|
510
|
+
instructions: import_v42.z.string()
|
|
511
|
+
})
|
|
489
512
|
])
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
description: import_v42.z.string(),
|
|
495
|
-
instructions: import_v42.z.string()
|
|
496
|
-
})
|
|
497
|
-
])
|
|
498
|
-
).optional()
|
|
499
|
-
});
|
|
513
|
+
).optional()
|
|
514
|
+
})
|
|
515
|
+
)
|
|
516
|
+
);
|
|
500
517
|
|
|
501
518
|
// src/perplexity-prepare-tools.ts
|
|
502
519
|
function preparePerplexityTools({
|
|
@@ -645,7 +662,7 @@ var PerplexityLanguageModel = class {
|
|
|
645
662
|
}) {
|
|
646
663
|
var _a, _b;
|
|
647
664
|
const warnings = [];
|
|
648
|
-
const perplexityOptions = (_a = await (0,
|
|
665
|
+
const perplexityOptions = (_a = await (0, import_provider_utils4.parseProviderOptions)({
|
|
649
666
|
provider: "perplexity",
|
|
650
667
|
providerOptions,
|
|
651
668
|
schema: perplexityLanguageModelOptions
|
|
@@ -716,16 +733,16 @@ var PerplexityLanguageModel = class {
|
|
|
716
733
|
responseHeaders,
|
|
717
734
|
value: response,
|
|
718
735
|
rawValue: rawResponse
|
|
719
|
-
} = await (0,
|
|
736
|
+
} = await (0, import_provider_utils4.postJsonToApi)({
|
|
720
737
|
url,
|
|
721
|
-
headers: (0,
|
|
738
|
+
headers: (0, import_provider_utils4.combineHeaders)((_b = (_a = this.config).headers) == null ? void 0 : _b.call(_a), options.headers),
|
|
722
739
|
body,
|
|
723
|
-
failedResponseHandler: (0,
|
|
740
|
+
failedResponseHandler: (0, import_provider_utils4.createJsonErrorResponseHandler)({
|
|
724
741
|
errorSchema: perplexityErrorSchema,
|
|
725
742
|
errorToMessage: perplexityErrorToMessage
|
|
726
743
|
}),
|
|
727
|
-
successfulResponseHandler: (0,
|
|
728
|
-
|
|
744
|
+
successfulResponseHandler: (0, import_provider_utils4.createJsonResponseHandler)(
|
|
745
|
+
perplexityAgentResponseSchemaValidator
|
|
729
746
|
),
|
|
730
747
|
abortSignal: options.abortSignal,
|
|
731
748
|
fetch: this.config.fetch
|
|
@@ -828,15 +845,15 @@ var PerplexityLanguageModel = class {
|
|
|
828
845
|
var _a, _b;
|
|
829
846
|
const { args, warnings } = await this.getArgs(options);
|
|
830
847
|
const body = { ...args, stream: true };
|
|
831
|
-
const { responseHeaders, value: response } = await (0,
|
|
848
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils4.postJsonToApi)({
|
|
832
849
|
url: `${this.config.baseURL}/v1/agent`,
|
|
833
|
-
headers: (0,
|
|
850
|
+
headers: (0, import_provider_utils4.combineHeaders)((_b = (_a = this.config).headers) == null ? void 0 : _b.call(_a), options.headers),
|
|
834
851
|
body,
|
|
835
|
-
failedResponseHandler: (0,
|
|
852
|
+
failedResponseHandler: (0, import_provider_utils4.createJsonErrorResponseHandler)({
|
|
836
853
|
errorSchema: perplexityErrorSchema,
|
|
837
854
|
errorToMessage: perplexityErrorToMessage
|
|
838
855
|
}),
|
|
839
|
-
successfulResponseHandler: (0,
|
|
856
|
+
successfulResponseHandler: (0, import_provider_utils4.createEventSourceResponseHandler)(
|
|
840
857
|
perplexityAgentChunkSchema
|
|
841
858
|
),
|
|
842
859
|
abortSignal: options.abortSignal,
|
|
@@ -1168,13 +1185,13 @@ var PerplexityLanguageModel = class {
|
|
|
1168
1185
|
};
|
|
1169
1186
|
|
|
1170
1187
|
// src/version.ts
|
|
1171
|
-
var VERSION = true ? "2.1.
|
|
1188
|
+
var VERSION = true ? "2.1.4" : "0.0.0-test";
|
|
1172
1189
|
|
|
1173
1190
|
// src/perplexity-provider.ts
|
|
1174
1191
|
function createPerplexity(options = {}) {
|
|
1175
|
-
const getHeaders = () => (0,
|
|
1192
|
+
const getHeaders = () => (0, import_provider_utils5.withUserAgentSuffix)(
|
|
1176
1193
|
{
|
|
1177
|
-
Authorization: `Bearer ${(0,
|
|
1194
|
+
Authorization: `Bearer ${(0, import_provider_utils5.loadApiKey)({
|
|
1178
1195
|
apiKey: options.apiKey,
|
|
1179
1196
|
environmentVariableName: "PERPLEXITY_API_KEY",
|
|
1180
1197
|
description: "Perplexity"
|
|
@@ -1187,11 +1204,11 @@ function createPerplexity(options = {}) {
|
|
|
1187
1204
|
const createLanguageModel = (modelId) => {
|
|
1188
1205
|
var _a;
|
|
1189
1206
|
return new PerplexityLanguageModel(modelId, {
|
|
1190
|
-
baseURL: (0,
|
|
1207
|
+
baseURL: (0, import_provider_utils5.withoutTrailingSlash)(
|
|
1191
1208
|
(_a = options.baseURL) != null ? _a : "https://api.perplexity.ai"
|
|
1192
1209
|
),
|
|
1193
1210
|
headers: getHeaders,
|
|
1194
|
-
generateId:
|
|
1211
|
+
generateId: import_provider_utils5.generateId,
|
|
1195
1212
|
fetch: options.fetch
|
|
1196
1213
|
});
|
|
1197
1214
|
};
|