@keystrokehq/perplexityai 0.1.0 → 0.1.3
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/action.cjs.map +1 -1
- package/dist/action.mjs.map +1 -1
- package/dist/actions/create-async-chat-completion.cjs +5 -5
- package/dist/actions/create-async-chat-completion.cjs.map +1 -1
- package/dist/actions/create-async-chat-completion.d.cts +91 -3
- package/dist/actions/create-async-chat-completion.d.cts.map +1 -1
- package/dist/actions/create-async-chat-completion.d.mts +91 -3
- package/dist/actions/create-async-chat-completion.d.mts.map +1 -1
- package/dist/actions/create-async-chat-completion.mjs +5 -5
- package/dist/actions/create-async-chat-completion.mjs.map +1 -1
- package/dist/actions/create-chat-completion.cjs +20 -20
- package/dist/actions/create-chat-completion.cjs.map +1 -1
- package/dist/actions/create-chat-completion.d.cts +148 -3
- package/dist/actions/create-chat-completion.d.cts.map +1 -1
- package/dist/actions/create-chat-completion.d.mts +148 -3
- package/dist/actions/create-chat-completion.d.mts.map +1 -1
- package/dist/actions/create-chat-completion.mjs +20 -20
- package/dist/actions/create-chat-completion.mjs.map +1 -1
- package/dist/actions/create-contextualized-embeddings.cjs +13 -13
- package/dist/actions/create-contextualized-embeddings.cjs.map +1 -1
- package/dist/actions/create-contextualized-embeddings.d.cts +35 -3
- package/dist/actions/create-contextualized-embeddings.d.cts.map +1 -1
- package/dist/actions/create-contextualized-embeddings.d.mts +35 -3
- package/dist/actions/create-contextualized-embeddings.d.mts.map +1 -1
- package/dist/actions/create-contextualized-embeddings.mjs +13 -13
- package/dist/actions/create-contextualized-embeddings.mjs.map +1 -1
- package/dist/actions/create-embeddings.cjs +14 -14
- package/dist/actions/create-embeddings.cjs.map +1 -1
- package/dist/actions/create-embeddings.d.cts +36 -3
- package/dist/actions/create-embeddings.d.cts.map +1 -1
- package/dist/actions/create-embeddings.d.mts +36 -3
- package/dist/actions/create-embeddings.d.mts.map +1 -1
- package/dist/actions/create-embeddings.mjs +14 -14
- package/dist/actions/create-embeddings.mjs.map +1 -1
- package/dist/actions/execute-agent.cjs +8 -8
- package/dist/actions/execute-agent.cjs.map +1 -1
- package/dist/actions/execute-agent.d.cts +103 -3
- package/dist/actions/execute-agent.d.cts.map +1 -1
- package/dist/actions/execute-agent.d.mts +103 -3
- package/dist/actions/execute-agent.d.mts.map +1 -1
- package/dist/actions/execute-agent.mjs +8 -8
- package/dist/actions/execute-agent.mjs.map +1 -1
- package/dist/actions/get-async-chat-completion.cjs +4 -4
- package/dist/actions/get-async-chat-completion.cjs.map +1 -1
- package/dist/actions/get-async-chat-completion.d.cts +22 -3
- package/dist/actions/get-async-chat-completion.d.cts.map +1 -1
- package/dist/actions/get-async-chat-completion.d.mts +22 -3
- package/dist/actions/get-async-chat-completion.d.mts.map +1 -1
- package/dist/actions/get-async-chat-completion.mjs +4 -4
- package/dist/actions/get-async-chat-completion.mjs.map +1 -1
- package/dist/actions/list-async-chat-completions.cjs +5 -5
- package/dist/actions/list-async-chat-completions.cjs.map +1 -1
- package/dist/actions/list-async-chat-completions.d.cts +19 -3
- package/dist/actions/list-async-chat-completions.d.cts.map +1 -1
- package/dist/actions/list-async-chat-completions.d.mts +19 -3
- package/dist/actions/list-async-chat-completions.d.mts.map +1 -1
- package/dist/actions/list-async-chat-completions.mjs +5 -5
- package/dist/actions/list-async-chat-completions.mjs.map +1 -1
- package/dist/actions/list-models.cjs +7 -7
- package/dist/actions/list-models.cjs.map +1 -1
- package/dist/actions/list-models.d.cts +11 -3
- package/dist/actions/list-models.d.cts.map +1 -1
- package/dist/actions/list-models.d.mts +11 -3
- package/dist/actions/list-models.d.mts.map +1 -1
- package/dist/actions/list-models.mjs +7 -7
- package/dist/actions/list-models.mjs.map +1 -1
- package/dist/actions/search.cjs +5 -5
- package/dist/actions/search.cjs.map +1 -1
- package/dist/actions/search.d.cts +45 -3
- package/dist/actions/search.d.cts.map +1 -1
- package/dist/actions/search.d.mts +45 -3
- package/dist/actions/search.d.mts.map +1 -1
- package/dist/actions/search.mjs +5 -5
- package/dist/actions/search.mjs.map +1 -1
- package/dist/catalog.cjs +7 -1
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +8 -0
- package/dist/catalog.d.mts +8 -0
- package/dist/catalog.mjs +7 -1
- package/dist/catalog.mjs.map +1 -1
- package/package.json +2 -2
package/dist/action.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.cjs","names":["perplexityai","executePerplexityaiTool"],"sources":["../src/action.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { perplexityai } from \"./app\";\nimport { executePerplexityaiTool } from \"./execute\";\n\n/** Bind one gateway tool to a typed app action; the call's output is parsed against `def.output`. */\nexport function action(\n tool: string,\n def: {\n slug: string;\n name: string;\n description: string;\n input:
|
|
1
|
+
{"version":3,"file":"action.cjs","names":["perplexityai","executePerplexityaiTool"],"sources":["../src/action.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { perplexityai } from \"./app\";\nimport { executePerplexityaiTool } from \"./execute\";\n\n/** Bind one gateway tool to a typed app action; the call's output is parsed against `def.output`. */\nexport function action<TInput extends z.ZodType>(\n tool: string,\n def: {\n slug: string;\n name: string;\n description: string;\n input: TInput;\n output: z.ZodType;\n },\n) {\n return perplexityai.action({\n slug: def.slug,\n name: def.name,\n description: def.description,\n input: def.input,\n output: def.output as z.ZodTypeAny,\n async run(input) {\n return def.output.parse(await executePerplexityaiTool(tool, input as Record<string, unknown>));\n },\n });\n}\n"],"mappings":";;;;;AAMA,SAAgB,OACd,MACA,KAOA;CACA,OAAOA,YAAAA,aAAa,OAAO;EACzB,MAAM,IAAI;EACV,MAAM,IAAI;EACV,aAAa,IAAI;EACjB,OAAO,IAAI;EACX,QAAQ,IAAI;EACZ,MAAM,IAAI,OAAO;GACf,OAAO,IAAI,OAAO,MAAM,MAAMC,gBAAAA,wBAAwB,MAAM,KAAgC,CAAC;EAC/F;CACF,CAAC;AACH"}
|
package/dist/action.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.mjs","names":[],"sources":["../src/action.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { perplexityai } from \"./app\";\nimport { executePerplexityaiTool } from \"./execute\";\n\n/** Bind one gateway tool to a typed app action; the call's output is parsed against `def.output`. */\nexport function action(\n tool: string,\n def: {\n slug: string;\n name: string;\n description: string;\n input:
|
|
1
|
+
{"version":3,"file":"action.mjs","names":[],"sources":["../src/action.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { perplexityai } from \"./app\";\nimport { executePerplexityaiTool } from \"./execute\";\n\n/** Bind one gateway tool to a typed app action; the call's output is parsed against `def.output`. */\nexport function action<TInput extends z.ZodType>(\n tool: string,\n def: {\n slug: string;\n name: string;\n description: string;\n input: TInput;\n output: z.ZodType;\n },\n) {\n return perplexityai.action({\n slug: def.slug,\n name: def.name,\n description: def.description,\n input: def.input,\n output: def.output as z.ZodTypeAny,\n async run(input) {\n return def.output.parse(await executePerplexityaiTool(tool, input as Record<string, unknown>));\n },\n });\n}\n"],"mappings":";;;;;AAMA,SAAgB,OACd,MACA,KAOA;CACA,OAAO,aAAa,OAAO;EACzB,MAAM,IAAI;EACV,MAAM,IAAI;EACV,aAAa,IAAI;EACjB,OAAO,IAAI;EACX,QAAQ,IAAI;EACZ,MAAM,IAAI,OAAO;GACf,OAAO,IAAI,OAAO,MAAM,MAAM,wBAAwB,MAAM,KAAgC,CAAC;EAC/F;CACF,CAAC;AACH"}
|
|
@@ -20,7 +20,7 @@ const PerplexityaiCreateAsyncChatCompletionInput = zod.z.object({
|
|
|
20
20
|
"tool"
|
|
21
21
|
]).describe("Role of the message sender (system, user, assistant, or tool)"),
|
|
22
22
|
content: zod.z.string().describe("Content of the message")
|
|
23
|
-
}).describe("A message in the conversation.")).describe("Array of messages comprising the conversation."),
|
|
23
|
+
}).passthrough().describe("A message in the conversation.")).describe("Array of messages comprising the conversation."),
|
|
24
24
|
max_tokens: zod.z.number().int().describe("Maximum number of tokens to generate. Max 128000.").optional(),
|
|
25
25
|
search_mode: zod.z.string().describe("Search mode: 'web', 'academic', 'sec'.").optional(),
|
|
26
26
|
stream_mode: zod.z.string().describe("Stream mode: 'full' or 'concise'.").optional(),
|
|
@@ -50,16 +50,16 @@ const PerplexityaiCreateAsyncChatCompletion_AsyncProcessingStatusSchema = zod.z.
|
|
|
50
50
|
"FAILED"
|
|
51
51
|
]).describe("Status of the async processing job.");
|
|
52
52
|
const PerplexityaiCreateAsyncChatCompletionOutput = zod.z.object({
|
|
53
|
-
id: zod.z.string().describe("Unique identifier for the async request"),
|
|
54
|
-
model: zod.z.string().describe("Model used for the request"),
|
|
53
|
+
id: zod.z.string().describe("Unique identifier for the async request").nullable(),
|
|
54
|
+
model: zod.z.string().describe("Model used for the request").nullable(),
|
|
55
55
|
status: PerplexityaiCreateAsyncChatCompletion_AsyncProcessingStatusSchema.nullable(),
|
|
56
56
|
response: zod.z.record(zod.z.string(), zod.z.unknown()).describe("The completion response when status is COMPLETED").nullable().optional(),
|
|
57
57
|
failed_at: zod.z.number().int().describe("Unix timestamp when processing failed").nullable().optional(),
|
|
58
|
-
created_at: zod.z.number().int().describe("Unix timestamp when the request was created"),
|
|
58
|
+
created_at: zod.z.number().int().describe("Unix timestamp when the request was created").nullable(),
|
|
59
59
|
started_at: zod.z.number().int().describe("Unix timestamp when processing started").nullable().optional(),
|
|
60
60
|
completed_at: zod.z.number().int().describe("Unix timestamp when processing completed").nullable().optional(),
|
|
61
61
|
error_message: zod.z.string().describe("Error message if the job failed").nullable().optional()
|
|
62
|
-
}).describe("Response model for async chat completion creation.");
|
|
62
|
+
}).passthrough().describe("Response model for async chat completion creation.");
|
|
63
63
|
const perplexityaiCreateAsyncChatCompletion = require_action.action("PERPLEXITYAI_CREATE_ASYNC_CHAT_COMPLETION", {
|
|
64
64
|
slug: "perplexityai-create-async-chat-completion",
|
|
65
65
|
name: "Create Async Chat Completion",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-async-chat-completion.cjs","names":["z","action"],"sources":["../../src/actions/create-async-chat-completion.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { action } from \"../action\";\n\nexport const PerplexityaiCreateAsyncChatCompletionInput
|
|
1
|
+
{"version":3,"file":"create-async-chat-completion.cjs","names":["z","action"],"sources":["../../src/actions/create-async-chat-completion.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { action } from \"../action\";\n\nexport const PerplexityaiCreateAsyncChatCompletionInput = z.object({\n request: z.object({\n stop: z.union([z.string(), z.array(z.string())]).optional(),\n model: z.enum([\"sonar\", \"sonar-pro\", \"sonar-deep-research\", \"sonar-reasoning-pro\"]).describe(\"The Sonar model to use. Currently only 'sonar-deep-research' is supported for async processing. Other models will be rejected.\"),\n top_p: z.number().describe(\"Nucleus sampling threshold.\").optional(),\n stream: z.boolean().describe(\"Whether to stream the response.\").optional(),\n messages: z.array(z.object({\n role: z.enum([\"system\", \"user\", \"assistant\", \"tool\"]).describe(\"Role of the message sender (system, user, assistant, or tool)\"),\n content: z.string().describe(\"Content of the message\"),\n}).passthrough().describe(\"A message in the conversation.\")).describe(\"Array of messages comprising the conversation.\"),\n max_tokens: z.number().int().describe(\"Maximum number of tokens to generate. Max 128000.\").optional(),\n search_mode: z.string().describe(\"Search mode: 'web', 'academic', 'sec'.\").optional(),\n stream_mode: z.string().describe(\"Stream mode: 'full' or 'concise'.\").optional(),\n temperature: z.number().describe(\"Controls randomness. 0 is deterministic, up to 2 is more random.\").optional(),\n return_images: z.boolean().describe(\"Whether to include images in the response.\").optional(),\n disable_search: z.boolean().describe(\"Whether to disable web search.\").optional(),\n reasoning_effort: z.string().describe(\"Reasoning effort: 'minimal', 'low', 'medium', 'high'.\").optional(),\n image_domain_filter: z.array(z.string()).describe(\"Filter images by source domain.\").optional(),\n image_format_filter: z.array(z.string()).describe(\"Filter images by format (e.g. 'png', 'jpg').\").optional(),\n language_preference: z.string().describe(\"Preferred response language as ISO 639-1 code.\").optional(),\n search_domain_filter: z.array(z.string()).describe(\"Domains to restrict search results to.\").optional(),\n search_recency_filter: z.string().describe(\"Filter by recency: 'hour', 'day', 'week', 'month', 'year'.\").optional(),\n search_language_filter: z.array(z.string()).describe(\"ISO 639-1 language codes to filter results.\").optional(),\n enable_search_classifier: z.boolean().describe(\"Whether to enable the search classifier.\").optional(),\n return_related_questions: z.boolean().describe(\"Whether to return related questions.\").optional(),\n search_after_date_filter: z.string().describe(\"Only include results after this date (MM/DD/YYYY).\").optional(),\n last_updated_after_filter: z.string().describe(\"Only include results last updated after this date (MM/DD/YYYY).\").optional(),\n search_before_date_filter: z.string().describe(\"Only include results before this date (MM/DD/YYYY).\").optional(),\n last_updated_before_filter: z.string().describe(\"Only include results last updated before this date (MM/DD/YYYY).\").optional(),\n}).describe(\"The chat completion request to run asynchronously.\"),\n idempotency_key: z.string().describe(\"Optional key to prevent duplicate requests. Deduplication requires the exact same request body.\").optional(),\n}).describe(\"Request model for creating an async chat completion.\");\nconst PerplexityaiCreateAsyncChatCompletion_AsyncProcessingStatusSchema = z.enum([\"CREATED\", \"IN_PROGRESS\", \"COMPLETED\", \"FAILED\"]).describe(\"Status of the async processing job.\");\nexport const PerplexityaiCreateAsyncChatCompletionOutput = z.object({\n id: z.string().describe(\"Unique identifier for the async request\").nullable(),\n model: z.string().describe(\"Model used for the request\").nullable(),\n status: PerplexityaiCreateAsyncChatCompletion_AsyncProcessingStatusSchema.nullable(),\n response: z.record(z.string(), z.unknown()).describe(\"The completion response when status is COMPLETED\").nullable().optional(),\n failed_at: z.number().int().describe(\"Unix timestamp when processing failed\").nullable().optional(),\n created_at: z.number().int().describe(\"Unix timestamp when the request was created\").nullable(),\n started_at: z.number().int().describe(\"Unix timestamp when processing started\").nullable().optional(),\n completed_at: z.number().int().describe(\"Unix timestamp when processing completed\").nullable().optional(),\n error_message: z.string().describe(\"Error message if the job failed\").nullable().optional(),\n}).passthrough().describe(\"Response model for async chat completion creation.\");\n\nexport const perplexityaiCreateAsyncChatCompletion = action(\"PERPLEXITYAI_CREATE_ASYNC_CHAT_COMPLETION\", {\n slug: \"perplexityai-create-async-chat-completion\",\n name: \"Create Async Chat Completion\",\n description: \"Create Async Chat Completion (POST /v1/async/sonar). Submits an asynchronous chat completion request for long-running tasks. Returns immediately with a request ID that can be polled using the Get Async Chat Completion action. Only the 'sonar-deep-research' model is supported for async processing. Async jobs have a 7-day TTL. Deep research generates very long responses (10K-100K+ words) with exhaustive multi-source analysis. Use the idempotency_key to prevent duplicate submissions. Poll with Get Async Chat Completion using the returned request ID to retrieve results when status is COMPLETED.\",\n input: PerplexityaiCreateAsyncChatCompletionInput,\n output: PerplexityaiCreateAsyncChatCompletionOutput,\n});\n"],"mappings":";;;AAIA,MAAa,6CAA6CA,IAAAA,EAAE,OAAO;CACjE,SAASA,IAAAA,EAAE,OAAO;EAClB,MAAMA,IAAAA,EAAE,MAAM,CAACA,IAAAA,EAAE,OAAO,GAAGA,IAAAA,EAAE,MAAMA,IAAAA,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;EAC1D,OAAOA,IAAAA,EAAE,KAAK;GAAC;GAAS;GAAa;GAAuB;EAAqB,CAAC,CAAC,CAAC,SAAS,gIAAgI;EAC7N,OAAOA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS,6BAA6B,CAAC,CAAC,SAAS;EACnE,QAAQA,IAAAA,EAAE,QAAQ,CAAC,CAAC,SAAS,iCAAiC,CAAC,CAAC,SAAS;EACzE,UAAUA,IAAAA,EAAE,MAAMA,IAAAA,EAAE,OAAO;GAC3B,MAAMA,IAAAA,EAAE,KAAK;IAAC;IAAU;IAAQ;IAAa;GAAM,CAAC,CAAC,CAAC,SAAS,+DAA+D;GAC9H,SAASA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS,wBAAwB;EACvD,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,gCAAgC,CAAC,CAAC,CAAC,SAAS,gDAAgD;E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CAAC,CAAC,SAAS;CAC9F,YAAYA,IAAAA,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,wCAAwC,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CACpG,cAAcA,IAAAA,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,0CAA0C,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CACxG,eAAeA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS,iCAAiC,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;AAC5F,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,oDAAoD;AAE9E,MAAa,wCAAwCC,eAAAA,OAAO,6CAA6C;CACvG,MAAM;CACN,MAAM;CACN,aAAa;CACb,OAAO;CACP,QAAQ;AACV,CAAC"}
|
|
@@ -1,9 +1,97 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
3
|
//#region src/actions/create-async-chat-completion.d.ts
|
|
4
|
-
declare const PerplexityaiCreateAsyncChatCompletionInput: z.
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
declare const PerplexityaiCreateAsyncChatCompletionInput: z.ZodObject<{
|
|
5
|
+
request: z.ZodObject<{
|
|
6
|
+
stop: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
7
|
+
model: z.ZodEnum<{
|
|
8
|
+
sonar: "sonar";
|
|
9
|
+
"sonar-pro": "sonar-pro";
|
|
10
|
+
"sonar-deep-research": "sonar-deep-research";
|
|
11
|
+
"sonar-reasoning-pro": "sonar-reasoning-pro";
|
|
12
|
+
}>;
|
|
13
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
stream: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
16
|
+
role: z.ZodEnum<{
|
|
17
|
+
system: "system";
|
|
18
|
+
user: "user";
|
|
19
|
+
assistant: "assistant";
|
|
20
|
+
tool: "tool";
|
|
21
|
+
}>;
|
|
22
|
+
content: z.ZodString;
|
|
23
|
+
}, z.core.$loose>>;
|
|
24
|
+
max_tokens: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
search_mode: z.ZodOptional<z.ZodString>;
|
|
26
|
+
stream_mode: z.ZodOptional<z.ZodString>;
|
|
27
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
return_images: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
disable_search: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
reasoning_effort: z.ZodOptional<z.ZodString>;
|
|
31
|
+
image_domain_filter: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
32
|
+
image_format_filter: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
33
|
+
language_preference: z.ZodOptional<z.ZodString>;
|
|
34
|
+
search_domain_filter: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
|
+
search_recency_filter: z.ZodOptional<z.ZodString>;
|
|
36
|
+
search_language_filter: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
37
|
+
enable_search_classifier: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
+
return_related_questions: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
+
search_after_date_filter: z.ZodOptional<z.ZodString>;
|
|
40
|
+
last_updated_after_filter: z.ZodOptional<z.ZodString>;
|
|
41
|
+
search_before_date_filter: z.ZodOptional<z.ZodString>;
|
|
42
|
+
last_updated_before_filter: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
declare const PerplexityaiCreateAsyncChatCompletionOutput: z.ZodObject<{
|
|
47
|
+
id: z.ZodNullable<z.ZodString>;
|
|
48
|
+
model: z.ZodNullable<z.ZodString>;
|
|
49
|
+
status: z.ZodNullable<z.ZodEnum<{
|
|
50
|
+
CREATED: "CREATED";
|
|
51
|
+
IN_PROGRESS: "IN_PROGRESS";
|
|
52
|
+
COMPLETED: "COMPLETED";
|
|
53
|
+
FAILED: "FAILED";
|
|
54
|
+
}>>;
|
|
55
|
+
response: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
56
|
+
failed_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
57
|
+
created_at: z.ZodNullable<z.ZodNumber>;
|
|
58
|
+
started_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
59
|
+
completed_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
60
|
+
error_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
61
|
+
}, z.core.$loose>;
|
|
62
|
+
declare const perplexityaiCreateAsyncChatCompletion: import("@keystrokehq/action").WorkflowActionDefinition<{
|
|
63
|
+
request: {
|
|
64
|
+
model: "sonar" | "sonar-pro" | "sonar-deep-research" | "sonar-reasoning-pro";
|
|
65
|
+
messages: {
|
|
66
|
+
[x: string]: unknown;
|
|
67
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
68
|
+
content: string;
|
|
69
|
+
}[];
|
|
70
|
+
stop?: string | string[] | undefined;
|
|
71
|
+
top_p?: number | undefined;
|
|
72
|
+
stream?: boolean | undefined;
|
|
73
|
+
max_tokens?: number | undefined;
|
|
74
|
+
search_mode?: string | undefined;
|
|
75
|
+
stream_mode?: string | undefined;
|
|
76
|
+
temperature?: number | undefined;
|
|
77
|
+
return_images?: boolean | undefined;
|
|
78
|
+
disable_search?: boolean | undefined;
|
|
79
|
+
reasoning_effort?: string | undefined;
|
|
80
|
+
image_domain_filter?: string[] | undefined;
|
|
81
|
+
image_format_filter?: string[] | undefined;
|
|
82
|
+
language_preference?: string | undefined;
|
|
83
|
+
search_domain_filter?: string[] | undefined;
|
|
84
|
+
search_recency_filter?: string | undefined;
|
|
85
|
+
search_language_filter?: string[] | undefined;
|
|
86
|
+
enable_search_classifier?: boolean | undefined;
|
|
87
|
+
return_related_questions?: boolean | undefined;
|
|
88
|
+
search_after_date_filter?: string | undefined;
|
|
89
|
+
last_updated_after_filter?: string | undefined;
|
|
90
|
+
search_before_date_filter?: string | undefined;
|
|
91
|
+
last_updated_before_filter?: string | undefined;
|
|
92
|
+
};
|
|
93
|
+
idempotency_key?: string | undefined;
|
|
94
|
+
}, unknown, import("@keystrokehq/shared").ResolvedCredentials<readonly [import("@keystrokehq/shared").Credential]>, readonly [import("@keystrokehq/shared").Credential]>;
|
|
7
95
|
//#endregion
|
|
8
96
|
export { perplexityaiCreateAsyncChatCompletion };
|
|
9
97
|
//# sourceMappingURL=create-async-chat-completion.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-async-chat-completion.d.cts","names":[],"sources":["../../src/actions/create-async-chat-completion.ts"],"mappings":";;;cAIa,0CAAA,
|
|
1
|
+
{"version":3,"file":"create-async-chat-completion.d.cts","names":[],"sources":["../../src/actions/create-async-chat-completion.ts"],"mappings":";;;cAIa,0CAAA,EAA0C,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAiC1C,2CAAA,EAA2C,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;cAY3C,qCAAA,gCAAqC,wBAAA"}
|
|
@@ -1,9 +1,97 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
3
|
//#region src/actions/create-async-chat-completion.d.ts
|
|
4
|
-
declare const PerplexityaiCreateAsyncChatCompletionInput: z.
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
declare const PerplexityaiCreateAsyncChatCompletionInput: z.ZodObject<{
|
|
5
|
+
request: z.ZodObject<{
|
|
6
|
+
stop: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
7
|
+
model: z.ZodEnum<{
|
|
8
|
+
sonar: "sonar";
|
|
9
|
+
"sonar-pro": "sonar-pro";
|
|
10
|
+
"sonar-deep-research": "sonar-deep-research";
|
|
11
|
+
"sonar-reasoning-pro": "sonar-reasoning-pro";
|
|
12
|
+
}>;
|
|
13
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
stream: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
16
|
+
role: z.ZodEnum<{
|
|
17
|
+
system: "system";
|
|
18
|
+
user: "user";
|
|
19
|
+
assistant: "assistant";
|
|
20
|
+
tool: "tool";
|
|
21
|
+
}>;
|
|
22
|
+
content: z.ZodString;
|
|
23
|
+
}, z.core.$loose>>;
|
|
24
|
+
max_tokens: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
search_mode: z.ZodOptional<z.ZodString>;
|
|
26
|
+
stream_mode: z.ZodOptional<z.ZodString>;
|
|
27
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
return_images: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
disable_search: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
reasoning_effort: z.ZodOptional<z.ZodString>;
|
|
31
|
+
image_domain_filter: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
32
|
+
image_format_filter: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
33
|
+
language_preference: z.ZodOptional<z.ZodString>;
|
|
34
|
+
search_domain_filter: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
|
+
search_recency_filter: z.ZodOptional<z.ZodString>;
|
|
36
|
+
search_language_filter: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
37
|
+
enable_search_classifier: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
+
return_related_questions: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
+
search_after_date_filter: z.ZodOptional<z.ZodString>;
|
|
40
|
+
last_updated_after_filter: z.ZodOptional<z.ZodString>;
|
|
41
|
+
search_before_date_filter: z.ZodOptional<z.ZodString>;
|
|
42
|
+
last_updated_before_filter: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
declare const PerplexityaiCreateAsyncChatCompletionOutput: z.ZodObject<{
|
|
47
|
+
id: z.ZodNullable<z.ZodString>;
|
|
48
|
+
model: z.ZodNullable<z.ZodString>;
|
|
49
|
+
status: z.ZodNullable<z.ZodEnum<{
|
|
50
|
+
CREATED: "CREATED";
|
|
51
|
+
IN_PROGRESS: "IN_PROGRESS";
|
|
52
|
+
COMPLETED: "COMPLETED";
|
|
53
|
+
FAILED: "FAILED";
|
|
54
|
+
}>>;
|
|
55
|
+
response: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
56
|
+
failed_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
57
|
+
created_at: z.ZodNullable<z.ZodNumber>;
|
|
58
|
+
started_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
59
|
+
completed_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
60
|
+
error_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
61
|
+
}, z.core.$loose>;
|
|
62
|
+
declare const perplexityaiCreateAsyncChatCompletion: import("@keystrokehq/action").WorkflowActionDefinition<{
|
|
63
|
+
request: {
|
|
64
|
+
model: "sonar" | "sonar-pro" | "sonar-deep-research" | "sonar-reasoning-pro";
|
|
65
|
+
messages: {
|
|
66
|
+
[x: string]: unknown;
|
|
67
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
68
|
+
content: string;
|
|
69
|
+
}[];
|
|
70
|
+
stop?: string | string[] | undefined;
|
|
71
|
+
top_p?: number | undefined;
|
|
72
|
+
stream?: boolean | undefined;
|
|
73
|
+
max_tokens?: number | undefined;
|
|
74
|
+
search_mode?: string | undefined;
|
|
75
|
+
stream_mode?: string | undefined;
|
|
76
|
+
temperature?: number | undefined;
|
|
77
|
+
return_images?: boolean | undefined;
|
|
78
|
+
disable_search?: boolean | undefined;
|
|
79
|
+
reasoning_effort?: string | undefined;
|
|
80
|
+
image_domain_filter?: string[] | undefined;
|
|
81
|
+
image_format_filter?: string[] | undefined;
|
|
82
|
+
language_preference?: string | undefined;
|
|
83
|
+
search_domain_filter?: string[] | undefined;
|
|
84
|
+
search_recency_filter?: string | undefined;
|
|
85
|
+
search_language_filter?: string[] | undefined;
|
|
86
|
+
enable_search_classifier?: boolean | undefined;
|
|
87
|
+
return_related_questions?: boolean | undefined;
|
|
88
|
+
search_after_date_filter?: string | undefined;
|
|
89
|
+
last_updated_after_filter?: string | undefined;
|
|
90
|
+
search_before_date_filter?: string | undefined;
|
|
91
|
+
last_updated_before_filter?: string | undefined;
|
|
92
|
+
};
|
|
93
|
+
idempotency_key?: string | undefined;
|
|
94
|
+
}, unknown, import("@keystrokehq/shared").ResolvedCredentials<readonly [import("@keystrokehq/shared").Credential]>, readonly [import("@keystrokehq/shared").Credential]>;
|
|
7
95
|
//#endregion
|
|
8
96
|
export { perplexityaiCreateAsyncChatCompletion };
|
|
9
97
|
//# sourceMappingURL=create-async-chat-completion.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-async-chat-completion.d.mts","names":[],"sources":["../../src/actions/create-async-chat-completion.ts"],"mappings":";;;cAIa,0CAAA,
|
|
1
|
+
{"version":3,"file":"create-async-chat-completion.d.mts","names":[],"sources":["../../src/actions/create-async-chat-completion.ts"],"mappings":";;;cAIa,0CAAA,EAA0C,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAiC1C,2CAAA,EAA2C,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;cAY3C,qCAAA,gCAAqC,wBAAA"}
|
|
@@ -20,7 +20,7 @@ const PerplexityaiCreateAsyncChatCompletionInput = z.object({
|
|
|
20
20
|
"tool"
|
|
21
21
|
]).describe("Role of the message sender (system, user, assistant, or tool)"),
|
|
22
22
|
content: z.string().describe("Content of the message")
|
|
23
|
-
}).describe("A message in the conversation.")).describe("Array of messages comprising the conversation."),
|
|
23
|
+
}).passthrough().describe("A message in the conversation.")).describe("Array of messages comprising the conversation."),
|
|
24
24
|
max_tokens: z.number().int().describe("Maximum number of tokens to generate. Max 128000.").optional(),
|
|
25
25
|
search_mode: z.string().describe("Search mode: 'web', 'academic', 'sec'.").optional(),
|
|
26
26
|
stream_mode: z.string().describe("Stream mode: 'full' or 'concise'.").optional(),
|
|
@@ -55,16 +55,16 @@ const perplexityaiCreateAsyncChatCompletion = action("PERPLEXITYAI_CREATE_ASYNC_
|
|
|
55
55
|
description: "Create Async Chat Completion (POST /v1/async/sonar). Submits an asynchronous chat completion request for long-running tasks. Returns immediately with a request ID that can be polled using the Get Async Chat Completion action. Only the 'sonar-deep-research' model is supported for async processing. Async jobs have a 7-day TTL. Deep research generates very long responses (10K-100K+ words) with exhaustive multi-source analysis. Use the idempotency_key to prevent duplicate submissions. Poll with Get Async Chat Completion using the returned request ID to retrieve results when status is COMPLETED.",
|
|
56
56
|
input: PerplexityaiCreateAsyncChatCompletionInput,
|
|
57
57
|
output: z.object({
|
|
58
|
-
id: z.string().describe("Unique identifier for the async request"),
|
|
59
|
-
model: z.string().describe("Model used for the request"),
|
|
58
|
+
id: z.string().describe("Unique identifier for the async request").nullable(),
|
|
59
|
+
model: z.string().describe("Model used for the request").nullable(),
|
|
60
60
|
status: PerplexityaiCreateAsyncChatCompletion_AsyncProcessingStatusSchema.nullable(),
|
|
61
61
|
response: z.record(z.string(), z.unknown()).describe("The completion response when status is COMPLETED").nullable().optional(),
|
|
62
62
|
failed_at: z.number().int().describe("Unix timestamp when processing failed").nullable().optional(),
|
|
63
|
-
created_at: z.number().int().describe("Unix timestamp when the request was created"),
|
|
63
|
+
created_at: z.number().int().describe("Unix timestamp when the request was created").nullable(),
|
|
64
64
|
started_at: z.number().int().describe("Unix timestamp when processing started").nullable().optional(),
|
|
65
65
|
completed_at: z.number().int().describe("Unix timestamp when processing completed").nullable().optional(),
|
|
66
66
|
error_message: z.string().describe("Error message if the job failed").nullable().optional()
|
|
67
|
-
}).describe("Response model for async chat completion creation.")
|
|
67
|
+
}).passthrough().describe("Response model for async chat completion creation.")
|
|
68
68
|
});
|
|
69
69
|
//#endregion
|
|
70
70
|
export { perplexityaiCreateAsyncChatCompletion };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-async-chat-completion.mjs","names":[],"sources":["../../src/actions/create-async-chat-completion.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { action } from \"../action\";\n\nexport const PerplexityaiCreateAsyncChatCompletionInput
|
|
1
|
+
{"version":3,"file":"create-async-chat-completion.mjs","names":[],"sources":["../../src/actions/create-async-chat-completion.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { action } from \"../action\";\n\nexport const PerplexityaiCreateAsyncChatCompletionInput = z.object({\n request: z.object({\n stop: z.union([z.string(), z.array(z.string())]).optional(),\n model: z.enum([\"sonar\", \"sonar-pro\", \"sonar-deep-research\", \"sonar-reasoning-pro\"]).describe(\"The Sonar model to use. Currently only 'sonar-deep-research' is supported for async processing. Other models will be rejected.\"),\n top_p: z.number().describe(\"Nucleus sampling threshold.\").optional(),\n stream: z.boolean().describe(\"Whether to stream the response.\").optional(),\n messages: z.array(z.object({\n role: z.enum([\"system\", \"user\", \"assistant\", \"tool\"]).describe(\"Role of the message sender (system, user, assistant, or tool)\"),\n content: z.string().describe(\"Content of the message\"),\n}).passthrough().describe(\"A message in the conversation.\")).describe(\"Array of messages comprising the conversation.\"),\n max_tokens: z.number().int().describe(\"Maximum number of tokens to generate. Max 128000.\").optional(),\n search_mode: z.string().describe(\"Search mode: 'web', 'academic', 'sec'.\").optional(),\n stream_mode: z.string().describe(\"Stream mode: 'full' or 'concise'.\").optional(),\n temperature: z.number().describe(\"Controls randomness. 0 is deterministic, up to 2 is more random.\").optional(),\n return_images: z.boolean().describe(\"Whether to include images in the response.\").optional(),\n disable_search: z.boolean().describe(\"Whether to disable web search.\").optional(),\n reasoning_effort: z.string().describe(\"Reasoning effort: 'minimal', 'low', 'medium', 'high'.\").optional(),\n image_domain_filter: z.array(z.string()).describe(\"Filter images by source domain.\").optional(),\n image_format_filter: z.array(z.string()).describe(\"Filter images by format (e.g. 'png', 'jpg').\").optional(),\n language_preference: z.string().describe(\"Preferred response language as ISO 639-1 code.\").optional(),\n search_domain_filter: z.array(z.string()).describe(\"Domains to restrict search results to.\").optional(),\n search_recency_filter: z.string().describe(\"Filter by recency: 'hour', 'day', 'week', 'month', 'year'.\").optional(),\n search_language_filter: z.array(z.string()).describe(\"ISO 639-1 language codes to filter results.\").optional(),\n enable_search_classifier: z.boolean().describe(\"Whether to enable the search classifier.\").optional(),\n return_related_questions: z.boolean().describe(\"Whether to return related questions.\").optional(),\n search_after_date_filter: z.string().describe(\"Only include results after this date (MM/DD/YYYY).\").optional(),\n last_updated_after_filter: z.string().describe(\"Only include results last updated after this date (MM/DD/YYYY).\").optional(),\n search_before_date_filter: z.string().describe(\"Only include results before this date (MM/DD/YYYY).\").optional(),\n last_updated_before_filter: z.string().describe(\"Only include results last updated before this date (MM/DD/YYYY).\").optional(),\n}).describe(\"The chat completion request to run asynchronously.\"),\n idempotency_key: z.string().describe(\"Optional key to prevent duplicate requests. Deduplication requires the exact same request body.\").optional(),\n}).describe(\"Request model for creating an async chat completion.\");\nconst PerplexityaiCreateAsyncChatCompletion_AsyncProcessingStatusSchema = z.enum([\"CREATED\", \"IN_PROGRESS\", \"COMPLETED\", \"FAILED\"]).describe(\"Status of the async processing job.\");\nexport const PerplexityaiCreateAsyncChatCompletionOutput = z.object({\n id: z.string().describe(\"Unique identifier for the async request\").nullable(),\n model: z.string().describe(\"Model used for the request\").nullable(),\n status: PerplexityaiCreateAsyncChatCompletion_AsyncProcessingStatusSchema.nullable(),\n response: z.record(z.string(), z.unknown()).describe(\"The completion response when status is COMPLETED\").nullable().optional(),\n failed_at: z.number().int().describe(\"Unix timestamp when processing failed\").nullable().optional(),\n created_at: z.number().int().describe(\"Unix timestamp when the request was created\").nullable(),\n started_at: z.number().int().describe(\"Unix timestamp when processing started\").nullable().optional(),\n completed_at: z.number().int().describe(\"Unix timestamp when processing completed\").nullable().optional(),\n error_message: z.string().describe(\"Error message if the job failed\").nullable().optional(),\n}).passthrough().describe(\"Response model for async chat completion creation.\");\n\nexport const perplexityaiCreateAsyncChatCompletion = action(\"PERPLEXITYAI_CREATE_ASYNC_CHAT_COMPLETION\", {\n slug: \"perplexityai-create-async-chat-completion\",\n name: \"Create Async Chat Completion\",\n description: \"Create Async Chat Completion (POST /v1/async/sonar). Submits an asynchronous chat completion request for long-running tasks. Returns immediately with a request ID that can be polled using the Get Async Chat Completion action. Only the 'sonar-deep-research' model is supported for async processing. Async jobs have a 7-day TTL. Deep research generates very long responses (10K-100K+ words) with exhaustive multi-source analysis. Use the idempotency_key to prevent duplicate submissions. Poll with Get Async Chat Completion using the returned request ID to retrieve results when status is COMPLETED.\",\n input: PerplexityaiCreateAsyncChatCompletionInput,\n output: PerplexityaiCreateAsyncChatCompletionOutput,\n});\n"],"mappings":";;;AAIA,MAAa,6CAA6C,EAAE,OAAO;CACjE,SAAS,EAAE,OAAO;EAClB,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;EAC1D,OAAO,EAAE,KAAK;GAAC;GAAS;GAAa;GAAuB;EAAqB,CAAC,CAAC,CAAC,SAAS,gIAAgI;EAC7N,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS,6BAA6B,CAAC,CAAC,SAAS;EACnE,QAAQ,EAAE,QAAQ,CAAC,CAAC,SAAS,iCAAiC,CAAC,CAAC,SAAS;EACzE,UAAU,EAAE,MAAM,EAAE,OAAO;GAC3B,MAAM,EAAE,KAAK;IAAC;IAAU;IAAQ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EAC9F,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,wCAAwC,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;EACpG,cAAc,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,0CAA0C,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;EACxG,eAAe,EAAE,OAAO,CAAC,CAAC,SAAS,iCAAiC,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CAC5F,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,oDAOhB;AACV,CAAC"}
|
|
@@ -19,7 +19,7 @@ const PerplexityaiCreateChatCompletionInput = zod.z.object({
|
|
|
19
19
|
"tool"
|
|
20
20
|
]).describe("Role of the message sender (system, user, assistant, or tool)"),
|
|
21
21
|
content: zod.z.string().describe("Content of the message")
|
|
22
|
-
}).describe("A message in the conversation.")).describe("A list of messages comprising the conversation. Each message has a role (system, user, assistant, tool) and content. Messages with 'tool' role must alternate with 'assistant' messages. Valid pattern: system -> user -> assistant -> tool -> user."),
|
|
22
|
+
}).passthrough().describe("A message in the conversation.")).describe("A list of messages comprising the conversation. Each message has a role (system, user, assistant, tool) and content. Messages with 'tool' role must alternate with 'assistant' messages. Valid pattern: system -> user -> assistant -> tool -> user."),
|
|
23
23
|
max_tokens: zod.z.number().int().describe("Maximum number of tokens to generate. Max 128000.").optional(),
|
|
24
24
|
search_mode: zod.z.string().describe("Search mode. Options: 'web', 'academic', 'sec'.").optional(),
|
|
25
25
|
stream_mode: zod.z.string().describe("Stream mode: 'full' (default) or 'concise'.").optional(),
|
|
@@ -61,54 +61,54 @@ const PerplexityaiCreateChatCompletion_CostSchema = zod.z.object({
|
|
|
61
61
|
search_queries_cost: zod.z.number().describe("Cost for search queries").nullable().optional(),
|
|
62
62
|
citation_tokens_cost: zod.z.number().describe("Cost for citation tokens").nullable().optional(),
|
|
63
63
|
reasoning_tokens_cost: zod.z.number().describe("Cost for reasoning tokens").nullable().optional()
|
|
64
|
-
}).describe("Cost breakdown for the completion.");
|
|
64
|
+
}).passthrough().describe("Cost breakdown for the completion.");
|
|
65
65
|
const PerplexityaiCreateChatCompletion_UsageInfoSchema = zod.z.object({
|
|
66
66
|
cost: PerplexityaiCreateChatCompletion_CostSchema.nullable().optional(),
|
|
67
|
-
total_tokens: zod.z.number().int().describe("Total number of tokens used"),
|
|
68
|
-
prompt_tokens: zod.z.number().int().describe("Number of tokens in the prompt"),
|
|
67
|
+
total_tokens: zod.z.number().int().describe("Total number of tokens used").nullable(),
|
|
68
|
+
prompt_tokens: zod.z.number().int().describe("Number of tokens in the prompt").nullable(),
|
|
69
69
|
citation_tokens: zod.z.number().int().describe("Tokens used for citations").nullable().optional(),
|
|
70
70
|
reasoning_tokens: zod.z.number().int().describe("Tokens used for reasoning").nullable().optional(),
|
|
71
|
-
completion_tokens: zod.z.number().int().describe("Number of tokens in the completion"),
|
|
71
|
+
completion_tokens: zod.z.number().int().describe("Number of tokens in the completion").nullable(),
|
|
72
72
|
num_search_queries: zod.z.number().int().describe("Number of search queries").nullable().optional(),
|
|
73
73
|
search_context_size: zod.z.string().describe("Search context size used").nullable().optional()
|
|
74
|
-
}).describe("Token usage information.");
|
|
74
|
+
}).passthrough().describe("Token usage information.");
|
|
75
75
|
const PerplexityaiCreateChatCompletion_ImageResultSchema = zod.z.object({
|
|
76
76
|
title: zod.z.string().describe("Title of the image").nullable().optional(),
|
|
77
77
|
width: zod.z.number().int().describe("Image width in pixels").nullable().optional(),
|
|
78
78
|
height: zod.z.number().int().describe("Image height in pixels").nullable().optional(),
|
|
79
|
-
image_url: zod.z.string().describe("URL of the image"),
|
|
80
|
-
origin_url: zod.z.string().describe("URL of the page containing the image")
|
|
81
|
-
}).describe("An image result.");
|
|
79
|
+
image_url: zod.z.string().describe("URL of the image").nullable(),
|
|
80
|
+
origin_url: zod.z.string().describe("URL of the page containing the image").nullable()
|
|
81
|
+
}).passthrough().describe("An image result.");
|
|
82
82
|
const PerplexityaiCreateChatCompletion_ChoiceMessageSchema = zod.z.object({
|
|
83
83
|
role: zod.z.string().describe("Role of the message sender").nullable().optional(),
|
|
84
84
|
content: zod.z.string().describe("Content of the message").nullable().optional()
|
|
85
|
-
}).describe("Message in a completion choice.");
|
|
85
|
+
}).passthrough().describe("Message in a completion choice.");
|
|
86
86
|
const PerplexityaiCreateChatCompletion_ChoiceSchema = zod.z.object({
|
|
87
87
|
delta: PerplexityaiCreateChatCompletion_ChoiceMessageSchema.nullable().optional(),
|
|
88
|
-
index: zod.z.number().int().describe("Index of this choice"),
|
|
88
|
+
index: zod.z.number().int().describe("Index of this choice").nullable(),
|
|
89
89
|
message: PerplexityaiCreateChatCompletion_ChoiceMessageSchema.nullable().optional(),
|
|
90
90
|
finish_reason: zod.z.string().describe("Reason generation stopped: 'stop' or 'length'").nullable().optional()
|
|
91
|
-
}).describe("A completion choice.");
|
|
91
|
+
}).passthrough().describe("A completion choice.");
|
|
92
92
|
const PerplexityaiCreateChatCompletion_SearchResultSchema = zod.z.object({
|
|
93
|
-
url: zod.z.string().describe("URL of the search result"),
|
|
93
|
+
url: zod.z.string().describe("URL of the search result").nullable(),
|
|
94
94
|
date: zod.z.string().describe("Publication date").nullable().optional(),
|
|
95
|
-
title: zod.z.string().describe("Title of the search result"),
|
|
95
|
+
title: zod.z.string().describe("Title of the search result").nullable(),
|
|
96
96
|
source: zod.z.string().describe("Source type: 'web' or 'attachment'").nullable().optional(),
|
|
97
97
|
snippet: zod.z.string().describe("Text snippet").nullable().optional(),
|
|
98
98
|
last_updated: zod.z.string().describe("Last updated date").nullable().optional()
|
|
99
|
-
}).describe("A search result used to ground the response.");
|
|
99
|
+
}).passthrough().describe("A search result used to ground the response.");
|
|
100
100
|
const PerplexityaiCreateChatCompletionOutput = zod.z.object({
|
|
101
|
-
id: zod.z.string().describe("Unique identifier for the completion"),
|
|
102
|
-
model: zod.z.string().describe("Model used for the completion"),
|
|
101
|
+
id: zod.z.string().describe("Unique identifier for the completion").nullable(),
|
|
102
|
+
model: zod.z.string().describe("Model used for the completion").nullable(),
|
|
103
103
|
usage: PerplexityaiCreateChatCompletion_UsageInfoSchema.nullable().optional(),
|
|
104
104
|
images: zod.z.array(PerplexityaiCreateChatCompletion_ImageResultSchema).describe("Image results").nullable().optional(),
|
|
105
|
-
object: zod.z.string().describe("Object type, typically 'chat.completion'"),
|
|
105
|
+
object: zod.z.string().describe("Object type, typically 'chat.completion'").nullable(),
|
|
106
106
|
choices: zod.z.array(PerplexityaiCreateChatCompletion_ChoiceSchema).describe("List of completion choices"),
|
|
107
|
-
created: zod.z.number().int().describe("Unix timestamp when the completion was created"),
|
|
107
|
+
created: zod.z.number().int().describe("Unix timestamp when the completion was created").nullable(),
|
|
108
108
|
citations: zod.z.array(zod.z.string()).describe("Citation URLs").nullable().optional(),
|
|
109
109
|
search_results: zod.z.array(PerplexityaiCreateChatCompletion_SearchResultSchema).describe("Search results used to ground the response").nullable().optional(),
|
|
110
110
|
related_questions: zod.z.array(zod.z.string()).describe("Related questions").nullable().optional()
|
|
111
|
-
}).describe("Response model for Sonar chat completions.");
|
|
111
|
+
}).passthrough().describe("Response model for Sonar chat completions.");
|
|
112
112
|
const perplexityaiCreateChatCompletion = require_action.action("PERPLEXITYAI_CREATE_CHAT_COMPLETION", {
|
|
113
113
|
slug: "perplexityai-create-chat-completion",
|
|
114
114
|
name: "Create Chat Completion",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-chat-completion.cjs","names":["z","action"],"sources":["../../src/actions/create-chat-completion.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { action } from \"../action\";\n\nexport const PerplexityaiCreateChatCompletionInput: z.ZodTypeAny = z.object({\n stop: z.union([z.string(), z.array(z.string())]).optional(),\n model: z.enum([\"sonar\", \"sonar-pro\", \"sonar-deep-research\", \"sonar-reasoning-pro\"]).default(\"sonar\").describe(\"The Sonar model to use. 'sonar' for fast/cheap queries, 'sonar-pro' for complex queries, 'sonar-reasoning-pro' for chain-of-thought reasoning, 'sonar-deep-research' for exhaustive research (generates very long 10K+ word responses; prefer the async endpoint for this model).\").optional(),\n top_p: z.number().describe(\"Nucleus sampling threshold controlling cumulative probability of tokens.\").optional(),\n stream: z.boolean().describe(\"Whether to stream the response using server-sent events.\").optional(),\n messages: z.array(z.object({\n role: z.enum([\"system\", \"user\", \"assistant\", \"tool\"]).describe(\"Role of the message sender (system, user, assistant, or tool)\"),\n content: z.string().describe(\"Content of the message\"),\n}).describe(\"A message in the conversation.\")).describe(\"A list of messages comprising the conversation. Each message has a role (system, user, assistant, tool) and content. Messages with 'tool' role must alternate with 'assistant' messages. Valid pattern: system -> user -> assistant -> tool -> user.\"),\n max_tokens: z.number().int().describe(\"Maximum number of tokens to generate. Max 128000.\").optional(),\n search_mode: z.string().describe(\"Search mode. Options: 'web', 'academic', 'sec'.\").optional(),\n stream_mode: z.string().describe(\"Stream mode: 'full' (default) or 'concise'.\").optional(),\n temperature: z.number().describe(\"Controls randomness. 0 is deterministic, up to 2 is more random.\").optional(),\n return_images: z.boolean().describe(\"Whether to include images in the response.\").optional(),\n disable_search: z.boolean().describe(\"Whether to disable web search entirely.\").optional(),\n response_format: z.object({\n type: z.string().describe(\"Type of response format: 'text' or 'json_schema'\"),\n json_schema: z.object({\n name: z.string().default(\"schema\").describe(\"Name of the schema\").optional(),\n schema: z.record(z.string(), z.unknown()).describe(\"The JSON schema definition\"),\n strict: z.boolean().default(true).describe(\"Whether to enforce strict schema validation\").optional(),\n description: z.string().describe(\"Description of the schema\").optional(),\n}).describe(\"JSON schema configuration for structured output.\").optional(),\n}).describe(\"Response format configuration.\").optional(),\n reasoning_effort: z.string().describe(\"Reasoning effort level: 'minimal', 'low', 'medium', 'high'.\").optional(),\n web_search_options: z.object({\n search_type: z.string().describe(\"Type of search to perform. Options: 'fast', 'pro', 'auto'\").optional(),\n search_context_size: z.string().describe(\"Amount of context used for search queries. Options: 'low', 'medium', 'high'\").optional(),\n}).describe(\"Options for web search behavior.\").optional(),\n image_domain_filter: z.array(z.string()).describe(\"Filter images by source domain.\").optional(),\n image_format_filter: z.array(z.string()).describe(\"Filter images by format (e.g. 'png', 'jpg').\").optional(),\n language_preference: z.string().describe(\"Preferred response language as ISO 639-1 code (e.g. 'en', 'fr').\").optional(),\n search_domain_filter: z.array(z.string()).describe(\"List of domains to restrict search results to.\").optional(),\n search_recency_filter: z.string().describe(\"Filter by recency: 'hour', 'day', 'week', 'month', 'year'. Mutually exclusive with date filters (search_after_date_filter, search_before_date_filter, last_updated_after_filter, last_updated_before_filter).\").optional(),\n search_language_filter: z.array(z.string()).describe(\"ISO 639-1 language codes to filter search results.\").optional(),\n enable_search_classifier: z.boolean().describe(\"Whether to enable the search classifier.\").optional(),\n return_related_questions: z.boolean().describe(\"Whether to return related questions.\").optional(),\n search_after_date_filter: z.string().describe(\"Only include results published after this date (MM/DD/YYYY). Cannot be used with search_recency_filter.\").optional(),\n last_updated_after_filter: z.string().describe(\"Only include results last updated after this date (MM/DD/YYYY).\").optional(),\n search_before_date_filter: z.string().describe(\"Only include results published before this date (MM/DD/YYYY). Cannot be used with search_recency_filter.\").optional(),\n last_updated_before_filter: z.string().describe(\"Only include results last updated before this date (MM/DD/YYYY).\").optional(),\n}).describe(\"Request model for Sonar chat completions.\");\nconst PerplexityaiCreateChatCompletion_CostSchema: z.ZodTypeAny = z.object({\n total_cost: z.number().describe(\"Total cost\").nullable().optional(),\n request_cost: z.number().describe(\"Per-request cost\").nullable().optional(),\n input_tokens_cost: z.number().describe(\"Cost for input tokens\").nullable().optional(),\n output_tokens_cost: z.number().describe(\"Cost for output tokens\").nullable().optional(),\n search_queries_cost: z.number().describe(\"Cost for search queries\").nullable().optional(),\n citation_tokens_cost: z.number().describe(\"Cost for citation tokens\").nullable().optional(),\n reasoning_tokens_cost: z.number().describe(\"Cost for reasoning tokens\").nullable().optional(),\n}).describe(\"Cost breakdown for the completion.\");\nconst PerplexityaiCreateChatCompletion_UsageInfoSchema: z.ZodTypeAny = z.object({\n cost: PerplexityaiCreateChatCompletion_CostSchema.nullable().optional(),\n total_tokens: z.number().int().describe(\"Total number of tokens used\"),\n prompt_tokens: z.number().int().describe(\"Number of tokens in the prompt\"),\n citation_tokens: z.number().int().describe(\"Tokens used for citations\").nullable().optional(),\n reasoning_tokens: z.number().int().describe(\"Tokens used for reasoning\").nullable().optional(),\n completion_tokens: z.number().int().describe(\"Number of tokens in the completion\"),\n num_search_queries: z.number().int().describe(\"Number of search queries\").nullable().optional(),\n search_context_size: z.string().describe(\"Search context size used\").nullable().optional(),\n}).describe(\"Token usage information.\");\nconst PerplexityaiCreateChatCompletion_ImageResultSchema: z.ZodTypeAny = z.object({\n title: z.string().describe(\"Title of the image\").nullable().optional(),\n width: z.number().int().describe(\"Image width in pixels\").nullable().optional(),\n height: z.number().int().describe(\"Image height in pixels\").nullable().optional(),\n image_url: z.string().describe(\"URL of the image\"),\n origin_url: z.string().describe(\"URL of the page containing the image\"),\n}).describe(\"An image result.\");\nconst PerplexityaiCreateChatCompletion_ChoiceMessageSchema: z.ZodTypeAny = z.object({\n role: z.string().describe(\"Role of the message sender\").nullable().optional(),\n content: z.string().describe(\"Content of the message\").nullable().optional(),\n}).describe(\"Message in a completion choice.\");\nconst PerplexityaiCreateChatCompletion_ChoiceSchema: z.ZodTypeAny = z.object({\n delta: PerplexityaiCreateChatCompletion_ChoiceMessageSchema.nullable().optional(),\n index: z.number().int().describe(\"Index of this choice\"),\n message: PerplexityaiCreateChatCompletion_ChoiceMessageSchema.nullable().optional(),\n finish_reason: z.string().describe(\"Reason generation stopped: 'stop' or 'length'\").nullable().optional(),\n}).describe(\"A completion choice.\");\nconst PerplexityaiCreateChatCompletion_SearchResultSchema: z.ZodTypeAny = z.object({\n url: z.string().describe(\"URL of the search result\"),\n date: z.string().describe(\"Publication date\").nullable().optional(),\n title: z.string().describe(\"Title of the search result\"),\n source: z.string().describe(\"Source type: 'web' or 'attachment'\").nullable().optional(),\n snippet: z.string().describe(\"Text snippet\").nullable().optional(),\n last_updated: z.string().describe(\"Last updated date\").nullable().optional(),\n}).describe(\"A search result used to ground the response.\");\nexport const PerplexityaiCreateChatCompletionOutput: z.ZodTypeAny = z.object({\n id: z.string().describe(\"Unique identifier for the completion\"),\n model: z.string().describe(\"Model used for the completion\"),\n usage: PerplexityaiCreateChatCompletion_UsageInfoSchema.nullable().optional(),\n images: z.array(PerplexityaiCreateChatCompletion_ImageResultSchema).describe(\"Image results\").nullable().optional(),\n object: z.string().describe(\"Object type, typically 'chat.completion'\"),\n choices: z.array(PerplexityaiCreateChatCompletion_ChoiceSchema).describe(\"List of completion choices\"),\n created: z.number().int().describe(\"Unix timestamp when the completion was created\"),\n citations: z.array(z.string()).describe(\"Citation URLs\").nullable().optional(),\n search_results: z.array(PerplexityaiCreateChatCompletion_SearchResultSchema).describe(\"Search results used to ground the response\").nullable().optional(),\n related_questions: z.array(z.string()).describe(\"Related questions\").nullable().optional(),\n}).describe(\"Response model for Sonar chat completions.\");\n\nexport const perplexityaiCreateChatCompletion = action(\"PERPLEXITYAI_CREATE_CHAT_COMPLETION\", {\n slug: \"perplexityai-create-chat-completion\",\n name: \"Create Chat Completion\",\n description: \"Perplexity Sonar Chat Completions (POST /v1/sonar). Generates web-grounded conversational AI responses with citations. Supports multiple Sonar models optimized for different use cases: - sonar: Fast, cost-effective for simple queries - sonar-pro: Enhanced quality for complex questions - sonar-reasoning-pro: Chain-of-thought reasoning with <think> blocks - sonar-deep-research: Exhaustive multi-source research (generates very long responses, 10K+ words; prefer the async endpoint for this model) Features: web search grounding, citations, images, structured JSON output, search filtering by domain/date/language/recency, and streaming. Important constraints: - search_recency_filter and date filters (search_after_date_filter, search_before_date_filter, etc.) are mutually exclusive. Use one or the other, not both. - Messages with the 'tool' role must alternate with 'assistant' messages. A valid pattern is: system -> user -> assistant -> tool -> user. - The 'stop' parameter is not currently supported by the API.\",\n input: PerplexityaiCreateChatCompletionInput,\n output: PerplexityaiCreateChatCompletionOutput,\n});\n"],"mappings":";;;AA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OAAO,CAAC,CAAC,CAAC,SAAS,mBAAmB,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;AAC3F,CAAC,CAAC,CAAC,SAAS,4CAA4C;AAExD,MAAa,mCAAmCC,eAAAA,OAAO,uCAAuC;CAC5F,MAAM;CACN,MAAM;CACN,aAAa;CACb,OAAO;CACP,QAAQ;AACV,CAAC"}
|
|
1
|
+
{"version":3,"file":"create-chat-completion.cjs","names":["z","action"],"sources":["../../src/actions/create-chat-completion.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { action } from \"../action\";\n\nexport const PerplexityaiCreateChatCompletionInput = z.object({\n stop: z.union([z.string(), z.array(z.string())]).optional(),\n model: z.enum([\"sonar\", \"sonar-pro\", \"sonar-deep-research\", \"sonar-reasoning-pro\"]).default(\"sonar\").describe(\"The Sonar model to use. 'sonar' for fast/cheap queries, 'sonar-pro' for complex queries, 'sonar-reasoning-pro' for chain-of-thought reasoning, 'sonar-deep-research' for exhaustive research (generates very long 10K+ word responses; prefer the async endpoint for this model).\").optional(),\n top_p: z.number().describe(\"Nucleus sampling threshold controlling cumulative probability of tokens.\").optional(),\n stream: z.boolean().describe(\"Whether to stream the response using server-sent events.\").optional(),\n messages: z.array(z.object({\n role: z.enum([\"system\", \"user\", \"assistant\", \"tool\"]).describe(\"Role of the message sender (system, user, assistant, or tool)\"),\n content: z.string().describe(\"Content of the message\"),\n}).passthrough().describe(\"A message in the conversation.\")).describe(\"A list of messages comprising the conversation. Each message has a role (system, user, assistant, tool) and content. Messages with 'tool' role must alternate with 'assistant' messages. Valid pattern: system -> user -> assistant -> tool -> user.\"),\n max_tokens: z.number().int().describe(\"Maximum number of tokens to generate. Max 128000.\").optional(),\n search_mode: z.string().describe(\"Search mode. Options: 'web', 'academic', 'sec'.\").optional(),\n stream_mode: z.string().describe(\"Stream mode: 'full' (default) or 'concise'.\").optional(),\n temperature: z.number().describe(\"Controls randomness. 0 is deterministic, up to 2 is more random.\").optional(),\n return_images: z.boolean().describe(\"Whether to include images in the response.\").optional(),\n disable_search: z.boolean().describe(\"Whether to disable web search entirely.\").optional(),\n response_format: z.object({\n type: z.string().describe(\"Type of response format: 'text' or 'json_schema'\"),\n json_schema: z.object({\n name: z.string().default(\"schema\").describe(\"Name of the schema\").optional(),\n schema: z.record(z.string(), z.unknown()).describe(\"The JSON schema definition\"),\n strict: z.boolean().default(true).describe(\"Whether to enforce strict schema validation\").optional(),\n description: z.string().describe(\"Description of the schema\").optional(),\n}).describe(\"JSON schema configuration for structured output.\").optional(),\n}).describe(\"Response format configuration.\").optional(),\n reasoning_effort: z.string().describe(\"Reasoning effort level: 'minimal', 'low', 'medium', 'high'.\").optional(),\n web_search_options: z.object({\n search_type: z.string().describe(\"Type of search to perform. Options: 'fast', 'pro', 'auto'\").optional(),\n search_context_size: z.string().describe(\"Amount of context used for search queries. Options: 'low', 'medium', 'high'\").optional(),\n}).describe(\"Options for web search behavior.\").optional(),\n image_domain_filter: z.array(z.string()).describe(\"Filter images by source domain.\").optional(),\n image_format_filter: z.array(z.string()).describe(\"Filter images by format (e.g. 'png', 'jpg').\").optional(),\n language_preference: z.string().describe(\"Preferred response language as ISO 639-1 code (e.g. 'en', 'fr').\").optional(),\n search_domain_filter: z.array(z.string()).describe(\"List of domains to restrict search results to.\").optional(),\n search_recency_filter: z.string().describe(\"Filter by recency: 'hour', 'day', 'week', 'month', 'year'. Mutually exclusive with date filters (search_after_date_filter, search_before_date_filter, last_updated_after_filter, last_updated_before_filter).\").optional(),\n search_language_filter: z.array(z.string()).describe(\"ISO 639-1 language codes to filter search results.\").optional(),\n enable_search_classifier: z.boolean().describe(\"Whether to enable the search classifier.\").optional(),\n return_related_questions: z.boolean().describe(\"Whether to return related questions.\").optional(),\n search_after_date_filter: z.string().describe(\"Only include results published after this date (MM/DD/YYYY). Cannot be used with search_recency_filter.\").optional(),\n last_updated_after_filter: z.string().describe(\"Only include results last updated after this date (MM/DD/YYYY).\").optional(),\n search_before_date_filter: z.string().describe(\"Only include results published before this date (MM/DD/YYYY). Cannot be used with search_recency_filter.\").optional(),\n last_updated_before_filter: z.string().describe(\"Only include results last updated before this date (MM/DD/YYYY).\").optional(),\n}).describe(\"Request model for Sonar chat completions.\");\nconst PerplexityaiCreateChatCompletion_CostSchema = z.object({\n total_cost: z.number().describe(\"Total cost\").nullable().optional(),\n request_cost: z.number().describe(\"Per-request cost\").nullable().optional(),\n input_tokens_cost: z.number().describe(\"Cost for input tokens\").nullable().optional(),\n output_tokens_cost: z.number().describe(\"Cost for output tokens\").nullable().optional(),\n search_queries_cost: z.number().describe(\"Cost for search queries\").nullable().optional(),\n citation_tokens_cost: z.number().describe(\"Cost for citation tokens\").nullable().optional(),\n reasoning_tokens_cost: z.number().describe(\"Cost for reasoning tokens\").nullable().optional(),\n}).passthrough().describe(\"Cost breakdown for the completion.\");\nconst PerplexityaiCreateChatCompletion_UsageInfoSchema = z.object({\n cost: PerplexityaiCreateChatCompletion_CostSchema.nullable().optional(),\n total_tokens: z.number().int().describe(\"Total number of tokens used\").nullable(),\n prompt_tokens: z.number().int().describe(\"Number of tokens in the prompt\").nullable(),\n citation_tokens: z.number().int().describe(\"Tokens used for citations\").nullable().optional(),\n reasoning_tokens: z.number().int().describe(\"Tokens used for reasoning\").nullable().optional(),\n completion_tokens: z.number().int().describe(\"Number of tokens in the completion\").nullable(),\n num_search_queries: z.number().int().describe(\"Number of search queries\").nullable().optional(),\n search_context_size: z.string().describe(\"Search context size used\").nullable().optional(),\n}).passthrough().describe(\"Token usage information.\");\nconst PerplexityaiCreateChatCompletion_ImageResultSchema = z.object({\n title: z.string().describe(\"Title of the image\").nullable().optional(),\n width: z.number().int().describe(\"Image width in pixels\").nullable().optional(),\n height: z.number().int().describe(\"Image height in pixels\").nullable().optional(),\n image_url: z.string().describe(\"URL of the image\").nullable(),\n origin_url: z.string().describe(\"URL of the page containing the image\").nullable(),\n}).passthrough().describe(\"An image result.\");\nconst PerplexityaiCreateChatCompletion_ChoiceMessageSchema = z.object({\n role: z.string().describe(\"Role of the message sender\").nullable().optional(),\n content: z.string().describe(\"Content of the message\").nullable().optional(),\n}).passthrough().describe(\"Message in a completion choice.\");\nconst PerplexityaiCreateChatCompletion_ChoiceSchema = z.object({\n delta: PerplexityaiCreateChatCompletion_ChoiceMessageSchema.nullable().optional(),\n index: z.number().int().describe(\"Index of this choice\").nullable(),\n message: PerplexityaiCreateChatCompletion_ChoiceMessageSchema.nullable().optional(),\n finish_reason: z.string().describe(\"Reason generation stopped: 'stop' or 'length'\").nullable().optional(),\n}).passthrough().describe(\"A completion choice.\");\nconst PerplexityaiCreateChatCompletion_SearchResultSchema = z.object({\n url: z.string().describe(\"URL of the search result\").nullable(),\n date: z.string().describe(\"Publication date\").nullable().optional(),\n title: z.string().describe(\"Title of the search result\").nullable(),\n source: z.string().describe(\"Source type: 'web' or 'attachment'\").nullable().optional(),\n snippet: z.string().describe(\"Text snippet\").nullable().optional(),\n last_updated: z.string().describe(\"Last updated date\").nullable().optional(),\n}).passthrough().describe(\"A search result used to ground the response.\");\nexport const PerplexityaiCreateChatCompletionOutput = z.object({\n id: z.string().describe(\"Unique identifier for the completion\").nullable(),\n model: z.string().describe(\"Model used for the completion\").nullable(),\n usage: PerplexityaiCreateChatCompletion_UsageInfoSchema.nullable().optional(),\n images: z.array(PerplexityaiCreateChatCompletion_ImageResultSchema).describe(\"Image results\").nullable().optional(),\n object: z.string().describe(\"Object type, typically 'chat.completion'\").nullable(),\n choices: z.array(PerplexityaiCreateChatCompletion_ChoiceSchema).describe(\"List of completion choices\"),\n created: z.number().int().describe(\"Unix timestamp when the completion was created\").nullable(),\n citations: z.array(z.string()).describe(\"Citation URLs\").nullable().optional(),\n search_results: z.array(PerplexityaiCreateChatCompletion_SearchResultSchema).describe(\"Search results used to ground the response\").nullable().optional(),\n related_questions: z.array(z.string()).describe(\"Related questions\").nullable().optional(),\n}).passthrough().describe(\"Response model for Sonar chat completions.\");\n\nexport const perplexityaiCreateChatCompletion = action(\"PERPLEXITYAI_CREATE_CHAT_COMPLETION\", {\n slug: \"perplexityai-create-chat-completion\",\n name: \"Create Chat Completion\",\n description: \"Perplexity Sonar Chat Completions (POST /v1/sonar). Generates web-grounded conversational AI responses with citations. Supports multiple Sonar models optimized for different use cases: - sonar: Fast, cost-effective for simple queries - sonar-pro: Enhanced quality for complex questions - sonar-reasoning-pro: Chain-of-thought reasoning with <think> blocks - sonar-deep-research: Exhaustive multi-source research (generates very long responses, 10K+ words; prefer the async endpoint for this model) Features: web search grounding, citations, images, structured JSON output, search filtering by domain/date/language/recency, and streaming. Important constraints: - search_recency_filter and date filters (search_after_date_filter, search_before_date_filter, etc.) are mutually exclusive. Use one or the other, not both. - Messages with the 'tool' role must alternate with 'assistant' messages. A valid pattern is: system -> user -> assistant -> tool -> user. - The 'stop' parameter is not currently supported by the API.\",\n input: PerplexityaiCreateChatCompletionInput,\n output: PerplexityaiCreateChatCompletionOutput,\n});\n"],"mappings":";;;AAIA,MAAa,wCAAwCA,IAAAA,EAAE,OAAO;CAC5D,MAAMA,IAAAA,EAAE,MAAM,CAACA,IAAAA,EAAE,OAAO,GAAGA,IAAAA,EAAE,MAAMA,IAAAA,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;CAC1D,OAAOA,IAAAA,EAAE,KAAK;EAAC;EAAS;EAAa;EAAuB;CAAqB,CAAC,CAAC,CAAC,QAAQ,OAAO,CAAC,CAAC,SAAS,mRAAmR,CAAC,CAAC,SAAS;CAC5Y,OAAOA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS,0EAA0E,CAAC,CAAC,SAAS;CAChH,QAAQA,IAAAA,EAAE,QAAQ,CAAC,CAAC,SAAS,0DAA0D,CAAC,CAAC,SAAS;CAClG,UAAUA,IAAAA,EAAE,MAAMA,IAAAA,EAAE,OAAO;EAC3B,MAAMA,IAAAA,EAAE,KAAK;GAAC;GAAU;GAAQ;GAAa;EAAM,CAAC,CAAC,CAAC,SAAS,+DAA+D;EAC9H,SAASA,IAAAA,E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