valyu-js 2.7.17 → 2.8.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 +51 -0
- package/dist/index.d.mts +214 -1
- package/dist/index.d.ts +214 -1
- package/dist/index.js +223 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +223 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -171,6 +171,57 @@ const result = await valyu.batch.waitForCompletion(batch.batch_id, {
|
|
|
171
171
|
});
|
|
172
172
|
```
|
|
173
173
|
|
|
174
|
+
### Workflows
|
|
175
|
+
|
|
176
|
+
Templated DeepResearch starting points - curated by Valyu or created by your org - with typed `{variable}` placeholders and version history.
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
// Browse curated workflows
|
|
180
|
+
const catalog = await valyu.workflows.list({ scope: "valyu", vertical: "investment-banking" });
|
|
181
|
+
for (const wf of catalog.workflows ?? []) {
|
|
182
|
+
console.log(`${wf.slug} - ${wf.title}`);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Run one as a DeepResearch task
|
|
186
|
+
const task = await valyu.deepresearch.create({
|
|
187
|
+
workflowId: "ib-company-profile",
|
|
188
|
+
workflowParams: { company: "NVIDIA (NVDA)" },
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
const result = await valyu.deepresearch.wait(task.deepresearch_id);
|
|
192
|
+
console.log(result.output);
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Create your own:
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
await valyu.workflows.create({
|
|
199
|
+
slug: "weekly-competitor-scan",
|
|
200
|
+
title: "Weekly Competitor Scan",
|
|
201
|
+
version: {
|
|
202
|
+
prompt: "Summarize the week's most important developments at {company}.",
|
|
203
|
+
strategy: "Prioritize primary sources: filings, press releases, earnings calls.",
|
|
204
|
+
report_format: "Bullet-point briefing, grouped by theme.",
|
|
205
|
+
variables: [{ key: "company", label: "Company", required: true }],
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
<details>
|
|
211
|
+
<summary>All Workflows methods</summary>
|
|
212
|
+
|
|
213
|
+
| Method | Description |
|
|
214
|
+
|---|---|
|
|
215
|
+
| `list(options?)` | List available workflows (filter by vertical, scope, tags, free text) |
|
|
216
|
+
| `get(slug, version?)` | Get a workflow's full template |
|
|
217
|
+
| `versions(slug)` | List a workflow's version history |
|
|
218
|
+
| `preview(slug, options?)` | Resolve the template without creating a task |
|
|
219
|
+
| `create(options)` | Create an org workflow |
|
|
220
|
+
| `update(slug, options)` | Update metadata and/or publish a new version |
|
|
221
|
+
| `delete(slug)` | Delete an org workflow |
|
|
222
|
+
|
|
223
|
+
</details>
|
|
224
|
+
|
|
174
225
|
### Data Sources
|
|
175
226
|
|
|
176
227
|
List available data sources programmatically.
|
package/dist/index.d.mts
CHANGED
|
@@ -38,6 +38,7 @@ interface SearchOptions {
|
|
|
38
38
|
category?: string;
|
|
39
39
|
startDate?: string;
|
|
40
40
|
endDate?: string;
|
|
41
|
+
historicalCache?: boolean;
|
|
41
42
|
countryCode?: CountryCode;
|
|
42
43
|
responseLength?: ResponseLength;
|
|
43
44
|
fastMode?: boolean;
|
|
@@ -71,6 +72,9 @@ interface ContentsOptions {
|
|
|
71
72
|
screenshot?: boolean;
|
|
72
73
|
async?: boolean;
|
|
73
74
|
webhookUrl?: string;
|
|
75
|
+
startDate?: string;
|
|
76
|
+
endDate?: string;
|
|
77
|
+
historicalCache?: boolean;
|
|
74
78
|
}
|
|
75
79
|
interface ContentResultBase {
|
|
76
80
|
url: string;
|
|
@@ -281,6 +285,7 @@ interface DeepResearchSearchConfig {
|
|
|
281
285
|
sourceBiases?: Record<string, number>;
|
|
282
286
|
startDate?: string;
|
|
283
287
|
endDate?: string;
|
|
288
|
+
historicalCache?: boolean;
|
|
284
289
|
category?: string;
|
|
285
290
|
countryCode?: CountryCode;
|
|
286
291
|
}
|
|
@@ -324,6 +329,9 @@ interface DeepResearchCreateOptions {
|
|
|
324
329
|
brandCollectionId?: string;
|
|
325
330
|
metadata?: Record<string, string | number | boolean>;
|
|
326
331
|
hitl?: HitlConfig;
|
|
332
|
+
workflowId?: string;
|
|
333
|
+
workflowParams?: Record<string, any>;
|
|
334
|
+
workflowVersion?: number;
|
|
327
335
|
}
|
|
328
336
|
interface HitlConfig {
|
|
329
337
|
planningQuestions?: boolean;
|
|
@@ -418,6 +426,7 @@ interface DeepResearchCreateResponse {
|
|
|
418
426
|
public?: boolean;
|
|
419
427
|
webhook_secret?: string;
|
|
420
428
|
message?: string;
|
|
429
|
+
workflow?: WorkflowRunInfo;
|
|
421
430
|
error?: string;
|
|
422
431
|
}
|
|
423
432
|
interface DeepResearchStatusResponse {
|
|
@@ -717,6 +726,153 @@ interface DatasourcesCategoriesResponse {
|
|
|
717
726
|
categories?: DatasourceCategory[];
|
|
718
727
|
error?: string;
|
|
719
728
|
}
|
|
729
|
+
type WorkflowMode = "fast" | "standard" | "heavy" | "max";
|
|
730
|
+
type WorkflowVariableType = "text" | "textarea" | "number" | "date" | "enum";
|
|
731
|
+
interface WorkflowVariableValidation {
|
|
732
|
+
min_length?: number;
|
|
733
|
+
max_length?: number;
|
|
734
|
+
pattern?: string;
|
|
735
|
+
enum?: string[];
|
|
736
|
+
}
|
|
737
|
+
interface WorkflowVariable {
|
|
738
|
+
key: string;
|
|
739
|
+
label?: string;
|
|
740
|
+
type?: WorkflowVariableType;
|
|
741
|
+
required?: boolean;
|
|
742
|
+
placeholder?: string;
|
|
743
|
+
help?: string;
|
|
744
|
+
examples?: string[];
|
|
745
|
+
validation?: WorkflowVariableValidation;
|
|
746
|
+
}
|
|
747
|
+
interface WorkflowDeliverable {
|
|
748
|
+
type: string;
|
|
749
|
+
description?: string;
|
|
750
|
+
}
|
|
751
|
+
interface WorkflowTools {
|
|
752
|
+
code_execution?: boolean;
|
|
753
|
+
screenshots?: boolean;
|
|
754
|
+
browser_use?: boolean;
|
|
755
|
+
charts?: boolean;
|
|
756
|
+
}
|
|
757
|
+
interface Workflow {
|
|
758
|
+
slug: string;
|
|
759
|
+
version?: number;
|
|
760
|
+
vertical?: string | null;
|
|
761
|
+
tags?: string[];
|
|
762
|
+
title?: string;
|
|
763
|
+
subtitle?: string | null;
|
|
764
|
+
description?: string | null;
|
|
765
|
+
popular?: boolean;
|
|
766
|
+
recommended_mode?: WorkflowMode;
|
|
767
|
+
estimated_time?: string | null;
|
|
768
|
+
is_valyu?: boolean;
|
|
769
|
+
owner_org_id?: string | null;
|
|
770
|
+
variables?: WorkflowVariable[];
|
|
771
|
+
deliverables?: WorkflowDeliverable[];
|
|
772
|
+
created_at?: string;
|
|
773
|
+
updated_at?: string;
|
|
774
|
+
prompt?: string;
|
|
775
|
+
strategy?: string;
|
|
776
|
+
report_format?: string;
|
|
777
|
+
tools?: WorkflowTools;
|
|
778
|
+
changelog?: string | null;
|
|
779
|
+
}
|
|
780
|
+
interface WorkflowVersionSummary {
|
|
781
|
+
version: number;
|
|
782
|
+
recommended_mode?: WorkflowMode;
|
|
783
|
+
estimated_time?: string | null;
|
|
784
|
+
changelog?: string | null;
|
|
785
|
+
created_at?: string;
|
|
786
|
+
is_current?: boolean;
|
|
787
|
+
}
|
|
788
|
+
interface WorkflowRunInfo {
|
|
789
|
+
slug?: string;
|
|
790
|
+
version?: number;
|
|
791
|
+
}
|
|
792
|
+
interface ResolvedWorkflowTemplate {
|
|
793
|
+
input?: string;
|
|
794
|
+
research_strategy?: string;
|
|
795
|
+
report_format?: string;
|
|
796
|
+
deliverables?: WorkflowDeliverable[];
|
|
797
|
+
mode?: WorkflowMode;
|
|
798
|
+
tools?: WorkflowTools;
|
|
799
|
+
}
|
|
800
|
+
/** Template body for creating a workflow or publishing a new version. */
|
|
801
|
+
interface WorkflowVersionInput {
|
|
802
|
+
prompt: string;
|
|
803
|
+
strategy: string;
|
|
804
|
+
report_format: string;
|
|
805
|
+
variables?: WorkflowVariable[];
|
|
806
|
+
deliverables?: WorkflowDeliverable[];
|
|
807
|
+
tools?: WorkflowTools;
|
|
808
|
+
recommended_mode?: WorkflowMode;
|
|
809
|
+
estimated_time?: string;
|
|
810
|
+
changelog?: string;
|
|
811
|
+
}
|
|
812
|
+
interface WorkflowsListOptions {
|
|
813
|
+
vertical?: string;
|
|
814
|
+
scope?: "valyu" | "org" | "all";
|
|
815
|
+
q?: string;
|
|
816
|
+
tags?: string[];
|
|
817
|
+
limit?: number;
|
|
818
|
+
expand?: boolean;
|
|
819
|
+
}
|
|
820
|
+
interface WorkflowCreateOptions {
|
|
821
|
+
slug: string;
|
|
822
|
+
title: string;
|
|
823
|
+
version: WorkflowVersionInput;
|
|
824
|
+
subtitle?: string;
|
|
825
|
+
description?: string;
|
|
826
|
+
vertical?: string;
|
|
827
|
+
tags?: string[];
|
|
828
|
+
icon?: string;
|
|
829
|
+
}
|
|
830
|
+
interface WorkflowUpdateOptions {
|
|
831
|
+
title?: string;
|
|
832
|
+
subtitle?: string;
|
|
833
|
+
description?: string;
|
|
834
|
+
vertical?: string;
|
|
835
|
+
tags?: string[];
|
|
836
|
+
icon?: string;
|
|
837
|
+
version?: WorkflowVersionInput;
|
|
838
|
+
setCurrent?: boolean;
|
|
839
|
+
}
|
|
840
|
+
interface WorkflowPreviewOptions {
|
|
841
|
+
workflowParams?: Record<string, any>;
|
|
842
|
+
workflowVersion?: number;
|
|
843
|
+
}
|
|
844
|
+
interface WorkflowsListResponse {
|
|
845
|
+
success: boolean;
|
|
846
|
+
workflows?: Workflow[];
|
|
847
|
+
total?: number;
|
|
848
|
+
next_cursor?: string | null;
|
|
849
|
+
verticals?: string[];
|
|
850
|
+
error?: string;
|
|
851
|
+
}
|
|
852
|
+
interface WorkflowResponse {
|
|
853
|
+
success: boolean;
|
|
854
|
+
workflow?: Workflow;
|
|
855
|
+
error?: string;
|
|
856
|
+
}
|
|
857
|
+
interface WorkflowVersionsResponse {
|
|
858
|
+
success: boolean;
|
|
859
|
+
slug?: string;
|
|
860
|
+
versions?: WorkflowVersionSummary[];
|
|
861
|
+
error?: string;
|
|
862
|
+
}
|
|
863
|
+
interface WorkflowPreviewResponse {
|
|
864
|
+
success: boolean;
|
|
865
|
+
workflow?: WorkflowRunInfo;
|
|
866
|
+
resolved?: ResolvedWorkflowTemplate;
|
|
867
|
+
estimated_credits?: number | null;
|
|
868
|
+
error?: string;
|
|
869
|
+
}
|
|
870
|
+
interface WorkflowDeleteResponse {
|
|
871
|
+
success: boolean;
|
|
872
|
+
slug?: string;
|
|
873
|
+
deleted_at?: string;
|
|
874
|
+
error?: string;
|
|
875
|
+
}
|
|
720
876
|
|
|
721
877
|
/**
|
|
722
878
|
* Verify webhook signature for Contents API async completion notifications.
|
|
@@ -767,6 +923,15 @@ declare class Valyu {
|
|
|
767
923
|
list: (options?: DatasourcesListOptions) => Promise<DatasourcesListResponse>;
|
|
768
924
|
categories: () => Promise<DatasourcesCategoriesResponse>;
|
|
769
925
|
};
|
|
926
|
+
workflows: {
|
|
927
|
+
list: (options?: WorkflowsListOptions) => Promise<WorkflowsListResponse>;
|
|
928
|
+
get: (slug: string, version?: number) => Promise<WorkflowResponse>;
|
|
929
|
+
versions: (slug: string) => Promise<WorkflowVersionsResponse>;
|
|
930
|
+
preview: (slug: string, options?: WorkflowPreviewOptions) => Promise<WorkflowPreviewResponse>;
|
|
931
|
+
create: (options: WorkflowCreateOptions) => Promise<WorkflowResponse>;
|
|
932
|
+
update: (slug: string, options: WorkflowUpdateOptions) => Promise<WorkflowResponse>;
|
|
933
|
+
delete: (slug: string) => Promise<WorkflowDeleteResponse>;
|
|
934
|
+
};
|
|
770
935
|
constructor(apiKey?: string, baseUrl?: string);
|
|
771
936
|
/**
|
|
772
937
|
* Validates date format (YYYY-MM-DD)
|
|
@@ -806,6 +971,7 @@ declare class Valyu {
|
|
|
806
971
|
* @param options.category - Category filter for search results
|
|
807
972
|
* @param options.startDate - Start date filter (YYYY-MM-DD format)
|
|
808
973
|
* @param options.endDate - End date filter (YYYY-MM-DD format)
|
|
974
|
+
* @param options.historicalCache - When true and a date range is set, return the newest cached snapshot inside the range instead of the latest crawl. No-op without a date range (default: false)
|
|
809
975
|
* @param options.countryCode - Country code filter for search results
|
|
810
976
|
* @param options.responseLength - Response content length: "short"/"medium"/"large"/"max" or integer character count
|
|
811
977
|
* @param options.fastMode - Fast mode for quicker but shorter results (default: false)
|
|
@@ -824,6 +990,9 @@ declare class Valyu {
|
|
|
824
990
|
* @param options.screenshot - Request page screenshots (default: false)
|
|
825
991
|
* @param options.async - Force async processing (required for >10 URLs)
|
|
826
992
|
* @param options.webhookUrl - HTTPS URL for completion notification (async only)
|
|
993
|
+
* @param options.startDate - Start date filter (YYYY-MM-DD format), inclusive
|
|
994
|
+
* @param options.endDate - End date filter (YYYY-MM-DD format), inclusive
|
|
995
|
+
* @param options.historicalCache - When true and a date range is set, return the newest cached snapshot inside the range instead of the latest crawl. No-op without a date range (default: false)
|
|
827
996
|
* @returns Promise resolving to sync results or async job (when async: true or >10 URLs)
|
|
828
997
|
*/
|
|
829
998
|
contents(urls: string[], options?: ContentsOptions): Promise<ContentsResponse | ContentsAsyncJobResponse>;
|
|
@@ -848,6 +1017,7 @@ declare class Valyu {
|
|
|
848
1017
|
* @param options.search.excludedSources - Array of source types to exclude (e.g., ["web", "patent"])
|
|
849
1018
|
* @param options.search.startDate - Start date filter in ISO format (YYYY-MM-DD)
|
|
850
1019
|
* @param options.search.endDate - End date filter in ISO format (YYYY-MM-DD)
|
|
1020
|
+
* @param options.search.historicalCache - When true and a date range is set, searches return the newest cached snapshot inside the range instead of the latest crawl. Locked for the whole research run — the agent cannot toggle it mid-research
|
|
851
1021
|
* @param options.search.category - Category filter for search results
|
|
852
1022
|
*/
|
|
853
1023
|
private _deepresearchCreate;
|
|
@@ -922,6 +1092,7 @@ declare class Valyu {
|
|
|
922
1092
|
* @param options.search.excludedSources - Array of source types to exclude (e.g., ["web", "patent"])
|
|
923
1093
|
* @param options.search.startDate - Start date filter in ISO format (YYYY-MM-DD)
|
|
924
1094
|
* @param options.search.endDate - End date filter in ISO format (YYYY-MM-DD)
|
|
1095
|
+
* @param options.search.historicalCache - When true and a date range is set, searches return the newest cached snapshot inside the range instead of the latest crawl
|
|
925
1096
|
* @param options.search.category - Category filter for search results
|
|
926
1097
|
* @param options.webhookUrl - Optional HTTPS URL for completion notification
|
|
927
1098
|
* @param options.metadata - Optional metadata key-value pairs
|
|
@@ -1025,6 +1196,48 @@ declare class Valyu {
|
|
|
1025
1196
|
* @returns Promise resolving to list of categories with their metadata
|
|
1026
1197
|
*/
|
|
1027
1198
|
private _datasourcesCategories;
|
|
1199
|
+
/** Extract the most descriptive error message from a Workflows API error. */
|
|
1200
|
+
private workflowError;
|
|
1201
|
+
/**
|
|
1202
|
+
* Workflows: List workflows available to your org
|
|
1203
|
+
* @param options - Filters: vertical, scope ("valyu" | "org" | "all"), q, tags, limit, expand
|
|
1204
|
+
*/
|
|
1205
|
+
private _workflowsList;
|
|
1206
|
+
/**
|
|
1207
|
+
* Workflows: Get a workflow's full detail, including its template
|
|
1208
|
+
* @param slug - Workflow slug
|
|
1209
|
+
* @param version - Specific version to fetch (defaults to the current version)
|
|
1210
|
+
*/
|
|
1211
|
+
private _workflowsGet;
|
|
1212
|
+
/**
|
|
1213
|
+
* Workflows: List a workflow's version history
|
|
1214
|
+
* @param slug - Workflow slug
|
|
1215
|
+
*/
|
|
1216
|
+
private _workflowsVersions;
|
|
1217
|
+
/**
|
|
1218
|
+
* Workflows: Resolve a workflow's template with params without creating a task
|
|
1219
|
+
* @param slug - Workflow slug
|
|
1220
|
+
* @param options - workflowParams (variable values) and optional workflowVersion
|
|
1221
|
+
*/
|
|
1222
|
+
private _workflowsPreview;
|
|
1223
|
+
/**
|
|
1224
|
+
* Workflows: Create a new workflow for your org
|
|
1225
|
+
* @param options - slug, title, version (template body), and optional metadata
|
|
1226
|
+
*/
|
|
1227
|
+
private _workflowsCreate;
|
|
1228
|
+
/**
|
|
1229
|
+
* Workflows: Update a workflow's metadata and/or publish a new template version.
|
|
1230
|
+
* Only workflows owned by your org can be updated; versions are append-only
|
|
1231
|
+
* (a version body requires a changelog).
|
|
1232
|
+
* @param slug - Workflow slug
|
|
1233
|
+
* @param options - Metadata fields and/or a new version body
|
|
1234
|
+
*/
|
|
1235
|
+
private _workflowsUpdate;
|
|
1236
|
+
/**
|
|
1237
|
+
* Workflows: Delete a workflow owned by your org (soft delete)
|
|
1238
|
+
* @param slug - Workflow slug
|
|
1239
|
+
*/
|
|
1240
|
+
private _workflowsDelete;
|
|
1028
1241
|
}
|
|
1029
1242
|
|
|
1030
|
-
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 DeepResearchCostBreakdown, type DeepResearchCreateOptions, type DeepResearchCreateResponse, type DeepResearchDeleteResponse, type DeepResearchGetAssetsOptions, type DeepResearchGetAssetsResponse, type DeepResearchListResponse, type DeepResearchMode, type DeepResearchOutputFormat, type DeepResearchRespondResponse, type DeepResearchSearchConfig, type DeepResearchSource, type DeepResearchStatus, type DeepResearchStatusResponse, type DeepResearchTaskListItem, type DeepResearchTogglePublicResponse, type DeepResearchTools, type DeepResearchUpdateResponse, type DeepResearchUsage, type ExtractEffort, type ExtractionMetadata, type FeedbackResponse, type FeedbackSentiment, type FileAttachment, type HitlConfig, type ImageMetadata, type ImageType, type Interaction, type InteractionHistoryEntry, type InteractionType, 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, type ToolConfig, Valyu, type WaitOptions, verifyContentsWebhookSignature };
|
|
1243
|
+
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 DeepResearchCostBreakdown, type DeepResearchCreateOptions, type DeepResearchCreateResponse, type DeepResearchDeleteResponse, type DeepResearchGetAssetsOptions, type DeepResearchGetAssetsResponse, type DeepResearchListResponse, type DeepResearchMode, type DeepResearchOutputFormat, type DeepResearchRespondResponse, type DeepResearchSearchConfig, type DeepResearchSource, type DeepResearchStatus, type DeepResearchStatusResponse, type DeepResearchTaskListItem, type DeepResearchTogglePublicResponse, type DeepResearchTools, type DeepResearchUpdateResponse, type DeepResearchUsage, type ExtractEffort, type ExtractionMetadata, type FeedbackResponse, type FeedbackSentiment, type FileAttachment, type HitlConfig, type ImageMetadata, type ImageType, type Interaction, type InteractionHistoryEntry, type InteractionType, type ListBatchTasksOptions, type ListBatchTasksResponse, type ListBatchesOptions, type ListBatchesResponse, type ListOptions, type MCPServerConfig, type Progress, type ResolvedWorkflowTemplate, type ResponseLength, type SearchMetadata, type SearchOptions, type SearchResponse, type SearchResult, type SearchType, type StreamCallback, type ToolConfig, Valyu, type WaitOptions, type Workflow, type WorkflowCreateOptions, type WorkflowDeleteResponse, type WorkflowDeliverable, type WorkflowMode, type WorkflowPreviewOptions, type WorkflowPreviewResponse, type WorkflowResponse, type WorkflowRunInfo, type WorkflowTools, type WorkflowUpdateOptions, type WorkflowVariable, type WorkflowVariableType, type WorkflowVariableValidation, type WorkflowVersionInput, type WorkflowVersionSummary, type WorkflowVersionsResponse, type WorkflowsListOptions, type WorkflowsListResponse, verifyContentsWebhookSignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ interface SearchOptions {
|
|
|
38
38
|
category?: string;
|
|
39
39
|
startDate?: string;
|
|
40
40
|
endDate?: string;
|
|
41
|
+
historicalCache?: boolean;
|
|
41
42
|
countryCode?: CountryCode;
|
|
42
43
|
responseLength?: ResponseLength;
|
|
43
44
|
fastMode?: boolean;
|
|
@@ -71,6 +72,9 @@ interface ContentsOptions {
|
|
|
71
72
|
screenshot?: boolean;
|
|
72
73
|
async?: boolean;
|
|
73
74
|
webhookUrl?: string;
|
|
75
|
+
startDate?: string;
|
|
76
|
+
endDate?: string;
|
|
77
|
+
historicalCache?: boolean;
|
|
74
78
|
}
|
|
75
79
|
interface ContentResultBase {
|
|
76
80
|
url: string;
|
|
@@ -281,6 +285,7 @@ interface DeepResearchSearchConfig {
|
|
|
281
285
|
sourceBiases?: Record<string, number>;
|
|
282
286
|
startDate?: string;
|
|
283
287
|
endDate?: string;
|
|
288
|
+
historicalCache?: boolean;
|
|
284
289
|
category?: string;
|
|
285
290
|
countryCode?: CountryCode;
|
|
286
291
|
}
|
|
@@ -324,6 +329,9 @@ interface DeepResearchCreateOptions {
|
|
|
324
329
|
brandCollectionId?: string;
|
|
325
330
|
metadata?: Record<string, string | number | boolean>;
|
|
326
331
|
hitl?: HitlConfig;
|
|
332
|
+
workflowId?: string;
|
|
333
|
+
workflowParams?: Record<string, any>;
|
|
334
|
+
workflowVersion?: number;
|
|
327
335
|
}
|
|
328
336
|
interface HitlConfig {
|
|
329
337
|
planningQuestions?: boolean;
|
|
@@ -418,6 +426,7 @@ interface DeepResearchCreateResponse {
|
|
|
418
426
|
public?: boolean;
|
|
419
427
|
webhook_secret?: string;
|
|
420
428
|
message?: string;
|
|
429
|
+
workflow?: WorkflowRunInfo;
|
|
421
430
|
error?: string;
|
|
422
431
|
}
|
|
423
432
|
interface DeepResearchStatusResponse {
|
|
@@ -717,6 +726,153 @@ interface DatasourcesCategoriesResponse {
|
|
|
717
726
|
categories?: DatasourceCategory[];
|
|
718
727
|
error?: string;
|
|
719
728
|
}
|
|
729
|
+
type WorkflowMode = "fast" | "standard" | "heavy" | "max";
|
|
730
|
+
type WorkflowVariableType = "text" | "textarea" | "number" | "date" | "enum";
|
|
731
|
+
interface WorkflowVariableValidation {
|
|
732
|
+
min_length?: number;
|
|
733
|
+
max_length?: number;
|
|
734
|
+
pattern?: string;
|
|
735
|
+
enum?: string[];
|
|
736
|
+
}
|
|
737
|
+
interface WorkflowVariable {
|
|
738
|
+
key: string;
|
|
739
|
+
label?: string;
|
|
740
|
+
type?: WorkflowVariableType;
|
|
741
|
+
required?: boolean;
|
|
742
|
+
placeholder?: string;
|
|
743
|
+
help?: string;
|
|
744
|
+
examples?: string[];
|
|
745
|
+
validation?: WorkflowVariableValidation;
|
|
746
|
+
}
|
|
747
|
+
interface WorkflowDeliverable {
|
|
748
|
+
type: string;
|
|
749
|
+
description?: string;
|
|
750
|
+
}
|
|
751
|
+
interface WorkflowTools {
|
|
752
|
+
code_execution?: boolean;
|
|
753
|
+
screenshots?: boolean;
|
|
754
|
+
browser_use?: boolean;
|
|
755
|
+
charts?: boolean;
|
|
756
|
+
}
|
|
757
|
+
interface Workflow {
|
|
758
|
+
slug: string;
|
|
759
|
+
version?: number;
|
|
760
|
+
vertical?: string | null;
|
|
761
|
+
tags?: string[];
|
|
762
|
+
title?: string;
|
|
763
|
+
subtitle?: string | null;
|
|
764
|
+
description?: string | null;
|
|
765
|
+
popular?: boolean;
|
|
766
|
+
recommended_mode?: WorkflowMode;
|
|
767
|
+
estimated_time?: string | null;
|
|
768
|
+
is_valyu?: boolean;
|
|
769
|
+
owner_org_id?: string | null;
|
|
770
|
+
variables?: WorkflowVariable[];
|
|
771
|
+
deliverables?: WorkflowDeliverable[];
|
|
772
|
+
created_at?: string;
|
|
773
|
+
updated_at?: string;
|
|
774
|
+
prompt?: string;
|
|
775
|
+
strategy?: string;
|
|
776
|
+
report_format?: string;
|
|
777
|
+
tools?: WorkflowTools;
|
|
778
|
+
changelog?: string | null;
|
|
779
|
+
}
|
|
780
|
+
interface WorkflowVersionSummary {
|
|
781
|
+
version: number;
|
|
782
|
+
recommended_mode?: WorkflowMode;
|
|
783
|
+
estimated_time?: string | null;
|
|
784
|
+
changelog?: string | null;
|
|
785
|
+
created_at?: string;
|
|
786
|
+
is_current?: boolean;
|
|
787
|
+
}
|
|
788
|
+
interface WorkflowRunInfo {
|
|
789
|
+
slug?: string;
|
|
790
|
+
version?: number;
|
|
791
|
+
}
|
|
792
|
+
interface ResolvedWorkflowTemplate {
|
|
793
|
+
input?: string;
|
|
794
|
+
research_strategy?: string;
|
|
795
|
+
report_format?: string;
|
|
796
|
+
deliverables?: WorkflowDeliverable[];
|
|
797
|
+
mode?: WorkflowMode;
|
|
798
|
+
tools?: WorkflowTools;
|
|
799
|
+
}
|
|
800
|
+
/** Template body for creating a workflow or publishing a new version. */
|
|
801
|
+
interface WorkflowVersionInput {
|
|
802
|
+
prompt: string;
|
|
803
|
+
strategy: string;
|
|
804
|
+
report_format: string;
|
|
805
|
+
variables?: WorkflowVariable[];
|
|
806
|
+
deliverables?: WorkflowDeliverable[];
|
|
807
|
+
tools?: WorkflowTools;
|
|
808
|
+
recommended_mode?: WorkflowMode;
|
|
809
|
+
estimated_time?: string;
|
|
810
|
+
changelog?: string;
|
|
811
|
+
}
|
|
812
|
+
interface WorkflowsListOptions {
|
|
813
|
+
vertical?: string;
|
|
814
|
+
scope?: "valyu" | "org" | "all";
|
|
815
|
+
q?: string;
|
|
816
|
+
tags?: string[];
|
|
817
|
+
limit?: number;
|
|
818
|
+
expand?: boolean;
|
|
819
|
+
}
|
|
820
|
+
interface WorkflowCreateOptions {
|
|
821
|
+
slug: string;
|
|
822
|
+
title: string;
|
|
823
|
+
version: WorkflowVersionInput;
|
|
824
|
+
subtitle?: string;
|
|
825
|
+
description?: string;
|
|
826
|
+
vertical?: string;
|
|
827
|
+
tags?: string[];
|
|
828
|
+
icon?: string;
|
|
829
|
+
}
|
|
830
|
+
interface WorkflowUpdateOptions {
|
|
831
|
+
title?: string;
|
|
832
|
+
subtitle?: string;
|
|
833
|
+
description?: string;
|
|
834
|
+
vertical?: string;
|
|
835
|
+
tags?: string[];
|
|
836
|
+
icon?: string;
|
|
837
|
+
version?: WorkflowVersionInput;
|
|
838
|
+
setCurrent?: boolean;
|
|
839
|
+
}
|
|
840
|
+
interface WorkflowPreviewOptions {
|
|
841
|
+
workflowParams?: Record<string, any>;
|
|
842
|
+
workflowVersion?: number;
|
|
843
|
+
}
|
|
844
|
+
interface WorkflowsListResponse {
|
|
845
|
+
success: boolean;
|
|
846
|
+
workflows?: Workflow[];
|
|
847
|
+
total?: number;
|
|
848
|
+
next_cursor?: string | null;
|
|
849
|
+
verticals?: string[];
|
|
850
|
+
error?: string;
|
|
851
|
+
}
|
|
852
|
+
interface WorkflowResponse {
|
|
853
|
+
success: boolean;
|
|
854
|
+
workflow?: Workflow;
|
|
855
|
+
error?: string;
|
|
856
|
+
}
|
|
857
|
+
interface WorkflowVersionsResponse {
|
|
858
|
+
success: boolean;
|
|
859
|
+
slug?: string;
|
|
860
|
+
versions?: WorkflowVersionSummary[];
|
|
861
|
+
error?: string;
|
|
862
|
+
}
|
|
863
|
+
interface WorkflowPreviewResponse {
|
|
864
|
+
success: boolean;
|
|
865
|
+
workflow?: WorkflowRunInfo;
|
|
866
|
+
resolved?: ResolvedWorkflowTemplate;
|
|
867
|
+
estimated_credits?: number | null;
|
|
868
|
+
error?: string;
|
|
869
|
+
}
|
|
870
|
+
interface WorkflowDeleteResponse {
|
|
871
|
+
success: boolean;
|
|
872
|
+
slug?: string;
|
|
873
|
+
deleted_at?: string;
|
|
874
|
+
error?: string;
|
|
875
|
+
}
|
|
720
876
|
|
|
721
877
|
/**
|
|
722
878
|
* Verify webhook signature for Contents API async completion notifications.
|
|
@@ -767,6 +923,15 @@ declare class Valyu {
|
|
|
767
923
|
list: (options?: DatasourcesListOptions) => Promise<DatasourcesListResponse>;
|
|
768
924
|
categories: () => Promise<DatasourcesCategoriesResponse>;
|
|
769
925
|
};
|
|
926
|
+
workflows: {
|
|
927
|
+
list: (options?: WorkflowsListOptions) => Promise<WorkflowsListResponse>;
|
|
928
|
+
get: (slug: string, version?: number) => Promise<WorkflowResponse>;
|
|
929
|
+
versions: (slug: string) => Promise<WorkflowVersionsResponse>;
|
|
930
|
+
preview: (slug: string, options?: WorkflowPreviewOptions) => Promise<WorkflowPreviewResponse>;
|
|
931
|
+
create: (options: WorkflowCreateOptions) => Promise<WorkflowResponse>;
|
|
932
|
+
update: (slug: string, options: WorkflowUpdateOptions) => Promise<WorkflowResponse>;
|
|
933
|
+
delete: (slug: string) => Promise<WorkflowDeleteResponse>;
|
|
934
|
+
};
|
|
770
935
|
constructor(apiKey?: string, baseUrl?: string);
|
|
771
936
|
/**
|
|
772
937
|
* Validates date format (YYYY-MM-DD)
|
|
@@ -806,6 +971,7 @@ declare class Valyu {
|
|
|
806
971
|
* @param options.category - Category filter for search results
|
|
807
972
|
* @param options.startDate - Start date filter (YYYY-MM-DD format)
|
|
808
973
|
* @param options.endDate - End date filter (YYYY-MM-DD format)
|
|
974
|
+
* @param options.historicalCache - When true and a date range is set, return the newest cached snapshot inside the range instead of the latest crawl. No-op without a date range (default: false)
|
|
809
975
|
* @param options.countryCode - Country code filter for search results
|
|
810
976
|
* @param options.responseLength - Response content length: "short"/"medium"/"large"/"max" or integer character count
|
|
811
977
|
* @param options.fastMode - Fast mode for quicker but shorter results (default: false)
|
|
@@ -824,6 +990,9 @@ declare class Valyu {
|
|
|
824
990
|
* @param options.screenshot - Request page screenshots (default: false)
|
|
825
991
|
* @param options.async - Force async processing (required for >10 URLs)
|
|
826
992
|
* @param options.webhookUrl - HTTPS URL for completion notification (async only)
|
|
993
|
+
* @param options.startDate - Start date filter (YYYY-MM-DD format), inclusive
|
|
994
|
+
* @param options.endDate - End date filter (YYYY-MM-DD format), inclusive
|
|
995
|
+
* @param options.historicalCache - When true and a date range is set, return the newest cached snapshot inside the range instead of the latest crawl. No-op without a date range (default: false)
|
|
827
996
|
* @returns Promise resolving to sync results or async job (when async: true or >10 URLs)
|
|
828
997
|
*/
|
|
829
998
|
contents(urls: string[], options?: ContentsOptions): Promise<ContentsResponse | ContentsAsyncJobResponse>;
|
|
@@ -848,6 +1017,7 @@ declare class Valyu {
|
|
|
848
1017
|
* @param options.search.excludedSources - Array of source types to exclude (e.g., ["web", "patent"])
|
|
849
1018
|
* @param options.search.startDate - Start date filter in ISO format (YYYY-MM-DD)
|
|
850
1019
|
* @param options.search.endDate - End date filter in ISO format (YYYY-MM-DD)
|
|
1020
|
+
* @param options.search.historicalCache - When true and a date range is set, searches return the newest cached snapshot inside the range instead of the latest crawl. Locked for the whole research run — the agent cannot toggle it mid-research
|
|
851
1021
|
* @param options.search.category - Category filter for search results
|
|
852
1022
|
*/
|
|
853
1023
|
private _deepresearchCreate;
|
|
@@ -922,6 +1092,7 @@ declare class Valyu {
|
|
|
922
1092
|
* @param options.search.excludedSources - Array of source types to exclude (e.g., ["web", "patent"])
|
|
923
1093
|
* @param options.search.startDate - Start date filter in ISO format (YYYY-MM-DD)
|
|
924
1094
|
* @param options.search.endDate - End date filter in ISO format (YYYY-MM-DD)
|
|
1095
|
+
* @param options.search.historicalCache - When true and a date range is set, searches return the newest cached snapshot inside the range instead of the latest crawl
|
|
925
1096
|
* @param options.search.category - Category filter for search results
|
|
926
1097
|
* @param options.webhookUrl - Optional HTTPS URL for completion notification
|
|
927
1098
|
* @param options.metadata - Optional metadata key-value pairs
|
|
@@ -1025,6 +1196,48 @@ declare class Valyu {
|
|
|
1025
1196
|
* @returns Promise resolving to list of categories with their metadata
|
|
1026
1197
|
*/
|
|
1027
1198
|
private _datasourcesCategories;
|
|
1199
|
+
/** Extract the most descriptive error message from a Workflows API error. */
|
|
1200
|
+
private workflowError;
|
|
1201
|
+
/**
|
|
1202
|
+
* Workflows: List workflows available to your org
|
|
1203
|
+
* @param options - Filters: vertical, scope ("valyu" | "org" | "all"), q, tags, limit, expand
|
|
1204
|
+
*/
|
|
1205
|
+
private _workflowsList;
|
|
1206
|
+
/**
|
|
1207
|
+
* Workflows: Get a workflow's full detail, including its template
|
|
1208
|
+
* @param slug - Workflow slug
|
|
1209
|
+
* @param version - Specific version to fetch (defaults to the current version)
|
|
1210
|
+
*/
|
|
1211
|
+
private _workflowsGet;
|
|
1212
|
+
/**
|
|
1213
|
+
* Workflows: List a workflow's version history
|
|
1214
|
+
* @param slug - Workflow slug
|
|
1215
|
+
*/
|
|
1216
|
+
private _workflowsVersions;
|
|
1217
|
+
/**
|
|
1218
|
+
* Workflows: Resolve a workflow's template with params without creating a task
|
|
1219
|
+
* @param slug - Workflow slug
|
|
1220
|
+
* @param options - workflowParams (variable values) and optional workflowVersion
|
|
1221
|
+
*/
|
|
1222
|
+
private _workflowsPreview;
|
|
1223
|
+
/**
|
|
1224
|
+
* Workflows: Create a new workflow for your org
|
|
1225
|
+
* @param options - slug, title, version (template body), and optional metadata
|
|
1226
|
+
*/
|
|
1227
|
+
private _workflowsCreate;
|
|
1228
|
+
/**
|
|
1229
|
+
* Workflows: Update a workflow's metadata and/or publish a new template version.
|
|
1230
|
+
* Only workflows owned by your org can be updated; versions are append-only
|
|
1231
|
+
* (a version body requires a changelog).
|
|
1232
|
+
* @param slug - Workflow slug
|
|
1233
|
+
* @param options - Metadata fields and/or a new version body
|
|
1234
|
+
*/
|
|
1235
|
+
private _workflowsUpdate;
|
|
1236
|
+
/**
|
|
1237
|
+
* Workflows: Delete a workflow owned by your org (soft delete)
|
|
1238
|
+
* @param slug - Workflow slug
|
|
1239
|
+
*/
|
|
1240
|
+
private _workflowsDelete;
|
|
1028
1241
|
}
|
|
1029
1242
|
|
|
1030
|
-
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 DeepResearchCostBreakdown, type DeepResearchCreateOptions, type DeepResearchCreateResponse, type DeepResearchDeleteResponse, type DeepResearchGetAssetsOptions, type DeepResearchGetAssetsResponse, type DeepResearchListResponse, type DeepResearchMode, type DeepResearchOutputFormat, type DeepResearchRespondResponse, type DeepResearchSearchConfig, type DeepResearchSource, type DeepResearchStatus, type DeepResearchStatusResponse, type DeepResearchTaskListItem, type DeepResearchTogglePublicResponse, type DeepResearchTools, type DeepResearchUpdateResponse, type DeepResearchUsage, type ExtractEffort, type ExtractionMetadata, type FeedbackResponse, type FeedbackSentiment, type FileAttachment, type HitlConfig, type ImageMetadata, type ImageType, type Interaction, type InteractionHistoryEntry, type InteractionType, 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, type ToolConfig, Valyu, type WaitOptions, verifyContentsWebhookSignature };
|
|
1243
|
+
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 DeepResearchCostBreakdown, type DeepResearchCreateOptions, type DeepResearchCreateResponse, type DeepResearchDeleteResponse, type DeepResearchGetAssetsOptions, type DeepResearchGetAssetsResponse, type DeepResearchListResponse, type DeepResearchMode, type DeepResearchOutputFormat, type DeepResearchRespondResponse, type DeepResearchSearchConfig, type DeepResearchSource, type DeepResearchStatus, type DeepResearchStatusResponse, type DeepResearchTaskListItem, type DeepResearchTogglePublicResponse, type DeepResearchTools, type DeepResearchUpdateResponse, type DeepResearchUsage, type ExtractEffort, type ExtractionMetadata, type FeedbackResponse, type FeedbackSentiment, type FileAttachment, type HitlConfig, type ImageMetadata, type ImageType, type Interaction, type InteractionHistoryEntry, type InteractionType, type ListBatchTasksOptions, type ListBatchTasksResponse, type ListBatchesOptions, type ListBatchesResponse, type ListOptions, type MCPServerConfig, type Progress, type ResolvedWorkflowTemplate, type ResponseLength, type SearchMetadata, type SearchOptions, type SearchResponse, type SearchResult, type SearchType, type StreamCallback, type ToolConfig, Valyu, type WaitOptions, type Workflow, type WorkflowCreateOptions, type WorkflowDeleteResponse, type WorkflowDeliverable, type WorkflowMode, type WorkflowPreviewOptions, type WorkflowPreviewResponse, type WorkflowResponse, type WorkflowRunInfo, type WorkflowTools, type WorkflowUpdateOptions, type WorkflowVariable, type WorkflowVariableType, type WorkflowVariableValidation, type WorkflowVersionInput, type WorkflowVersionSummary, type WorkflowVersionsResponse, type WorkflowsListOptions, type WorkflowsListResponse, verifyContentsWebhookSignature };
|