valyu-js 2.5.8 → 2.6.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/README.md +65 -34
- package/dist/index.d.mts +79 -6
- package/dist/index.d.ts +79 -6
- package/dist/index.js +142 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +140 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -334,63 +334,94 @@ Each `SearchResult` contains:
|
|
|
334
334
|
|
|
335
335
|
The `contents()` method extracts clean, structured content from web pages with optional AI-powered data extraction and summarization. It accepts an array of URLs as the first parameter, followed by optional configuration parameters.
|
|
336
336
|
|
|
337
|
+
- **Sync mode** (≤10 URLs): Returns results immediately
|
|
338
|
+
- **Async mode** (>10 URLs or `async: true`): Returns a job object; use `getContentsJob()` or `waitForJob()` to get results
|
|
339
|
+
|
|
337
340
|
```javascript
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
maxPriceDollars: null, // Maximum cost limit in USD
|
|
345
|
-
}
|
|
346
|
-
);
|
|
341
|
+
// Sync (≤10 URLs)
|
|
342
|
+
const response = await valyu.contents(urls, { summary: true });
|
|
343
|
+
|
|
344
|
+
// Async (11-50 URLs) - returns job, then poll or wait
|
|
345
|
+
const job = await valyu.contents(urls, { async: true });
|
|
346
|
+
const final = await valyu.waitForJob(job.jobId, { pollInterval: 5000 });
|
|
347
347
|
```
|
|
348
348
|
|
|
349
349
|
### Parameters
|
|
350
350
|
|
|
351
351
|
| Parameter | Type | Default | Description |
|
|
352
352
|
| ----------------- | ----------------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
353
|
-
| `urls` | `string[]` | _required_ | Array of URLs to process (
|
|
353
|
+
| `urls` | `string[]` | _required_ | Array of URLs to process (max 10 sync, max 50 with `async: true`) |
|
|
354
354
|
| `summary` | `boolean \| string \| object` | `false` | AI summary configuration: `false` (raw content), `true` (auto summary), string (custom instructions), or JSON schema (structured extraction) |
|
|
355
|
-
| `extractEffort` | `string` | `"normal"` | Extraction thoroughness: `"normal"`
|
|
355
|
+
| `extractEffort` | `string` | `"normal"` | Extraction thoroughness: `"normal"`, `"high"`, or `"auto"` |
|
|
356
356
|
| `responseLength` | `string \| number` | `"short"` | Content length per URL: `"short"` (25k chars), `"medium"` (50k), `"large"` (100k), `"max"` (no limit), or custom number |
|
|
357
357
|
| `maxPriceDollars` | `number` | `null` | Maximum cost limit in USD |
|
|
358
|
+
| `screenshot` | `boolean` | `false` | Capture page screenshots |
|
|
359
|
+
| `async` | `boolean` | `false` | Force async processing (required for >10 URLs) |
|
|
360
|
+
| `webhookUrl` | `string` | - | HTTPS URL for completion notification (async only). Save `webhookSecret` for signature verification. |
|
|
358
361
|
|
|
359
|
-
### Contents Response Format
|
|
362
|
+
### Contents Response Format (Sync)
|
|
360
363
|
|
|
361
|
-
|
|
364
|
+
When sync, returns `ContentsResponse`:
|
|
362
365
|
|
|
363
366
|
```javascript
|
|
364
367
|
{
|
|
365
|
-
success: boolean,
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
total_characters: number // Total characters extracted
|
|
368
|
+
success: boolean,
|
|
369
|
+
tx_id: string,
|
|
370
|
+
urls_requested: number,
|
|
371
|
+
urls_processed: number,
|
|
372
|
+
urls_failed: number,
|
|
373
|
+
results: ContentResult[],
|
|
374
|
+
total_cost_dollars: number,
|
|
375
|
+
total_characters: number
|
|
374
376
|
}
|
|
375
377
|
```
|
|
376
378
|
|
|
377
|
-
|
|
379
|
+
### Contents Async Response
|
|
380
|
+
|
|
381
|
+
When async, returns `ContentsAsyncJobResponse` with `jobId`. Use `getContentsJob(jobId)` or `waitForJob(jobId)` to get results.
|
|
378
382
|
|
|
379
383
|
```javascript
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
384
|
+
// Poll for status
|
|
385
|
+
const status = await valyu.getContentsJob(jobId);
|
|
386
|
+
|
|
387
|
+
// Or wait until complete (like DeepResearch wait)
|
|
388
|
+
const final = await valyu.waitForJob(jobId, {
|
|
389
|
+
pollInterval: 5000,
|
|
390
|
+
maxWaitTime: 7200000,
|
|
391
|
+
onProgress: (s) => console.log(`${s.urlsProcessed}/${s.urlsTotal}`)
|
|
392
|
+
});
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### ContentResult (with status)
|
|
396
|
+
|
|
397
|
+
Each result has a `status` field. Check before accessing success-only fields:
|
|
398
|
+
|
|
399
|
+
```javascript
|
|
400
|
+
for (const r of response.results) {
|
|
401
|
+
if (r.status === 'success') {
|
|
402
|
+
console.log(r.title, r.content);
|
|
403
|
+
} else {
|
|
404
|
+
console.log(`Failed: ${r.url} - ${r.error}`);
|
|
405
|
+
}
|
|
391
406
|
}
|
|
392
407
|
```
|
|
393
408
|
|
|
409
|
+
### Webhook Signature Verification
|
|
410
|
+
|
|
411
|
+
When using `webhookUrl`, verify the `X-Webhook-Signature` header with the `webhookSecret` from job creation:
|
|
412
|
+
|
|
413
|
+
```javascript
|
|
414
|
+
const { verifyContentsWebhookSignature } = require('valyu-js');
|
|
415
|
+
|
|
416
|
+
// In your webhook handler - use raw request body
|
|
417
|
+
const isValid = verifyContentsWebhookSignature(
|
|
418
|
+
rawBody, // Raw request body string
|
|
419
|
+
signatureHeader, // X-Webhook-Signature
|
|
420
|
+
timestampHeader, // X-Webhook-Timestamp
|
|
421
|
+
webhookSecret
|
|
422
|
+
);
|
|
423
|
+
```
|
|
424
|
+
|
|
394
425
|
## Examples
|
|
395
426
|
|
|
396
427
|
### Basic Search
|
package/dist/index.d.mts
CHANGED
|
@@ -26,6 +26,7 @@ interface SearchOptions {
|
|
|
26
26
|
relevanceThreshold?: number;
|
|
27
27
|
includedSources?: string[];
|
|
28
28
|
excludeSources?: string[];
|
|
29
|
+
sourceBiases?: Record<string, number>;
|
|
29
30
|
category?: string;
|
|
30
31
|
startDate?: string;
|
|
31
32
|
endDate?: string;
|
|
@@ -59,22 +60,65 @@ interface ContentsOptions {
|
|
|
59
60
|
responseLength?: ContentResponseLength;
|
|
60
61
|
maxPriceDollars?: number;
|
|
61
62
|
screenshot?: boolean;
|
|
63
|
+
async?: boolean;
|
|
64
|
+
webhookUrl?: string;
|
|
62
65
|
}
|
|
63
|
-
interface
|
|
66
|
+
interface ContentResultBase {
|
|
64
67
|
url: string;
|
|
68
|
+
status: "success" | "failed";
|
|
69
|
+
}
|
|
70
|
+
interface ContentResultSuccess extends ContentResultBase {
|
|
71
|
+
status: "success";
|
|
65
72
|
title: string;
|
|
66
73
|
content: string | number;
|
|
67
74
|
length: number;
|
|
68
75
|
source: string;
|
|
69
|
-
price
|
|
76
|
+
price?: number;
|
|
70
77
|
description?: string;
|
|
71
78
|
summary?: string | object;
|
|
72
79
|
summary_success?: boolean;
|
|
73
80
|
data_type?: string;
|
|
74
81
|
image_url?: Record<string, string>;
|
|
75
82
|
screenshot_url?: string | null;
|
|
83
|
+
source_type?: string;
|
|
84
|
+
publication_date?: string;
|
|
76
85
|
citation?: string;
|
|
77
86
|
}
|
|
87
|
+
interface ContentResultFailed extends ContentResultBase {
|
|
88
|
+
status: "failed";
|
|
89
|
+
error: string;
|
|
90
|
+
}
|
|
91
|
+
type ContentResult = ContentResultSuccess | ContentResultFailed;
|
|
92
|
+
type ContentsJobStatus = "pending" | "processing" | "completed" | "partial" | "failed";
|
|
93
|
+
interface ContentsJobWaitOptions {
|
|
94
|
+
pollInterval?: number;
|
|
95
|
+
maxWaitTime?: number;
|
|
96
|
+
onProgress?: (status: ContentsJobResponse) => void;
|
|
97
|
+
}
|
|
98
|
+
interface ContentsJobResponse {
|
|
99
|
+
success: boolean;
|
|
100
|
+
jobId: string;
|
|
101
|
+
status: ContentsJobStatus;
|
|
102
|
+
urlsTotal: number;
|
|
103
|
+
urlsProcessed: number;
|
|
104
|
+
urlsFailed: number;
|
|
105
|
+
createdAt: number;
|
|
106
|
+
updatedAt: number;
|
|
107
|
+
currentBatch?: number;
|
|
108
|
+
totalBatches?: number;
|
|
109
|
+
results?: ContentResult[];
|
|
110
|
+
actualCostDollars?: number;
|
|
111
|
+
error?: string;
|
|
112
|
+
webhookSecret?: string;
|
|
113
|
+
}
|
|
114
|
+
interface ContentsAsyncJobResponse {
|
|
115
|
+
success: boolean;
|
|
116
|
+
jobId: string;
|
|
117
|
+
status: "pending";
|
|
118
|
+
urlsTotal: number;
|
|
119
|
+
webhookSecret?: string;
|
|
120
|
+
txId: string;
|
|
121
|
+
}
|
|
78
122
|
interface ContentsResponse {
|
|
79
123
|
success: boolean;
|
|
80
124
|
error?: string | null;
|
|
@@ -210,6 +254,7 @@ interface DeepResearchSearchConfig {
|
|
|
210
254
|
searchType?: "all" | "web" | "proprietary";
|
|
211
255
|
includedSources?: string[];
|
|
212
256
|
excludedSources?: string[];
|
|
257
|
+
sourceBiases?: Record<string, number>;
|
|
213
258
|
startDate?: string;
|
|
214
259
|
endDate?: string;
|
|
215
260
|
category?: string;
|
|
@@ -222,6 +267,8 @@ interface DeepResearchCreateOptions {
|
|
|
222
267
|
model?: DeepResearchMode;
|
|
223
268
|
outputFormats?: DeepResearchOutputFormat[];
|
|
224
269
|
strategy?: string;
|
|
270
|
+
researchStrategy?: string;
|
|
271
|
+
reportFormat?: string;
|
|
225
272
|
search?: DeepResearchSearchConfig;
|
|
226
273
|
urls?: string[];
|
|
227
274
|
files?: FileAttachment[];
|
|
@@ -428,6 +475,8 @@ interface BatchTaskInput {
|
|
|
428
475
|
query?: string;
|
|
429
476
|
input?: string;
|
|
430
477
|
strategy?: string;
|
|
478
|
+
researchStrategy?: string;
|
|
479
|
+
reportFormat?: string;
|
|
431
480
|
urls?: string[];
|
|
432
481
|
metadata?: Record<string, string | number | boolean>;
|
|
433
482
|
}
|
|
@@ -576,6 +625,15 @@ interface DatasourcesCategoriesResponse {
|
|
|
576
625
|
error?: string;
|
|
577
626
|
}
|
|
578
627
|
|
|
628
|
+
/**
|
|
629
|
+
* Verify webhook signature for Contents API async completion notifications.
|
|
630
|
+
* Use the raw request body (not parsed JSON) as payload.
|
|
631
|
+
* @param payload - Raw request body string
|
|
632
|
+
* @param signature - X-Webhook-Signature header value
|
|
633
|
+
* @param timestamp - X-Webhook-Timestamp header value
|
|
634
|
+
* @param secret - webhookSecret from job creation
|
|
635
|
+
*/
|
|
636
|
+
declare function verifyContentsWebhookSignature(payload: string, signature: string, timestamp: string, secret: string): boolean;
|
|
579
637
|
declare class Valyu {
|
|
580
638
|
private baseUrl;
|
|
581
639
|
private headers;
|
|
@@ -652,16 +710,31 @@ declare class Valyu {
|
|
|
652
710
|
search(query: string, options?: SearchOptions): Promise<SearchResponse>;
|
|
653
711
|
/**
|
|
654
712
|
* Extract content from URLs with optional AI processing
|
|
655
|
-
* @param urls - Array of URLs to process (max 10)
|
|
713
|
+
* @param urls - Array of URLs to process (max 10 sync, max 50 with async: true)
|
|
656
714
|
* @param options - Content extraction configuration options
|
|
657
715
|
* @param options.summary - AI summary configuration: false (raw), true (auto), string (custom), or JSON schema
|
|
658
716
|
* @param options.extractEffort - Extraction thoroughness: "normal", "high", or "auto"
|
|
659
717
|
* @param options.responseLength - Content length per URL
|
|
660
718
|
* @param options.maxPriceDollars - Maximum cost limit in USD
|
|
661
719
|
* @param options.screenshot - Request page screenshots (default: false)
|
|
662
|
-
* @
|
|
720
|
+
* @param options.async - Force async processing (required for >10 URLs)
|
|
721
|
+
* @param options.webhookUrl - HTTPS URL for completion notification (async only)
|
|
722
|
+
* @returns Promise resolving to sync results or async job (when async: true or >10 URLs)
|
|
723
|
+
*/
|
|
724
|
+
contents(urls: string[], options?: ContentsOptions): Promise<ContentsResponse | ContentsAsyncJobResponse>;
|
|
725
|
+
/**
|
|
726
|
+
* Get async Contents job status and results
|
|
727
|
+
* @param jobId - Job ID from contents() async response
|
|
728
|
+
* @returns Promise resolving to job status
|
|
729
|
+
*/
|
|
730
|
+
getContentsJob(jobId: string): Promise<ContentsJobResponse>;
|
|
731
|
+
/**
|
|
732
|
+
* Wait for async Contents job completion (polls until terminal state)
|
|
733
|
+
* @param jobId - Job ID from contents() async response
|
|
734
|
+
* @param options - Wait configuration (pollInterval, maxWaitTime, onProgress)
|
|
735
|
+
* @returns Promise resolving to final job status with results
|
|
663
736
|
*/
|
|
664
|
-
|
|
737
|
+
waitForJob(jobId: string, options?: ContentsJobWaitOptions): Promise<ContentsJobResponse>;
|
|
665
738
|
/**
|
|
666
739
|
* DeepResearch: Create a new research task
|
|
667
740
|
* @param options.search - Search configuration options
|
|
@@ -826,4 +899,4 @@ declare class Valyu {
|
|
|
826
899
|
private _datasourcesCategories;
|
|
827
900
|
}
|
|
828
901
|
|
|
829
|
-
export { type AIUsage, type AddBatchTasksOptions, type AddBatchTasksResponse, type AlertEmailConfig, type AnswerErrorResponse, type AnswerOptions, type AnswerResponse, type AnswerStreamChunk, type AnswerStreamChunkType, type AnswerSuccessResponse, type BatchCounts, type BatchPagination, type BatchStatus, type BatchStatusResponse, type BatchTaskCreated, type BatchTaskInput, type BatchTaskListItem, type BatchWaitOptions, type CancelBatchResponse, type ChartDataPoint, type ChartDataSeries, type ChartType, type ContentResponseLength, type ContentResult, type ContentsOptions, type ContentsResponse, type Cost, type CountryCode, type CreateBatchOptions, type CreateBatchResponse, type Datasource, type DatasourceCategory, type DatasourceCategoryId, type DatasourceCoverage, type DatasourceModality, type DatasourcePricing, type DatasourcesCategoriesResponse, type DatasourcesListOptions, type DatasourcesListResponse, type DeepResearchBatch, type DeepResearchCancelResponse, type DeepResearchCreateOptions, type DeepResearchCreateResponse, type DeepResearchDeleteResponse, type DeepResearchGetAssetsOptions, type DeepResearchGetAssetsResponse, type DeepResearchListResponse, type DeepResearchMode, type DeepResearchOutputFormat, type DeepResearchSearchConfig, type DeepResearchSource, type DeepResearchStatus, type DeepResearchStatusResponse, type DeepResearchTaskListItem, type DeepResearchTogglePublicResponse, type DeepResearchUpdateResponse, type DeepResearchUsage, type ExtractEffort, type ExtractionMetadata, type FeedbackResponse, type FeedbackSentiment, type FileAttachment, type ImageMetadata, type ImageType, type ListBatchTasksOptions, type ListBatchTasksResponse, type ListBatchesOptions, type ListBatchesResponse, type ListOptions, type MCPServerConfig, type Progress, type ResponseLength, type SearchMetadata, type SearchOptions, type SearchResponse, type SearchResult, type SearchType, type StreamCallback, Valyu, type WaitOptions };
|
|
902
|
+
export { type AIUsage, type AddBatchTasksOptions, type AddBatchTasksResponse, type AlertEmailConfig, type AnswerErrorResponse, type AnswerOptions, type AnswerResponse, type AnswerStreamChunk, type AnswerStreamChunkType, type AnswerSuccessResponse, type BatchCounts, type BatchPagination, type BatchStatus, type BatchStatusResponse, type BatchTaskCreated, type BatchTaskInput, type BatchTaskListItem, type BatchWaitOptions, type CancelBatchResponse, type ChartDataPoint, type ChartDataSeries, type ChartType, type ContentResponseLength, type ContentResult, type ContentResultFailed, type ContentResultSuccess, type ContentsAsyncJobResponse, type ContentsJobResponse, type ContentsJobStatus, type ContentsJobWaitOptions, type ContentsOptions, type ContentsResponse, type Cost, type CountryCode, type CreateBatchOptions, type CreateBatchResponse, type Datasource, type DatasourceCategory, type DatasourceCategoryId, type DatasourceCoverage, type DatasourceModality, type DatasourcePricing, type DatasourcesCategoriesResponse, type DatasourcesListOptions, type DatasourcesListResponse, type DeepResearchBatch, type DeepResearchCancelResponse, type DeepResearchCreateOptions, type DeepResearchCreateResponse, type DeepResearchDeleteResponse, type DeepResearchGetAssetsOptions, type DeepResearchGetAssetsResponse, type DeepResearchListResponse, type DeepResearchMode, type DeepResearchOutputFormat, type DeepResearchSearchConfig, type DeepResearchSource, type DeepResearchStatus, type DeepResearchStatusResponse, type DeepResearchTaskListItem, type DeepResearchTogglePublicResponse, type DeepResearchUpdateResponse, type DeepResearchUsage, type ExtractEffort, type ExtractionMetadata, type FeedbackResponse, type FeedbackSentiment, type FileAttachment, type ImageMetadata, type ImageType, type ListBatchTasksOptions, type ListBatchTasksResponse, type ListBatchesOptions, type ListBatchesResponse, type ListOptions, type MCPServerConfig, type Progress, type ResponseLength, type SearchMetadata, type SearchOptions, type SearchResponse, type SearchResult, type SearchType, type StreamCallback, Valyu, type WaitOptions, verifyContentsWebhookSignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ interface SearchOptions {
|
|
|
26
26
|
relevanceThreshold?: number;
|
|
27
27
|
includedSources?: string[];
|
|
28
28
|
excludeSources?: string[];
|
|
29
|
+
sourceBiases?: Record<string, number>;
|
|
29
30
|
category?: string;
|
|
30
31
|
startDate?: string;
|
|
31
32
|
endDate?: string;
|
|
@@ -59,22 +60,65 @@ interface ContentsOptions {
|
|
|
59
60
|
responseLength?: ContentResponseLength;
|
|
60
61
|
maxPriceDollars?: number;
|
|
61
62
|
screenshot?: boolean;
|
|
63
|
+
async?: boolean;
|
|
64
|
+
webhookUrl?: string;
|
|
62
65
|
}
|
|
63
|
-
interface
|
|
66
|
+
interface ContentResultBase {
|
|
64
67
|
url: string;
|
|
68
|
+
status: "success" | "failed";
|
|
69
|
+
}
|
|
70
|
+
interface ContentResultSuccess extends ContentResultBase {
|
|
71
|
+
status: "success";
|
|
65
72
|
title: string;
|
|
66
73
|
content: string | number;
|
|
67
74
|
length: number;
|
|
68
75
|
source: string;
|
|
69
|
-
price
|
|
76
|
+
price?: number;
|
|
70
77
|
description?: string;
|
|
71
78
|
summary?: string | object;
|
|
72
79
|
summary_success?: boolean;
|
|
73
80
|
data_type?: string;
|
|
74
81
|
image_url?: Record<string, string>;
|
|
75
82
|
screenshot_url?: string | null;
|
|
83
|
+
source_type?: string;
|
|
84
|
+
publication_date?: string;
|
|
76
85
|
citation?: string;
|
|
77
86
|
}
|
|
87
|
+
interface ContentResultFailed extends ContentResultBase {
|
|
88
|
+
status: "failed";
|
|
89
|
+
error: string;
|
|
90
|
+
}
|
|
91
|
+
type ContentResult = ContentResultSuccess | ContentResultFailed;
|
|
92
|
+
type ContentsJobStatus = "pending" | "processing" | "completed" | "partial" | "failed";
|
|
93
|
+
interface ContentsJobWaitOptions {
|
|
94
|
+
pollInterval?: number;
|
|
95
|
+
maxWaitTime?: number;
|
|
96
|
+
onProgress?: (status: ContentsJobResponse) => void;
|
|
97
|
+
}
|
|
98
|
+
interface ContentsJobResponse {
|
|
99
|
+
success: boolean;
|
|
100
|
+
jobId: string;
|
|
101
|
+
status: ContentsJobStatus;
|
|
102
|
+
urlsTotal: number;
|
|
103
|
+
urlsProcessed: number;
|
|
104
|
+
urlsFailed: number;
|
|
105
|
+
createdAt: number;
|
|
106
|
+
updatedAt: number;
|
|
107
|
+
currentBatch?: number;
|
|
108
|
+
totalBatches?: number;
|
|
109
|
+
results?: ContentResult[];
|
|
110
|
+
actualCostDollars?: number;
|
|
111
|
+
error?: string;
|
|
112
|
+
webhookSecret?: string;
|
|
113
|
+
}
|
|
114
|
+
interface ContentsAsyncJobResponse {
|
|
115
|
+
success: boolean;
|
|
116
|
+
jobId: string;
|
|
117
|
+
status: "pending";
|
|
118
|
+
urlsTotal: number;
|
|
119
|
+
webhookSecret?: string;
|
|
120
|
+
txId: string;
|
|
121
|
+
}
|
|
78
122
|
interface ContentsResponse {
|
|
79
123
|
success: boolean;
|
|
80
124
|
error?: string | null;
|
|
@@ -210,6 +254,7 @@ interface DeepResearchSearchConfig {
|
|
|
210
254
|
searchType?: "all" | "web" | "proprietary";
|
|
211
255
|
includedSources?: string[];
|
|
212
256
|
excludedSources?: string[];
|
|
257
|
+
sourceBiases?: Record<string, number>;
|
|
213
258
|
startDate?: string;
|
|
214
259
|
endDate?: string;
|
|
215
260
|
category?: string;
|
|
@@ -222,6 +267,8 @@ interface DeepResearchCreateOptions {
|
|
|
222
267
|
model?: DeepResearchMode;
|
|
223
268
|
outputFormats?: DeepResearchOutputFormat[];
|
|
224
269
|
strategy?: string;
|
|
270
|
+
researchStrategy?: string;
|
|
271
|
+
reportFormat?: string;
|
|
225
272
|
search?: DeepResearchSearchConfig;
|
|
226
273
|
urls?: string[];
|
|
227
274
|
files?: FileAttachment[];
|
|
@@ -428,6 +475,8 @@ interface BatchTaskInput {
|
|
|
428
475
|
query?: string;
|
|
429
476
|
input?: string;
|
|
430
477
|
strategy?: string;
|
|
478
|
+
researchStrategy?: string;
|
|
479
|
+
reportFormat?: string;
|
|
431
480
|
urls?: string[];
|
|
432
481
|
metadata?: Record<string, string | number | boolean>;
|
|
433
482
|
}
|
|
@@ -576,6 +625,15 @@ interface DatasourcesCategoriesResponse {
|
|
|
576
625
|
error?: string;
|
|
577
626
|
}
|
|
578
627
|
|
|
628
|
+
/**
|
|
629
|
+
* Verify webhook signature for Contents API async completion notifications.
|
|
630
|
+
* Use the raw request body (not parsed JSON) as payload.
|
|
631
|
+
* @param payload - Raw request body string
|
|
632
|
+
* @param signature - X-Webhook-Signature header value
|
|
633
|
+
* @param timestamp - X-Webhook-Timestamp header value
|
|
634
|
+
* @param secret - webhookSecret from job creation
|
|
635
|
+
*/
|
|
636
|
+
declare function verifyContentsWebhookSignature(payload: string, signature: string, timestamp: string, secret: string): boolean;
|
|
579
637
|
declare class Valyu {
|
|
580
638
|
private baseUrl;
|
|
581
639
|
private headers;
|
|
@@ -652,16 +710,31 @@ declare class Valyu {
|
|
|
652
710
|
search(query: string, options?: SearchOptions): Promise<SearchResponse>;
|
|
653
711
|
/**
|
|
654
712
|
* Extract content from URLs with optional AI processing
|
|
655
|
-
* @param urls - Array of URLs to process (max 10)
|
|
713
|
+
* @param urls - Array of URLs to process (max 10 sync, max 50 with async: true)
|
|
656
714
|
* @param options - Content extraction configuration options
|
|
657
715
|
* @param options.summary - AI summary configuration: false (raw), true (auto), string (custom), or JSON schema
|
|
658
716
|
* @param options.extractEffort - Extraction thoroughness: "normal", "high", or "auto"
|
|
659
717
|
* @param options.responseLength - Content length per URL
|
|
660
718
|
* @param options.maxPriceDollars - Maximum cost limit in USD
|
|
661
719
|
* @param options.screenshot - Request page screenshots (default: false)
|
|
662
|
-
* @
|
|
720
|
+
* @param options.async - Force async processing (required for >10 URLs)
|
|
721
|
+
* @param options.webhookUrl - HTTPS URL for completion notification (async only)
|
|
722
|
+
* @returns Promise resolving to sync results or async job (when async: true or >10 URLs)
|
|
723
|
+
*/
|
|
724
|
+
contents(urls: string[], options?: ContentsOptions): Promise<ContentsResponse | ContentsAsyncJobResponse>;
|
|
725
|
+
/**
|
|
726
|
+
* Get async Contents job status and results
|
|
727
|
+
* @param jobId - Job ID from contents() async response
|
|
728
|
+
* @returns Promise resolving to job status
|
|
729
|
+
*/
|
|
730
|
+
getContentsJob(jobId: string): Promise<ContentsJobResponse>;
|
|
731
|
+
/**
|
|
732
|
+
* Wait for async Contents job completion (polls until terminal state)
|
|
733
|
+
* @param jobId - Job ID from contents() async response
|
|
734
|
+
* @param options - Wait configuration (pollInterval, maxWaitTime, onProgress)
|
|
735
|
+
* @returns Promise resolving to final job status with results
|
|
663
736
|
*/
|
|
664
|
-
|
|
737
|
+
waitForJob(jobId: string, options?: ContentsJobWaitOptions): Promise<ContentsJobResponse>;
|
|
665
738
|
/**
|
|
666
739
|
* DeepResearch: Create a new research task
|
|
667
740
|
* @param options.search - Search configuration options
|
|
@@ -826,4 +899,4 @@ declare class Valyu {
|
|
|
826
899
|
private _datasourcesCategories;
|
|
827
900
|
}
|
|
828
901
|
|
|
829
|
-
export { type AIUsage, type AddBatchTasksOptions, type AddBatchTasksResponse, type AlertEmailConfig, type AnswerErrorResponse, type AnswerOptions, type AnswerResponse, type AnswerStreamChunk, type AnswerStreamChunkType, type AnswerSuccessResponse, type BatchCounts, type BatchPagination, type BatchStatus, type BatchStatusResponse, type BatchTaskCreated, type BatchTaskInput, type BatchTaskListItem, type BatchWaitOptions, type CancelBatchResponse, type ChartDataPoint, type ChartDataSeries, type ChartType, type ContentResponseLength, type ContentResult, type ContentsOptions, type ContentsResponse, type Cost, type CountryCode, type CreateBatchOptions, type CreateBatchResponse, type Datasource, type DatasourceCategory, type DatasourceCategoryId, type DatasourceCoverage, type DatasourceModality, type DatasourcePricing, type DatasourcesCategoriesResponse, type DatasourcesListOptions, type DatasourcesListResponse, type DeepResearchBatch, type DeepResearchCancelResponse, type DeepResearchCreateOptions, type DeepResearchCreateResponse, type DeepResearchDeleteResponse, type DeepResearchGetAssetsOptions, type DeepResearchGetAssetsResponse, type DeepResearchListResponse, type DeepResearchMode, type DeepResearchOutputFormat, type DeepResearchSearchConfig, type DeepResearchSource, type DeepResearchStatus, type DeepResearchStatusResponse, type DeepResearchTaskListItem, type DeepResearchTogglePublicResponse, type DeepResearchUpdateResponse, type DeepResearchUsage, type ExtractEffort, type ExtractionMetadata, type FeedbackResponse, type FeedbackSentiment, type FileAttachment, type ImageMetadata, type ImageType, type ListBatchTasksOptions, type ListBatchTasksResponse, type ListBatchesOptions, type ListBatchesResponse, type ListOptions, type MCPServerConfig, type Progress, type ResponseLength, type SearchMetadata, type SearchOptions, type SearchResponse, type SearchResult, type SearchType, type StreamCallback, Valyu, type WaitOptions };
|
|
902
|
+
export { type AIUsage, type AddBatchTasksOptions, type AddBatchTasksResponse, type AlertEmailConfig, type AnswerErrorResponse, type AnswerOptions, type AnswerResponse, type AnswerStreamChunk, type AnswerStreamChunkType, type AnswerSuccessResponse, type BatchCounts, type BatchPagination, type BatchStatus, type BatchStatusResponse, type BatchTaskCreated, type BatchTaskInput, type BatchTaskListItem, type BatchWaitOptions, type CancelBatchResponse, type ChartDataPoint, type ChartDataSeries, type ChartType, type ContentResponseLength, type ContentResult, type ContentResultFailed, type ContentResultSuccess, type ContentsAsyncJobResponse, type ContentsJobResponse, type ContentsJobStatus, type ContentsJobWaitOptions, type ContentsOptions, type ContentsResponse, type Cost, type CountryCode, type CreateBatchOptions, type CreateBatchResponse, type Datasource, type DatasourceCategory, type DatasourceCategoryId, type DatasourceCoverage, type DatasourceModality, type DatasourcePricing, type DatasourcesCategoriesResponse, type DatasourcesListOptions, type DatasourcesListResponse, type DeepResearchBatch, type DeepResearchCancelResponse, type DeepResearchCreateOptions, type DeepResearchCreateResponse, type DeepResearchDeleteResponse, type DeepResearchGetAssetsOptions, type DeepResearchGetAssetsResponse, type DeepResearchListResponse, type DeepResearchMode, type DeepResearchOutputFormat, type DeepResearchSearchConfig, type DeepResearchSource, type DeepResearchStatus, type DeepResearchStatusResponse, type DeepResearchTaskListItem, type DeepResearchTogglePublicResponse, type DeepResearchUpdateResponse, type DeepResearchUsage, type ExtractEffort, type ExtractionMetadata, type FeedbackResponse, type FeedbackSentiment, type FileAttachment, type ImageMetadata, type ImageType, type ListBatchTasksOptions, type ListBatchTasksResponse, type ListBatchesOptions, type ListBatchesResponse, type ListOptions, type MCPServerConfig, type Progress, type ResponseLength, type SearchMetadata, type SearchOptions, type SearchResponse, type SearchResult, type SearchType, type StreamCallback, Valyu, type WaitOptions, verifyContentsWebhookSignature };
|