@perplexity-ai/mcp-server 1.3.0 → 1.5.0
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/.claude-plugin/marketplace.json +2 -2
- package/README.md +19 -1
- package/dist/server.d.ts +3 -1
- package/dist/server.js +180 -12
- package/dist/types.d.ts +61 -1
- package/dist/validation.d.ts +631 -8
- package/dist/validation.js +41 -1
- package/package.json +1 -1
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "Official Perplexity AI plugin providing real-time web search, reasoning, and research capabilities",
|
|
9
|
-
"version": "1.
|
|
9
|
+
"version": "1.5.0"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
13
13
|
"name": "perplexity",
|
|
14
14
|
"source": "./",
|
|
15
15
|
"description": "Real-time web search, reasoning, and research through Perplexity's API",
|
|
16
|
-
"version": "1.
|
|
16
|
+
"version": "1.5.0",
|
|
17
17
|
"author": {
|
|
18
18
|
"name": "Perplexity AI",
|
|
19
19
|
"email": "api@perplexity.ai"
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/@perplexity-ai/mcp-server)
|
|
10
10
|
|
|
11
|
-
The official MCP server implementation for the Perplexity API Platform, providing AI assistants with real-time web search, reasoning, and research capabilities through the [Agent API](https://docs.perplexity.ai/docs/agent-api/quickstart) and the
|
|
11
|
+
The official MCP server implementation for the Perplexity API Platform, providing AI assistants with real-time web search, reasoning, and research capabilities through the [Agent API](https://docs.perplexity.ai/docs/agent-api/quickstart), the Search API, and the [Context API](https://docs.perplexity.ai/docs/context/quickstart).
|
|
12
12
|
|
|
13
13
|
## Remote MCP Server
|
|
14
14
|
|
|
@@ -153,8 +153,14 @@ The server will be accessible at `http://localhost:8080/mcp`
|
|
|
153
153
|
## Available Tools
|
|
154
154
|
|
|
155
155
|
### **perplexity_search**
|
|
156
|
+
|
|
157
|
+
Search results include publication and last-updated dates when available. Missing or null dates are omitted from the formatted output.
|
|
158
|
+
|
|
156
159
|
Direct web search using the Perplexity Search API. Returns ranked search results with metadata, perfect for finding current information. Supports recency filters (`search_recency_filter`), domain restrictions (`search_domain_filter`), and [Fast Search](https://docs.perplexity.ai/docs/search/fast-search) (`search_type: "fast"`) for lower latency and cost.
|
|
157
160
|
|
|
161
|
+
### **perplexity_context**
|
|
162
|
+
Fetch web pages by URL using the Perplexity [Context API](https://docs.perplexity.ai/docs/context/quickstart). Returns the content of each page as Markdown by default, and can also return HTML, links, the passages most relevant to a query (`highlights`), and yes or no scores for your questions (`criteria`). Every result with status `ok` or `not_modified` includes page metadata. The tool input is the request body of [`POST /v1/context`](https://docs.perplexity.ai/api-reference/context-post), with the same parameter names: `urls`, `formats`, `highlights`, `if_modified_since`, `max_age_seconds`, `cache_only`, `snapshot_as_of`, `timeout_ms`, and `criteria`. The server sends the parameters as given and rejects a parameter that the API does not have.
|
|
163
|
+
|
|
158
164
|
### **perplexity_ask**
|
|
159
165
|
General-purpose conversational AI with real-time web search, backed by the Agent API `fast` preset. Great for quick questions and everyday searches.
|
|
160
166
|
|
|
@@ -164,6 +170,18 @@ Deep, comprehensive research backed by the Agent API `high` preset. Ideal for th
|
|
|
164
170
|
### **perplexity_reason**
|
|
165
171
|
Advanced reasoning and problem-solving backed by the Agent API `medium` preset. Perfect for complex analytical tasks.
|
|
166
172
|
|
|
173
|
+
`perplexity_ask` and `perplexity_reason` accept optional positive-integer `max_tokens` (total search context, up to 120,000) and `max_tokens_per_page` (context per result page, up to 20,000). These Agent API budgets control retrieved search content, not generated answer length. When omitted, the preset's search configuration remains in effect.
|
|
174
|
+
|
|
175
|
+
The legacy `search_context_size` argument is still accepted, but is translated locally into explicit budgets rather than sent to the Agent API:
|
|
176
|
+
|
|
177
|
+
| Legacy size | Total tokens | Tokens per page |
|
|
178
|
+
|-------------|--------------|-----------------|
|
|
179
|
+
| `low` | 2000 | 512 |
|
|
180
|
+
| `medium` | 4000 | 1024 |
|
|
181
|
+
| `high` | 8000 | 2048 |
|
|
182
|
+
|
|
183
|
+
This compatibility policy is not an exact equivalent of Sonar's named sizes; the [Agent API migration guide](https://docs.perplexity.ai/docs/agent-api/migrate-from-sonar/how-to) has no named-size equivalent. Each explicit budget overrides its corresponding legacy default.
|
|
184
|
+
|
|
167
185
|
> [!NOTE]
|
|
168
186
|
> Presets are managed configurations (model, search setup, step budget) that Perplexity keeps tuned over time; see the [presets guide](https://docs.perplexity.ai/docs/agent-api/presets). Earlier versions of this server called the legacy `sonar-pro`, `sonar-reasoning-pro`, and `sonar-deep-research` models and accepted `strip_thinking` / `reasoning_effort` parameters. Those parameters are no longer part of the tool schemas and are ignored if sent; the Agent API produces no `<think>` tags.
|
|
169
187
|
|
package/dist/server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Message, AgentResponse, AgentToolOptions, AgentCallHooks, ApiKeyProvider, PerplexityServerOptions, SearchOptions, SearchResponse } from "./types.js";
|
|
1
|
+
import type { Message, AgentResponse, AgentToolOptions, AgentCallHooks, ApiKeyProvider, ContextRequestBody, ContextResponse, PerplexityServerOptions, SearchOptions, SearchResponse } from "./types.js";
|
|
2
2
|
export type { ApiKeyProvider, PerplexityServerOptions } from "./types.js";
|
|
3
3
|
export declare const ASK_PRESET = "fast";
|
|
4
4
|
export declare const REASON_PRESET = "medium";
|
|
@@ -26,6 +26,8 @@ export declare function formatAgentResponseText(response: AgentResponse): string
|
|
|
26
26
|
export declare function performAgentResponse(messages: Message[], preset: string, serviceOrigin?: string, options?: AgentToolOptions, hooks?: AgentCallHooks, apiKey?: ApiKeyProvider): Promise<string>;
|
|
27
27
|
export declare function formatSearchResults(data: SearchResponse): string;
|
|
28
28
|
export declare function performSearch(query: string, maxResults?: number, maxTokensPerPage?: number, country?: string, filters?: SearchOptions, serviceOrigin?: string, apiKey?: ApiKeyProvider): Promise<string>;
|
|
29
|
+
export declare function formatContextResults(data: ContextResponse): string;
|
|
30
|
+
export declare function performContext(request: ContextRequestBody, serviceOrigin?: string, apiKey?: ApiKeyProvider, signal?: AbortSignal): Promise<string>;
|
|
29
31
|
export declare function createPerplexityServer(serviceOrigin?: string, serverOptions?: PerplexityServerOptions): import("@modelcontextprotocol/sdk/server/index.js").Server<{
|
|
30
32
|
method: string;
|
|
31
33
|
params?: {
|
package/dist/server.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { fetch as undiciFetch, ProxyAgent } from "undici";
|
|
4
|
-
import { AgentResponseSchema, SearchResponseSchema } from "./validation.js";
|
|
4
|
+
import { AgentResponseSchema, ContextResponseSchema, SearchResponseSchema } from "./validation.js";
|
|
5
5
|
const PERPLEXITY_API_KEY = process.env.PERPLEXITY_API_KEY;
|
|
6
6
|
const PERPLEXITY_BASE_URL = process.env.PERPLEXITY_BASE_URL || "https://api.perplexity.ai";
|
|
7
|
-
const VERSION = "1.
|
|
7
|
+
const VERSION = "1.5.0";
|
|
8
8
|
// Agent API presets backing each tool: https://docs.perplexity.ai/docs/agent-api/presets
|
|
9
9
|
export const ASK_PRESET = "fast";
|
|
10
10
|
export const REASON_PRESET = "medium";
|
|
@@ -63,7 +63,9 @@ async function makeApiRequest(endpoint, body, serviceOrigin, signal, apiKey) {
|
|
|
63
63
|
}
|
|
64
64
|
// Read timeout fresh each time to respect env var changes
|
|
65
65
|
const TIMEOUT_MS = parseInt(process.env.PERPLEXITY_TIMEOUT_MS || "300000", 10);
|
|
66
|
-
|
|
66
|
+
// Append to the base path so a query string in the base URL is preserved.
|
|
67
|
+
const url = new URL(PERPLEXITY_BASE_URL);
|
|
68
|
+
url.pathname = `${url.pathname.replace(/\/$/, "")}/${endpoint}`;
|
|
67
69
|
const controller = new AbortController();
|
|
68
70
|
const timeoutId = setTimeout(() => controller.abort(), TIMEOUT_MS);
|
|
69
71
|
// An abort from the caller's signal also tears down an in-flight body stream.
|
|
@@ -339,6 +341,15 @@ export function formatAgentResponseText(response) {
|
|
|
339
341
|
function buildWebSearchTool(options) {
|
|
340
342
|
if (!options)
|
|
341
343
|
return undefined;
|
|
344
|
+
// Local compatibility policy, not an upstream equivalence to Sonar's sizes.
|
|
345
|
+
// Explicit budgets override either legacy default independently.
|
|
346
|
+
const legacyBudgets = options.search_context_size && {
|
|
347
|
+
low: { max_tokens: 2000, max_tokens_per_page: 512 },
|
|
348
|
+
medium: { max_tokens: 4000, max_tokens_per_page: 1024 },
|
|
349
|
+
high: { max_tokens: 8000, max_tokens_per_page: 2048 },
|
|
350
|
+
}[options.search_context_size];
|
|
351
|
+
const maxTokens = options.max_tokens ?? (legacyBudgets && legacyBudgets.max_tokens);
|
|
352
|
+
const maxTokensPerPage = options.max_tokens_per_page ?? (legacyBudgets && legacyBudgets.max_tokens_per_page);
|
|
342
353
|
const filters = {
|
|
343
354
|
...(options.search_recency_filter && { search_recency_filter: options.search_recency_filter }),
|
|
344
355
|
...(options.search_domain_filter && { search_domain_filter: options.search_domain_filter }),
|
|
@@ -346,7 +357,8 @@ function buildWebSearchTool(options) {
|
|
|
346
357
|
const tool = {
|
|
347
358
|
type: "web_search",
|
|
348
359
|
...(Object.keys(filters).length > 0 && { filters }),
|
|
349
|
-
...(
|
|
360
|
+
...(maxTokens !== undefined && { max_tokens: maxTokens }),
|
|
361
|
+
...(maxTokensPerPage !== undefined && { max_tokens_per_page: maxTokensPerPage }),
|
|
350
362
|
};
|
|
351
363
|
// No override means the preset's own web_search config stays in effect.
|
|
352
364
|
return Object.keys(tool).length > 1 ? tool : undefined;
|
|
@@ -413,6 +425,9 @@ export function formatSearchResults(data) {
|
|
|
413
425
|
if (result.date) {
|
|
414
426
|
formattedResults += ` Date: ${result.date}\n`;
|
|
415
427
|
}
|
|
428
|
+
if (result.last_updated) {
|
|
429
|
+
formattedResults += ` Last updated: ${result.last_updated}\n`;
|
|
430
|
+
}
|
|
416
431
|
formattedResults += `\n`;
|
|
417
432
|
});
|
|
418
433
|
return formattedResults;
|
|
@@ -438,6 +453,79 @@ export async function performSearch(query, maxResults = 10, maxTokensPerPage = 1
|
|
|
438
453
|
}
|
|
439
454
|
return formatSearchResults(data);
|
|
440
455
|
}
|
|
456
|
+
export function formatContextResults(data) {
|
|
457
|
+
const text = (value) => (typeof value === "string" ? value : JSON.stringify(value));
|
|
458
|
+
let formatted = `Context results for ${data.results.length} ${data.results.length === 1 ? "URL" : "URLs"}:\n\n`;
|
|
459
|
+
data.results.forEach((result, index) => {
|
|
460
|
+
formatted += `${index + 1}. URL: ${result.url}\n`;
|
|
461
|
+
formatted += ` Status: ${result.status.type}\n`;
|
|
462
|
+
if (result.status.status_code != null) {
|
|
463
|
+
formatted += ` Status code: ${result.status.status_code}\n`;
|
|
464
|
+
}
|
|
465
|
+
if (result.status.message) {
|
|
466
|
+
formatted += ` Message: ${result.status.message}\n`;
|
|
467
|
+
}
|
|
468
|
+
if (result.metadata) {
|
|
469
|
+
formatted += ` Metadata:\n`;
|
|
470
|
+
for (const [key, value] of Object.entries(result.metadata)) {
|
|
471
|
+
formatted += ` ${key}: ${text(value)}\n`;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
if (result.criteria) {
|
|
475
|
+
formatted += ` Criteria:\n`;
|
|
476
|
+
for (const [id, answer] of Object.entries(result.criteria)) {
|
|
477
|
+
formatted += ` ${id}: ${answer.type} ${answer.noul}\n`;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
if (result.criteria_error) {
|
|
481
|
+
formatted += ` Criteria error: ${result.criteria_error}\n`;
|
|
482
|
+
}
|
|
483
|
+
if (result.highlights != null) {
|
|
484
|
+
formatted += ` Highlights:\n${result.highlights}\n`;
|
|
485
|
+
}
|
|
486
|
+
if (result.markdown != null) {
|
|
487
|
+
formatted += ` Markdown:\n${result.markdown}\n`;
|
|
488
|
+
}
|
|
489
|
+
if (result.html != null) {
|
|
490
|
+
formatted += ` HTML:\n${result.html}\n`;
|
|
491
|
+
}
|
|
492
|
+
if (result.links) {
|
|
493
|
+
formatted += ` Links (${result.links.length}):\n`;
|
|
494
|
+
for (const link of result.links) {
|
|
495
|
+
formatted += ` - ${link}\n`;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
formatted += `\n`;
|
|
499
|
+
});
|
|
500
|
+
if (data.usage?.fetched_urls != null) {
|
|
501
|
+
formatted += `Billed URLs: ${data.usage.fetched_urls}\n`;
|
|
502
|
+
}
|
|
503
|
+
if (data.usage?.cost?.total_cost != null) {
|
|
504
|
+
formatted += `Cost: ${data.usage.cost.total_cost}${data.usage.cost.currency ? ` ${data.usage.cost.currency}` : ""}\n`;
|
|
505
|
+
}
|
|
506
|
+
if (data.usage?.criteria?.input_tokens != null) {
|
|
507
|
+
formatted += `Criteria input tokens: ${data.usage.criteria.input_tokens}\n`;
|
|
508
|
+
}
|
|
509
|
+
if (data.request_id) {
|
|
510
|
+
formatted += `Request ID: ${data.request_id}\n`;
|
|
511
|
+
}
|
|
512
|
+
return formatted;
|
|
513
|
+
}
|
|
514
|
+
export async function performContext(request, serviceOrigin, apiKey, signal) {
|
|
515
|
+
// The request is the Context API body as given: no local defaults, so a
|
|
516
|
+
// parameter that is not set gets the API default. The signal is passed
|
|
517
|
+
// because one call can run for the full timeout_ms plus criteria scoring.
|
|
518
|
+
const response = await makeApiRequest("v1/context", { ...request }, serviceOrigin, signal, apiKey);
|
|
519
|
+
let data;
|
|
520
|
+
try {
|
|
521
|
+
const json = await response.json();
|
|
522
|
+
data = ContextResponseSchema.parse(json);
|
|
523
|
+
}
|
|
524
|
+
catch (error) {
|
|
525
|
+
throw new Error(`Failed to parse JSON response from Perplexity Context API: ${error}`);
|
|
526
|
+
}
|
|
527
|
+
return formatContextResults(data);
|
|
528
|
+
}
|
|
441
529
|
function buildHooks(extra) {
|
|
442
530
|
const progressToken = extra?._meta?.progressToken;
|
|
443
531
|
const sendNotification = extra?.sendNotification;
|
|
@@ -465,10 +553,11 @@ export function createPerplexityServer(serviceOrigin, serverOptions) {
|
|
|
465
553
|
}, {
|
|
466
554
|
instructions: "Perplexity AI server for web-grounded search, research, and reasoning, backed by the Perplexity Agent API. " +
|
|
467
555
|
"Use perplexity_search for finding URLs, facts, and recent news. Supports recency filters, domain restrictions, and fast search. " +
|
|
468
|
-
"Use
|
|
556
|
+
"Use perplexity_context to read the content of pages when you have the URLs. " +
|
|
557
|
+
"Use perplexity_ask for quick AI-answered questions with citations. Supports recency filters, domain restrictions, and search token budgets. " +
|
|
469
558
|
"Use perplexity_research for in-depth multi-source investigation (slow, can take minutes). " +
|
|
470
|
-
"Use perplexity_reason for complex analysis requiring step-by-step logic. Supports recency filters, domain restrictions, and search
|
|
471
|
-
"All tools are read-only
|
|
559
|
+
"Use perplexity_reason for complex analysis requiring step-by-step logic. Supports recency filters, domain restrictions, and search token budgets. " +
|
|
560
|
+
"All tools are read-only. perplexity_context can return a stored copy of a page.",
|
|
472
561
|
});
|
|
473
562
|
const messageSchema = z.object({
|
|
474
563
|
role: z.enum(["system", "user", "assistant"]).describe("Role of the message sender"),
|
|
@@ -480,7 +569,13 @@ export function createPerplexityServer(serviceOrigin, serverOptions) {
|
|
|
480
569
|
const searchDomainFilterField = z.array(z.string()).optional()
|
|
481
570
|
.describe("Restrict search results to specific domains (e.g., ['wikipedia.org', 'arxiv.org']). Use '-' prefix for exclusion (e.g., ['-reddit.com']).");
|
|
482
571
|
const searchContextSizeField = z.enum(["low", "medium", "high"]).optional()
|
|
483
|
-
.describe("
|
|
572
|
+
.describe("Deprecated compatibility shorthand for search token budgets: low=2000/512, medium=4000/1024, high=8000/2048 (total/per-page). Explicit max_tokens and max_tokens_per_page override these defaults.");
|
|
573
|
+
const MAX_SEARCH_TOKENS = 120000;
|
|
574
|
+
const MAX_SEARCH_TOKENS_PER_PAGE = 20000;
|
|
575
|
+
const maxTokensField = z.number().int().positive().max(MAX_SEARCH_TOKENS).optional()
|
|
576
|
+
.describe("Maximum total search-context tokens, not generated answer tokens. Overrides the legacy search_context_size total budget.");
|
|
577
|
+
const maxTokensPerPageField = z.number().int().positive().max(MAX_SEARCH_TOKENS_PER_PAGE).optional()
|
|
578
|
+
.describe("Maximum search-context tokens extracted per result page. Overrides the legacy search_context_size per-page budget.");
|
|
484
579
|
const responseOutputSchema = {
|
|
485
580
|
response: z.string().describe("AI-generated text response with numbered citation references"),
|
|
486
581
|
};
|
|
@@ -490,6 +585,8 @@ export function createPerplexityServer(serviceOrigin, serverOptions) {
|
|
|
490
585
|
search_recency_filter: searchRecencyFilterField,
|
|
491
586
|
search_domain_filter: searchDomainFilterField,
|
|
492
587
|
search_context_size: searchContextSizeField,
|
|
588
|
+
max_tokens: maxTokensField,
|
|
589
|
+
max_tokens_per_page: maxTokensPerPageField,
|
|
493
590
|
};
|
|
494
591
|
const researchInputSchema = {
|
|
495
592
|
messages: messagesField,
|
|
@@ -499,7 +596,7 @@ export function createPerplexityServer(serviceOrigin, serverOptions) {
|
|
|
499
596
|
description: "Answer a question using web-grounded AI (Perplexity Agent API, " + ASK_PRESET + " preset). " +
|
|
500
597
|
"Best for: quick factual questions, summaries, explanations, and general Q&A. " +
|
|
501
598
|
"Returns a text response with numbered citations. Fastest and cheapest option. " +
|
|
502
|
-
"Supports filtering by recency (hour/day/week/month/year), domain restrictions, and search
|
|
599
|
+
"Supports filtering by recency (hour/day/week/month/year), domain restrictions, and search token budgets. " +
|
|
503
600
|
"For in-depth multi-source research, use perplexity_research instead. " +
|
|
504
601
|
"For step-by-step reasoning and analysis, use perplexity_reason instead.",
|
|
505
602
|
inputSchema: askAndReasonInputSchema,
|
|
@@ -511,12 +608,14 @@ export function createPerplexityServer(serviceOrigin, serverOptions) {
|
|
|
511
608
|
destructiveHint: false,
|
|
512
609
|
},
|
|
513
610
|
}, async (args, extra) => {
|
|
514
|
-
const { messages, search_recency_filter, search_domain_filter, search_context_size } = args;
|
|
611
|
+
const { messages, search_recency_filter, search_domain_filter, search_context_size, max_tokens, max_tokens_per_page } = args;
|
|
515
612
|
validateMessages(messages, "perplexity_ask");
|
|
516
613
|
const options = {
|
|
517
614
|
...(search_recency_filter && { search_recency_filter }),
|
|
518
615
|
...(search_domain_filter && { search_domain_filter }),
|
|
519
616
|
...(search_context_size && { search_context_size }),
|
|
617
|
+
...(max_tokens !== undefined && { max_tokens }),
|
|
618
|
+
...(max_tokens_per_page !== undefined && { max_tokens_per_page }),
|
|
520
619
|
};
|
|
521
620
|
const result = await performAgentResponse(messages, ASK_PRESET, serviceOrigin, Object.keys(options).length > 0 ? options : undefined, buildHooks(extra), serverOptions?.apiKey);
|
|
522
621
|
return {
|
|
@@ -554,7 +653,7 @@ export function createPerplexityServer(serviceOrigin, serverOptions) {
|
|
|
554
653
|
description: "Analyze a question using step-by-step reasoning with web grounding (Perplexity Agent API, " + REASON_PRESET + " preset). " +
|
|
555
654
|
"Best for: math, logic, comparisons, complex arguments, and tasks requiring chain-of-thought. " +
|
|
556
655
|
"Returns a reasoned response with numbered citations. " +
|
|
557
|
-
"Supports filtering by recency (hour/day/week/month/year), domain restrictions, and search
|
|
656
|
+
"Supports filtering by recency (hour/day/week/month/year), domain restrictions, and search token budgets. " +
|
|
558
657
|
"For quick factual questions, use perplexity_ask instead. " +
|
|
559
658
|
"For comprehensive multi-source research, use perplexity_research instead.",
|
|
560
659
|
inputSchema: askAndReasonInputSchema,
|
|
@@ -566,12 +665,14 @@ export function createPerplexityServer(serviceOrigin, serverOptions) {
|
|
|
566
665
|
destructiveHint: false,
|
|
567
666
|
},
|
|
568
667
|
}, async (args, extra) => {
|
|
569
|
-
const { messages, search_recency_filter, search_domain_filter, search_context_size } = args;
|
|
668
|
+
const { messages, search_recency_filter, search_domain_filter, search_context_size, max_tokens, max_tokens_per_page } = args;
|
|
570
669
|
validateMessages(messages, "perplexity_reason");
|
|
571
670
|
const options = {
|
|
572
671
|
...(search_recency_filter && { search_recency_filter }),
|
|
573
672
|
...(search_domain_filter && { search_domain_filter }),
|
|
574
673
|
...(search_context_size && { search_context_size }),
|
|
674
|
+
...(max_tokens !== undefined && { max_tokens }),
|
|
675
|
+
...(max_tokens_per_page !== undefined && { max_tokens_per_page }),
|
|
575
676
|
};
|
|
576
677
|
const result = await performAgentResponse(messages, REASON_PRESET, serviceOrigin, Object.keys(options).length > 0 ? options : undefined, buildHooks(extra), serverOptions?.apiKey);
|
|
577
678
|
return {
|
|
@@ -626,6 +727,73 @@ export function createPerplexityServer(serviceOrigin, serverOptions) {
|
|
|
626
727
|
structuredContent: { results: result },
|
|
627
728
|
};
|
|
628
729
|
});
|
|
730
|
+
// The input schema is the request body of POST /v1/context: same names,
|
|
731
|
+
// nesting, and ranges. It is strict at every level because the API rejects
|
|
732
|
+
// unknown parameters. Rules between parameters are left to the API.
|
|
733
|
+
const contextInputSchema = z.object({
|
|
734
|
+
urls: z.array(z.string()).min(1).max(50)
|
|
735
|
+
.describe("http or https URLs to fetch (1-50). Each URL gets its own result and status."),
|
|
736
|
+
formats: z.array(z.enum(["markdown", "html", "links", "highlights"])).optional()
|
|
737
|
+
.describe("What to return for each page (default: ['markdown']). Every result with status ok or not_modified includes metadata, so do not list it; pass [] for metadata only. 'highlights' also requires the highlights object."),
|
|
738
|
+
highlights: z.object({
|
|
739
|
+
query: z.string()
|
|
740
|
+
.describe("What to look for in each page (1-1024 characters)"),
|
|
741
|
+
max_tokens_per_url: z.number().int().min(1).max(4096).optional()
|
|
742
|
+
.describe("Maximum length of each page's highlights in tokens (1-4096, default: 1024)"),
|
|
743
|
+
}).strict().optional()
|
|
744
|
+
.describe("Settings for the 'highlights' format. Whenever you set this, also set formats to include 'highlights' (e.g., formats: ['highlights']). A request that sets highlights fails if formats is omitted or does not include 'highlights'."),
|
|
745
|
+
if_modified_since: z.string().optional()
|
|
746
|
+
.describe("A metadata last_modified value from an earlier result, in IMF-fixdate form (e.g., 'Thu, 03 Dec 1992 08:37:20 GMT'). Requires exactly one URL and max_age_seconds 0. A page that has not changed returns status not_modified and no content."),
|
|
747
|
+
max_age_seconds: z.number().int().min(0).max(63072000).optional()
|
|
748
|
+
.describe("Maximum age in seconds of a stored copy to accept (0-63072000, default: 172800). 0 always fetches the page live. Cannot be combined with snapshot_as_of."),
|
|
749
|
+
cache_only: z.boolean().optional()
|
|
750
|
+
.describe("When true, read only stored copies and never fetch live (default: false). A URL with no stored copy returns status no_content. Requires max_age_seconds above 0. Cannot be combined with snapshot_as_of."),
|
|
751
|
+
snapshot_as_of: z.string().optional()
|
|
752
|
+
.describe("Return each page as stored at or before this RFC 3339 time with a time zone (e.g., '2026-11-01T00:00:00Z'). Must not be in the future or more than 365 days ago. Never fetches live. Cannot be combined with max_age_seconds, cache_only, or if_modified_since."),
|
|
753
|
+
timeout_ms: z.number().int().min(1000).max(110000).optional()
|
|
754
|
+
.describe("Time budget in milliseconds for fetching the pages (1000-110000). A URL that does not finish in time returns status crawl_timeout."),
|
|
755
|
+
// Zod drops a record key named __proto__, so the question would not reach
|
|
756
|
+
// the API. Reject it instead of sending a different request.
|
|
757
|
+
criteria: z.record(z.string().refine((id) => id !== "__proto__", "'__proto__' cannot be used as a question ID in this tool"), z.object({
|
|
758
|
+
type: z.enum(["noul"])
|
|
759
|
+
.describe("Question type. Always 'noul'."),
|
|
760
|
+
instructions: z.string()
|
|
761
|
+
.describe("The yes or no question to answer, or the statement to check (1-1000 characters)"),
|
|
762
|
+
criteria: z.object({
|
|
763
|
+
true: z.string().optional()
|
|
764
|
+
.describe("What makes the answer true (1-500 characters)"),
|
|
765
|
+
false: z.string().optional()
|
|
766
|
+
.describe("What makes the answer false (1-500 characters)"),
|
|
767
|
+
}).strict().optional()
|
|
768
|
+
.describe("Optional descriptions of what makes the answer true and what makes it false"),
|
|
769
|
+
}).strict()).optional()
|
|
770
|
+
.describe("Yes or no questions to score each page with (1-5 questions). An object keyed by question ID. Each value is an object with type 'noul', the question in instructions, and optionally a nested criteria object that says what makes the answer true or false (e.g., {\"is_changelog\": {\"type\": \"noul\", \"instructions\": \"Is this page a product changelog?\", \"criteria\": {\"true\": \"The page lists dated releases.\", \"false\": \"The page is not a list of releases.\"}}}). IDs must match [A-Za-z0-9_-]{1,64}. 'query' is reserved, and this tool does not accept '__proto__'. Each answer is a probability of yes from 0 to 1. Scoring does not filter or reorder results."),
|
|
771
|
+
}).strict();
|
|
772
|
+
const contextOutputSchema = {
|
|
773
|
+
results: z.string().describe("Formatted results in request order, each with URL, status, metadata, criteria answers, and the requested formats, followed by usage and the request ID"),
|
|
774
|
+
};
|
|
775
|
+
server.registerTool("perplexity_context", {
|
|
776
|
+
title: "Fetch Web Pages",
|
|
777
|
+
description: "Fetch web pages by URL through the Perplexity Context API. " +
|
|
778
|
+
"Best for: reading pages when you already have the URLs. " +
|
|
779
|
+
"Returns Markdown by default. Can also return HTML, links, the passages most relevant to a query (highlights), and yes or no scores for your questions (criteria). Every result with status ok or not_modified includes page metadata. " +
|
|
780
|
+
"Full pages can be long; to get specific facts, set formats to ['highlights'] and set highlights.query. " +
|
|
781
|
+
"To find URLs, use perplexity_search instead.",
|
|
782
|
+
inputSchema: contextInputSchema,
|
|
783
|
+
outputSchema: contextOutputSchema,
|
|
784
|
+
annotations: {
|
|
785
|
+
readOnlyHint: true,
|
|
786
|
+
openWorldHint: true,
|
|
787
|
+
idempotentHint: false,
|
|
788
|
+
destructiveHint: false,
|
|
789
|
+
},
|
|
790
|
+
}, async (args, extra) => {
|
|
791
|
+
const result = await performContext(args, serviceOrigin, serverOptions?.apiKey, extra?.signal);
|
|
792
|
+
return {
|
|
793
|
+
content: [{ type: "text", text: result }],
|
|
794
|
+
structuredContent: { results: result },
|
|
795
|
+
};
|
|
796
|
+
});
|
|
629
797
|
advertiseJsonSchema202012(server.server);
|
|
630
798
|
return server.server;
|
|
631
799
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -56,7 +56,8 @@ export interface SearchResult {
|
|
|
56
56
|
title: string;
|
|
57
57
|
url: string;
|
|
58
58
|
snippet?: string;
|
|
59
|
-
date?: string;
|
|
59
|
+
date?: string | null;
|
|
60
|
+
last_updated?: string | null;
|
|
60
61
|
score?: number;
|
|
61
62
|
}
|
|
62
63
|
export interface SearchUsage {
|
|
@@ -73,6 +74,63 @@ export interface SearchRequestBody {
|
|
|
73
74
|
max_tokens_per_page: number;
|
|
74
75
|
country?: string;
|
|
75
76
|
}
|
|
77
|
+
export type ContextFormat = "markdown" | "html" | "links" | "highlights";
|
|
78
|
+
export interface ContextCriteriaQuestion {
|
|
79
|
+
type: "noul";
|
|
80
|
+
instructions: string;
|
|
81
|
+
criteria?: {
|
|
82
|
+
true?: string;
|
|
83
|
+
false?: string;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/** Request body of POST /v1/context, sent to the API as given. */
|
|
87
|
+
export interface ContextRequestBody {
|
|
88
|
+
urls: string[];
|
|
89
|
+
formats?: ContextFormat[];
|
|
90
|
+
highlights?: {
|
|
91
|
+
query: string;
|
|
92
|
+
max_tokens_per_url?: number;
|
|
93
|
+
};
|
|
94
|
+
if_modified_since?: string;
|
|
95
|
+
max_age_seconds?: number;
|
|
96
|
+
cache_only?: boolean;
|
|
97
|
+
snapshot_as_of?: string;
|
|
98
|
+
timeout_ms?: number;
|
|
99
|
+
criteria?: Record<string, ContextCriteriaQuestion>;
|
|
100
|
+
}
|
|
101
|
+
export interface ContextResult {
|
|
102
|
+
url: string;
|
|
103
|
+
status: {
|
|
104
|
+
type: string;
|
|
105
|
+
status_code?: number | null;
|
|
106
|
+
message?: string | null;
|
|
107
|
+
};
|
|
108
|
+
metadata?: Record<string, unknown> | null;
|
|
109
|
+
markdown?: string | null;
|
|
110
|
+
html?: string | null;
|
|
111
|
+
links?: string[] | null;
|
|
112
|
+
highlights?: string | null;
|
|
113
|
+
criteria?: Record<string, {
|
|
114
|
+
type: string;
|
|
115
|
+
noul: number;
|
|
116
|
+
}> | null;
|
|
117
|
+
criteria_error?: string | null;
|
|
118
|
+
}
|
|
119
|
+
export interface ContextUsage {
|
|
120
|
+
fetched_urls?: number | null;
|
|
121
|
+
cost?: {
|
|
122
|
+
total_cost?: number | null;
|
|
123
|
+
currency?: string | null;
|
|
124
|
+
} | null;
|
|
125
|
+
criteria?: {
|
|
126
|
+
input_tokens?: number | null;
|
|
127
|
+
} | null;
|
|
128
|
+
}
|
|
129
|
+
export interface ContextResponse {
|
|
130
|
+
request_id?: string | null;
|
|
131
|
+
results: ContextResult[];
|
|
132
|
+
usage?: ContextUsage | null;
|
|
133
|
+
}
|
|
76
134
|
export type SearchType = "web" | "fast";
|
|
77
135
|
export interface SearchOptions extends Pick<AgentToolOptions, "search_recency_filter" | "search_domain_filter"> {
|
|
78
136
|
search_type?: SearchType;
|
|
@@ -81,6 +139,8 @@ export interface AgentToolOptions {
|
|
|
81
139
|
search_recency_filter?: "hour" | "day" | "week" | "month" | "year";
|
|
82
140
|
search_domain_filter?: string[];
|
|
83
141
|
search_context_size?: "low" | "medium" | "high";
|
|
142
|
+
max_tokens?: number;
|
|
143
|
+
max_tokens_per_page?: number;
|
|
84
144
|
}
|
|
85
145
|
export interface AgentProgressUpdate {
|
|
86
146
|
message: string;
|
package/dist/validation.d.ts
CHANGED
|
@@ -986,19 +986,22 @@ export declare const SearchResultSchema: z.ZodObject<{
|
|
|
986
986
|
title: z.ZodString;
|
|
987
987
|
url: z.ZodString;
|
|
988
988
|
snippet: z.ZodOptional<z.ZodString>;
|
|
989
|
-
date: z.ZodOptional<z.ZodString
|
|
989
|
+
date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
990
|
+
last_updated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
990
991
|
score: z.ZodOptional<z.ZodNumber>;
|
|
991
992
|
}, "strip", z.ZodTypeAny, {
|
|
992
993
|
url: string;
|
|
993
994
|
title: string;
|
|
994
995
|
snippet?: string | undefined;
|
|
995
|
-
date?: string | undefined;
|
|
996
|
+
date?: string | null | undefined;
|
|
997
|
+
last_updated?: string | null | undefined;
|
|
996
998
|
score?: number | undefined;
|
|
997
999
|
}, {
|
|
998
1000
|
url: string;
|
|
999
1001
|
title: string;
|
|
1000
1002
|
snippet?: string | undefined;
|
|
1001
|
-
date?: string | undefined;
|
|
1003
|
+
date?: string | null | undefined;
|
|
1004
|
+
last_updated?: string | null | undefined;
|
|
1002
1005
|
score?: number | undefined;
|
|
1003
1006
|
}>;
|
|
1004
1007
|
export declare const SearchUsageSchema: z.ZodObject<{
|
|
@@ -1013,19 +1016,22 @@ export declare const SearchResponseSchema: z.ZodObject<{
|
|
|
1013
1016
|
title: z.ZodString;
|
|
1014
1017
|
url: z.ZodString;
|
|
1015
1018
|
snippet: z.ZodOptional<z.ZodString>;
|
|
1016
|
-
date: z.ZodOptional<z.ZodString
|
|
1019
|
+
date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1020
|
+
last_updated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1017
1021
|
score: z.ZodOptional<z.ZodNumber>;
|
|
1018
1022
|
}, "strip", z.ZodTypeAny, {
|
|
1019
1023
|
url: string;
|
|
1020
1024
|
title: string;
|
|
1021
1025
|
snippet?: string | undefined;
|
|
1022
|
-
date?: string | undefined;
|
|
1026
|
+
date?: string | null | undefined;
|
|
1027
|
+
last_updated?: string | null | undefined;
|
|
1023
1028
|
score?: number | undefined;
|
|
1024
1029
|
}, {
|
|
1025
1030
|
url: string;
|
|
1026
1031
|
title: string;
|
|
1027
1032
|
snippet?: string | undefined;
|
|
1028
|
-
date?: string | undefined;
|
|
1033
|
+
date?: string | null | undefined;
|
|
1034
|
+
last_updated?: string | null | undefined;
|
|
1029
1035
|
score?: number | undefined;
|
|
1030
1036
|
}>, "many">;
|
|
1031
1037
|
query: z.ZodOptional<z.ZodString>;
|
|
@@ -1041,7 +1047,8 @@ export declare const SearchResponseSchema: z.ZodObject<{
|
|
|
1041
1047
|
url: string;
|
|
1042
1048
|
title: string;
|
|
1043
1049
|
snippet?: string | undefined;
|
|
1044
|
-
date?: string | undefined;
|
|
1050
|
+
date?: string | null | undefined;
|
|
1051
|
+
last_updated?: string | null | undefined;
|
|
1045
1052
|
score?: number | undefined;
|
|
1046
1053
|
}[];
|
|
1047
1054
|
usage?: {
|
|
@@ -1053,7 +1060,8 @@ export declare const SearchResponseSchema: z.ZodObject<{
|
|
|
1053
1060
|
url: string;
|
|
1054
1061
|
title: string;
|
|
1055
1062
|
snippet?: string | undefined;
|
|
1056
|
-
date?: string | undefined;
|
|
1063
|
+
date?: string | null | undefined;
|
|
1064
|
+
last_updated?: string | null | undefined;
|
|
1057
1065
|
score?: number | undefined;
|
|
1058
1066
|
}[];
|
|
1059
1067
|
usage?: {
|
|
@@ -1061,3 +1069,618 @@ export declare const SearchResponseSchema: z.ZodObject<{
|
|
|
1061
1069
|
} | undefined;
|
|
1062
1070
|
query?: string | undefined;
|
|
1063
1071
|
}>;
|
|
1072
|
+
export declare const ContextResultSchema: z.ZodObject<{
|
|
1073
|
+
url: z.ZodString;
|
|
1074
|
+
status: z.ZodObject<{
|
|
1075
|
+
type: z.ZodString;
|
|
1076
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1077
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1078
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1079
|
+
type: z.ZodString;
|
|
1080
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1081
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1082
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1083
|
+
type: z.ZodString;
|
|
1084
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1085
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1086
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
1087
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1088
|
+
markdown: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1089
|
+
html: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1090
|
+
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
1091
|
+
highlights: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1092
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1093
|
+
type: z.ZodString;
|
|
1094
|
+
noul: z.ZodNumber;
|
|
1095
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1096
|
+
type: z.ZodString;
|
|
1097
|
+
noul: z.ZodNumber;
|
|
1098
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1099
|
+
type: z.ZodString;
|
|
1100
|
+
noul: z.ZodNumber;
|
|
1101
|
+
}, z.ZodTypeAny, "passthrough">>>>>;
|
|
1102
|
+
criteria_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1103
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1104
|
+
url: z.ZodString;
|
|
1105
|
+
status: z.ZodObject<{
|
|
1106
|
+
type: z.ZodString;
|
|
1107
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1108
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1109
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1110
|
+
type: z.ZodString;
|
|
1111
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1112
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1113
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1114
|
+
type: z.ZodString;
|
|
1115
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1116
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1117
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
1118
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1119
|
+
markdown: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1120
|
+
html: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1121
|
+
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
1122
|
+
highlights: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1123
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1124
|
+
type: z.ZodString;
|
|
1125
|
+
noul: z.ZodNumber;
|
|
1126
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1127
|
+
type: z.ZodString;
|
|
1128
|
+
noul: z.ZodNumber;
|
|
1129
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1130
|
+
type: z.ZodString;
|
|
1131
|
+
noul: z.ZodNumber;
|
|
1132
|
+
}, z.ZodTypeAny, "passthrough">>>>>;
|
|
1133
|
+
criteria_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1134
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1135
|
+
url: z.ZodString;
|
|
1136
|
+
status: z.ZodObject<{
|
|
1137
|
+
type: z.ZodString;
|
|
1138
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1139
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1140
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1141
|
+
type: z.ZodString;
|
|
1142
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1143
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1144
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1145
|
+
type: z.ZodString;
|
|
1146
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1147
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1148
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
1149
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1150
|
+
markdown: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1151
|
+
html: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1152
|
+
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
1153
|
+
highlights: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1154
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1155
|
+
type: z.ZodString;
|
|
1156
|
+
noul: z.ZodNumber;
|
|
1157
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1158
|
+
type: z.ZodString;
|
|
1159
|
+
noul: z.ZodNumber;
|
|
1160
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1161
|
+
type: z.ZodString;
|
|
1162
|
+
noul: z.ZodNumber;
|
|
1163
|
+
}, z.ZodTypeAny, "passthrough">>>>>;
|
|
1164
|
+
criteria_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1165
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
1166
|
+
export declare const ContextUsageSchema: z.ZodObject<{
|
|
1167
|
+
fetched_urls: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1168
|
+
cost: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1169
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1170
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1171
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1172
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1173
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1174
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1175
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1176
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1177
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1178
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1179
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1180
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1181
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1182
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1183
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1184
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1185
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1186
|
+
fetched_urls: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1187
|
+
cost: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1188
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1189
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1190
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1191
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1192
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1193
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1194
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1195
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1196
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1197
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1198
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1199
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1200
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1201
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1202
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1203
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1204
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1205
|
+
fetched_urls: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1206
|
+
cost: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1207
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1208
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1209
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1210
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1211
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1212
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1213
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1214
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1215
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1216
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1217
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1218
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1219
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1220
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1221
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1222
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1223
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
1224
|
+
export declare const ContextResponseSchema: z.ZodObject<{
|
|
1225
|
+
request_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1226
|
+
results: z.ZodArray<z.ZodObject<{
|
|
1227
|
+
url: z.ZodString;
|
|
1228
|
+
status: z.ZodObject<{
|
|
1229
|
+
type: z.ZodString;
|
|
1230
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1231
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1232
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1233
|
+
type: z.ZodString;
|
|
1234
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1235
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1236
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1237
|
+
type: z.ZodString;
|
|
1238
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1239
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1240
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
1241
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1242
|
+
markdown: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1243
|
+
html: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1244
|
+
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
1245
|
+
highlights: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1246
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1247
|
+
type: z.ZodString;
|
|
1248
|
+
noul: z.ZodNumber;
|
|
1249
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1250
|
+
type: z.ZodString;
|
|
1251
|
+
noul: z.ZodNumber;
|
|
1252
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1253
|
+
type: z.ZodString;
|
|
1254
|
+
noul: z.ZodNumber;
|
|
1255
|
+
}, z.ZodTypeAny, "passthrough">>>>>;
|
|
1256
|
+
criteria_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1257
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1258
|
+
url: z.ZodString;
|
|
1259
|
+
status: z.ZodObject<{
|
|
1260
|
+
type: z.ZodString;
|
|
1261
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1262
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1263
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1264
|
+
type: z.ZodString;
|
|
1265
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1266
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1267
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1268
|
+
type: z.ZodString;
|
|
1269
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1270
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1271
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
1272
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1273
|
+
markdown: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1274
|
+
html: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1275
|
+
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
1276
|
+
highlights: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1277
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1278
|
+
type: z.ZodString;
|
|
1279
|
+
noul: z.ZodNumber;
|
|
1280
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1281
|
+
type: z.ZodString;
|
|
1282
|
+
noul: z.ZodNumber;
|
|
1283
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1284
|
+
type: z.ZodString;
|
|
1285
|
+
noul: z.ZodNumber;
|
|
1286
|
+
}, z.ZodTypeAny, "passthrough">>>>>;
|
|
1287
|
+
criteria_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1288
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1289
|
+
url: z.ZodString;
|
|
1290
|
+
status: z.ZodObject<{
|
|
1291
|
+
type: z.ZodString;
|
|
1292
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1293
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1294
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1295
|
+
type: z.ZodString;
|
|
1296
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1297
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1298
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1299
|
+
type: z.ZodString;
|
|
1300
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1301
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1302
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
1303
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1304
|
+
markdown: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1305
|
+
html: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1306
|
+
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
1307
|
+
highlights: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1308
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1309
|
+
type: z.ZodString;
|
|
1310
|
+
noul: z.ZodNumber;
|
|
1311
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1312
|
+
type: z.ZodString;
|
|
1313
|
+
noul: z.ZodNumber;
|
|
1314
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1315
|
+
type: z.ZodString;
|
|
1316
|
+
noul: z.ZodNumber;
|
|
1317
|
+
}, z.ZodTypeAny, "passthrough">>>>>;
|
|
1318
|
+
criteria_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1319
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
1320
|
+
usage: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1321
|
+
fetched_urls: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1322
|
+
cost: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1323
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1324
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1325
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1326
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1327
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1328
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1329
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1330
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1331
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1332
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1333
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1334
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1335
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1336
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1337
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1338
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1339
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1340
|
+
fetched_urls: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1341
|
+
cost: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1342
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1343
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1344
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1345
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1346
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1347
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1348
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1349
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1350
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1351
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1352
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1353
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1354
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1355
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1356
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1357
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1358
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1359
|
+
fetched_urls: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1360
|
+
cost: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1361
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1362
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1363
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1364
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1365
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1366
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1367
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1368
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1369
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1370
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1371
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1372
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1373
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1374
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1375
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1376
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1377
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1378
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1379
|
+
request_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1380
|
+
results: z.ZodArray<z.ZodObject<{
|
|
1381
|
+
url: z.ZodString;
|
|
1382
|
+
status: z.ZodObject<{
|
|
1383
|
+
type: z.ZodString;
|
|
1384
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1385
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1386
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1387
|
+
type: z.ZodString;
|
|
1388
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1389
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1390
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1391
|
+
type: z.ZodString;
|
|
1392
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1393
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1394
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
1395
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1396
|
+
markdown: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1397
|
+
html: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1398
|
+
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
1399
|
+
highlights: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1400
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1401
|
+
type: z.ZodString;
|
|
1402
|
+
noul: z.ZodNumber;
|
|
1403
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1404
|
+
type: z.ZodString;
|
|
1405
|
+
noul: z.ZodNumber;
|
|
1406
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1407
|
+
type: z.ZodString;
|
|
1408
|
+
noul: z.ZodNumber;
|
|
1409
|
+
}, z.ZodTypeAny, "passthrough">>>>>;
|
|
1410
|
+
criteria_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1411
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1412
|
+
url: z.ZodString;
|
|
1413
|
+
status: z.ZodObject<{
|
|
1414
|
+
type: z.ZodString;
|
|
1415
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1416
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1417
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1418
|
+
type: z.ZodString;
|
|
1419
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1420
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1421
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1422
|
+
type: z.ZodString;
|
|
1423
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1424
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1425
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
1426
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1427
|
+
markdown: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1428
|
+
html: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1429
|
+
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
1430
|
+
highlights: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1431
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1432
|
+
type: z.ZodString;
|
|
1433
|
+
noul: z.ZodNumber;
|
|
1434
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1435
|
+
type: z.ZodString;
|
|
1436
|
+
noul: z.ZodNumber;
|
|
1437
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1438
|
+
type: z.ZodString;
|
|
1439
|
+
noul: z.ZodNumber;
|
|
1440
|
+
}, z.ZodTypeAny, "passthrough">>>>>;
|
|
1441
|
+
criteria_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1442
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1443
|
+
url: z.ZodString;
|
|
1444
|
+
status: z.ZodObject<{
|
|
1445
|
+
type: z.ZodString;
|
|
1446
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1447
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1448
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1449
|
+
type: z.ZodString;
|
|
1450
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1451
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1452
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1453
|
+
type: z.ZodString;
|
|
1454
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1455
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1456
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
1457
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1458
|
+
markdown: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1459
|
+
html: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1460
|
+
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
1461
|
+
highlights: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1462
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1463
|
+
type: z.ZodString;
|
|
1464
|
+
noul: z.ZodNumber;
|
|
1465
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1466
|
+
type: z.ZodString;
|
|
1467
|
+
noul: z.ZodNumber;
|
|
1468
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1469
|
+
type: z.ZodString;
|
|
1470
|
+
noul: z.ZodNumber;
|
|
1471
|
+
}, z.ZodTypeAny, "passthrough">>>>>;
|
|
1472
|
+
criteria_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1473
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
1474
|
+
usage: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1475
|
+
fetched_urls: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1476
|
+
cost: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1477
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1478
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1479
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1480
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1481
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1482
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1483
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1484
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1485
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1486
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1487
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1488
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1489
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1490
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1491
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1492
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1493
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1494
|
+
fetched_urls: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1495
|
+
cost: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1496
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1497
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1498
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1499
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1500
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1501
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1502
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1503
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1504
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1505
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1506
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1507
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1508
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1509
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1510
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1511
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1512
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1513
|
+
fetched_urls: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1514
|
+
cost: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1515
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1516
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1517
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1518
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1519
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1520
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1521
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1522
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1523
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1524
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1525
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1526
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1527
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1528
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1529
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1530
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1531
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1532
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1533
|
+
request_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1534
|
+
results: z.ZodArray<z.ZodObject<{
|
|
1535
|
+
url: z.ZodString;
|
|
1536
|
+
status: z.ZodObject<{
|
|
1537
|
+
type: z.ZodString;
|
|
1538
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1539
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1540
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1541
|
+
type: z.ZodString;
|
|
1542
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1543
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1544
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1545
|
+
type: z.ZodString;
|
|
1546
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1547
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1548
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
1549
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1550
|
+
markdown: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1551
|
+
html: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1552
|
+
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
1553
|
+
highlights: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1554
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1555
|
+
type: z.ZodString;
|
|
1556
|
+
noul: z.ZodNumber;
|
|
1557
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1558
|
+
type: z.ZodString;
|
|
1559
|
+
noul: z.ZodNumber;
|
|
1560
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1561
|
+
type: z.ZodString;
|
|
1562
|
+
noul: z.ZodNumber;
|
|
1563
|
+
}, z.ZodTypeAny, "passthrough">>>>>;
|
|
1564
|
+
criteria_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1565
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1566
|
+
url: z.ZodString;
|
|
1567
|
+
status: z.ZodObject<{
|
|
1568
|
+
type: z.ZodString;
|
|
1569
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1570
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1571
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1572
|
+
type: z.ZodString;
|
|
1573
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1574
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1575
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1576
|
+
type: z.ZodString;
|
|
1577
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1578
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1579
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
1580
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1581
|
+
markdown: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1582
|
+
html: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1583
|
+
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
1584
|
+
highlights: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1585
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1586
|
+
type: z.ZodString;
|
|
1587
|
+
noul: z.ZodNumber;
|
|
1588
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1589
|
+
type: z.ZodString;
|
|
1590
|
+
noul: z.ZodNumber;
|
|
1591
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1592
|
+
type: z.ZodString;
|
|
1593
|
+
noul: z.ZodNumber;
|
|
1594
|
+
}, z.ZodTypeAny, "passthrough">>>>>;
|
|
1595
|
+
criteria_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1596
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1597
|
+
url: z.ZodString;
|
|
1598
|
+
status: z.ZodObject<{
|
|
1599
|
+
type: z.ZodString;
|
|
1600
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1601
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1602
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1603
|
+
type: z.ZodString;
|
|
1604
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1605
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1606
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1607
|
+
type: z.ZodString;
|
|
1608
|
+
status_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1609
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1610
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
1611
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1612
|
+
markdown: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1613
|
+
html: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1614
|
+
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
1615
|
+
highlights: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1616
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1617
|
+
type: z.ZodString;
|
|
1618
|
+
noul: z.ZodNumber;
|
|
1619
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1620
|
+
type: z.ZodString;
|
|
1621
|
+
noul: z.ZodNumber;
|
|
1622
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1623
|
+
type: z.ZodString;
|
|
1624
|
+
noul: z.ZodNumber;
|
|
1625
|
+
}, z.ZodTypeAny, "passthrough">>>>>;
|
|
1626
|
+
criteria_error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1627
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
1628
|
+
usage: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1629
|
+
fetched_urls: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1630
|
+
cost: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1631
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1632
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1633
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1634
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1635
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1636
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1637
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1638
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1639
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1640
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1641
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1642
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1643
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1644
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1645
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1646
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1647
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1648
|
+
fetched_urls: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1649
|
+
cost: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1650
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1651
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1652
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1653
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1654
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1655
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1656
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1657
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1658
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1659
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1660
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1661
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1662
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1663
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1664
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1665
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1666
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1667
|
+
fetched_urls: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1668
|
+
cost: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1669
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1670
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1671
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1672
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1673
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1674
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1675
|
+
total_cost: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1676
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1677
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1678
|
+
criteria: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1679
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1680
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1681
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1682
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1683
|
+
input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1684
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1685
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1686
|
+
}, z.ZodTypeAny, "passthrough">>;
|
package/dist/validation.js
CHANGED
|
@@ -49,7 +49,8 @@ export const SearchResultSchema = z.object({
|
|
|
49
49
|
title: z.string(),
|
|
50
50
|
url: z.string(),
|
|
51
51
|
snippet: z.string().optional(),
|
|
52
|
-
date: z.string().
|
|
52
|
+
date: z.string().nullish(),
|
|
53
|
+
last_updated: z.string().nullish(),
|
|
53
54
|
score: z.number().optional(),
|
|
54
55
|
});
|
|
55
56
|
export const SearchUsageSchema = z.object({
|
|
@@ -60,3 +61,42 @@ export const SearchResponseSchema = z.object({
|
|
|
60
61
|
query: z.string().optional(),
|
|
61
62
|
usage: SearchUsageSchema.optional(),
|
|
62
63
|
});
|
|
64
|
+
// Context API response schemas. Lenient like the Agent schemas: metadata has
|
|
65
|
+
// open keys (page meta tags), and status.type, metadata.origin, and
|
|
66
|
+
// criteria_error stay plain strings so a new upstream value never fails parsing.
|
|
67
|
+
export const ContextResultSchema = z
|
|
68
|
+
.object({
|
|
69
|
+
url: z.string(),
|
|
70
|
+
status: z
|
|
71
|
+
.object({
|
|
72
|
+
type: z.string(),
|
|
73
|
+
status_code: z.number().nullish(),
|
|
74
|
+
message: z.string().nullish(),
|
|
75
|
+
})
|
|
76
|
+
.passthrough(),
|
|
77
|
+
metadata: z.record(z.unknown()).nullish(),
|
|
78
|
+
markdown: z.string().nullish(),
|
|
79
|
+
html: z.string().nullish(),
|
|
80
|
+
links: z.array(z.string()).nullish(),
|
|
81
|
+
highlights: z.string().nullish(),
|
|
82
|
+
criteria: z.record(z.object({ type: z.string(), noul: z.number() }).passthrough()).nullish(),
|
|
83
|
+
criteria_error: z.string().nullish(),
|
|
84
|
+
})
|
|
85
|
+
.passthrough();
|
|
86
|
+
export const ContextUsageSchema = z
|
|
87
|
+
.object({
|
|
88
|
+
fetched_urls: z.number().nullish(),
|
|
89
|
+
cost: z
|
|
90
|
+
.object({ total_cost: z.number().nullish(), currency: z.string().nullish() })
|
|
91
|
+
.passthrough()
|
|
92
|
+
.nullish(),
|
|
93
|
+
criteria: z.object({ input_tokens: z.number().nullish() }).passthrough().nullish(),
|
|
94
|
+
})
|
|
95
|
+
.passthrough();
|
|
96
|
+
export const ContextResponseSchema = z
|
|
97
|
+
.object({
|
|
98
|
+
request_id: z.string().nullish(),
|
|
99
|
+
results: z.array(ContextResultSchema),
|
|
100
|
+
usage: ContextUsageSchema.nullish(),
|
|
101
|
+
})
|
|
102
|
+
.passthrough();
|