valyu-js 2.7.0 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +70 -2
- package/dist/index.d.ts +70 -2
- package/dist/index.js +93 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +93 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -204,7 +204,7 @@ interface AlertEmailConfig {
|
|
|
204
204
|
custom_url?: string;
|
|
205
205
|
}
|
|
206
206
|
type DeepResearchMode = "fast" | "standard" | "lite" | "heavy" | "max";
|
|
207
|
-
type DeepResearchStatus = "queued" | "running" | "completed" | "failed" | "cancelled";
|
|
207
|
+
type DeepResearchStatus = "queued" | "running" | "awaiting_input" | "paused" | "completed" | "failed" | "cancelled";
|
|
208
208
|
type DeepResearchOutputFormat = "markdown" | "pdf" | "toon" | Record<string, any>;
|
|
209
209
|
type DeepResearchOutputType = "markdown" | "json" | "toon";
|
|
210
210
|
type ImageType = "chart" | "ai_generated";
|
|
@@ -281,6 +281,30 @@ interface DeepResearchCreateOptions {
|
|
|
281
281
|
alertEmail?: string | AlertEmailConfig;
|
|
282
282
|
brandCollectionId?: string;
|
|
283
283
|
metadata?: Record<string, string | number | boolean>;
|
|
284
|
+
hitl?: HitlConfig;
|
|
285
|
+
}
|
|
286
|
+
interface HitlConfig {
|
|
287
|
+
planningQuestions?: boolean;
|
|
288
|
+
planReview?: boolean;
|
|
289
|
+
sourceReview?: boolean;
|
|
290
|
+
outlineReview?: boolean;
|
|
291
|
+
}
|
|
292
|
+
type InteractionType = "planning_questions" | "plan_review" | "source_review" | "outline_review";
|
|
293
|
+
interface Interaction {
|
|
294
|
+
interaction_id: string;
|
|
295
|
+
type: InteractionType;
|
|
296
|
+
data: Record<string, any>;
|
|
297
|
+
created_at: number;
|
|
298
|
+
timeout_ms: number;
|
|
299
|
+
expected_response?: Record<string, any>;
|
|
300
|
+
}
|
|
301
|
+
interface InteractionHistoryEntry {
|
|
302
|
+
interaction_id: string;
|
|
303
|
+
type: InteractionType;
|
|
304
|
+
created_at: number;
|
|
305
|
+
responded_at?: number;
|
|
306
|
+
auto_continued: boolean;
|
|
307
|
+
response?: Record<string, any>;
|
|
284
308
|
}
|
|
285
309
|
interface Progress {
|
|
286
310
|
current_step: number;
|
|
@@ -365,6 +389,9 @@ interface DeepResearchStatusResponse {
|
|
|
365
389
|
usage?: DeepResearchUsage;
|
|
366
390
|
batch_id?: string;
|
|
367
391
|
batch_task_id?: string;
|
|
392
|
+
hitl_config?: Record<string, boolean>;
|
|
393
|
+
interaction?: Interaction;
|
|
394
|
+
hitl_history?: InteractionHistoryEntry[];
|
|
368
395
|
error?: string;
|
|
369
396
|
}
|
|
370
397
|
interface DeepResearchTaskListItem {
|
|
@@ -414,10 +441,17 @@ interface DeepResearchGetAssetsResponse {
|
|
|
414
441
|
contentType?: string;
|
|
415
442
|
error?: string;
|
|
416
443
|
}
|
|
444
|
+
interface DeepResearchRespondResponse {
|
|
445
|
+
success: boolean;
|
|
446
|
+
status?: string;
|
|
447
|
+
deepresearch_id?: string;
|
|
448
|
+
error?: string;
|
|
449
|
+
}
|
|
417
450
|
interface WaitOptions {
|
|
418
451
|
pollInterval?: number;
|
|
419
452
|
maxWaitTime?: number;
|
|
420
453
|
onProgress?: (status: DeepResearchStatusResponse) => void;
|
|
454
|
+
onInteraction?: (interaction: Interaction) => Promise<Record<string, any> | null | undefined> | Record<string, any> | null | undefined;
|
|
421
455
|
}
|
|
422
456
|
interface StreamCallback {
|
|
423
457
|
onMessage?: (message: any) => void;
|
|
@@ -649,6 +683,17 @@ declare class Valyu {
|
|
|
649
683
|
delete: (taskId: string) => Promise<DeepResearchDeleteResponse>;
|
|
650
684
|
togglePublic: (taskId: string, isPublic: boolean) => Promise<DeepResearchTogglePublicResponse>;
|
|
651
685
|
getAssets: (taskId: string, assetId: string, options?: DeepResearchGetAssetsOptions) => Promise<DeepResearchGetAssetsResponse>;
|
|
686
|
+
respond: (taskId: string, interactionId: string, response: Record<string, any>) => Promise<DeepResearchRespondResponse>;
|
|
687
|
+
respondPlanningQuestions: (taskId: string, interactionId: string, answers: {
|
|
688
|
+
question: string;
|
|
689
|
+
answer: string;
|
|
690
|
+
}[]) => Promise<DeepResearchRespondResponse>;
|
|
691
|
+
approvePlan: (taskId: string, interactionId: string, modifications?: string) => Promise<DeepResearchRespondResponse>;
|
|
692
|
+
respondSourceReview: (taskId: string, interactionId: string, options?: {
|
|
693
|
+
includedDomains?: string[];
|
|
694
|
+
excludedDomains?: string[];
|
|
695
|
+
}) => Promise<DeepResearchRespondResponse>;
|
|
696
|
+
approveOutline: (taskId: string, interactionId: string, modifications?: string) => Promise<DeepResearchRespondResponse>;
|
|
652
697
|
};
|
|
653
698
|
batch: {
|
|
654
699
|
create: (options?: CreateBatchOptions) => Promise<CreateBatchResponse>;
|
|
@@ -767,6 +812,29 @@ declare class Valyu {
|
|
|
767
812
|
* DeepResearch: Add follow-up instruction
|
|
768
813
|
*/
|
|
769
814
|
private _deepresearchUpdate;
|
|
815
|
+
/**
|
|
816
|
+
* DeepResearch: Respond to a HITL checkpoint
|
|
817
|
+
* @param taskId - The task ID to respond to
|
|
818
|
+
* @param interactionId - The interaction_id from the task's interaction field
|
|
819
|
+
* @param response - Response data matching the checkpoint type
|
|
820
|
+
*/
|
|
821
|
+
private _deepresearchRespond;
|
|
822
|
+
/**
|
|
823
|
+
* DeepResearch: Respond to a planning_questions checkpoint
|
|
824
|
+
*/
|
|
825
|
+
private _deepresearchRespondPlanningQuestions;
|
|
826
|
+
/**
|
|
827
|
+
* DeepResearch: Approve or request modifications to a plan_review checkpoint
|
|
828
|
+
*/
|
|
829
|
+
private _deepresearchApprovePlan;
|
|
830
|
+
/**
|
|
831
|
+
* DeepResearch: Respond to a source_review checkpoint
|
|
832
|
+
*/
|
|
833
|
+
private _deepresearchRespondSourceReview;
|
|
834
|
+
/**
|
|
835
|
+
* DeepResearch: Approve or request modifications to an outline_review checkpoint
|
|
836
|
+
*/
|
|
837
|
+
private _deepresearchApproveOutline;
|
|
770
838
|
/**
|
|
771
839
|
* DeepResearch: Cancel task
|
|
772
840
|
*/
|
|
@@ -900,4 +968,4 @@ declare class Valyu {
|
|
|
900
968
|
private _datasourcesCategories;
|
|
901
969
|
}
|
|
902
970
|
|
|
903
|
-
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 };
|
|
971
|
+
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 DeepResearchRespondResponse, 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 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, Valyu, type WaitOptions, verifyContentsWebhookSignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -204,7 +204,7 @@ interface AlertEmailConfig {
|
|
|
204
204
|
custom_url?: string;
|
|
205
205
|
}
|
|
206
206
|
type DeepResearchMode = "fast" | "standard" | "lite" | "heavy" | "max";
|
|
207
|
-
type DeepResearchStatus = "queued" | "running" | "completed" | "failed" | "cancelled";
|
|
207
|
+
type DeepResearchStatus = "queued" | "running" | "awaiting_input" | "paused" | "completed" | "failed" | "cancelled";
|
|
208
208
|
type DeepResearchOutputFormat = "markdown" | "pdf" | "toon" | Record<string, any>;
|
|
209
209
|
type DeepResearchOutputType = "markdown" | "json" | "toon";
|
|
210
210
|
type ImageType = "chart" | "ai_generated";
|
|
@@ -281,6 +281,30 @@ interface DeepResearchCreateOptions {
|
|
|
281
281
|
alertEmail?: string | AlertEmailConfig;
|
|
282
282
|
brandCollectionId?: string;
|
|
283
283
|
metadata?: Record<string, string | number | boolean>;
|
|
284
|
+
hitl?: HitlConfig;
|
|
285
|
+
}
|
|
286
|
+
interface HitlConfig {
|
|
287
|
+
planningQuestions?: boolean;
|
|
288
|
+
planReview?: boolean;
|
|
289
|
+
sourceReview?: boolean;
|
|
290
|
+
outlineReview?: boolean;
|
|
291
|
+
}
|
|
292
|
+
type InteractionType = "planning_questions" | "plan_review" | "source_review" | "outline_review";
|
|
293
|
+
interface Interaction {
|
|
294
|
+
interaction_id: string;
|
|
295
|
+
type: InteractionType;
|
|
296
|
+
data: Record<string, any>;
|
|
297
|
+
created_at: number;
|
|
298
|
+
timeout_ms: number;
|
|
299
|
+
expected_response?: Record<string, any>;
|
|
300
|
+
}
|
|
301
|
+
interface InteractionHistoryEntry {
|
|
302
|
+
interaction_id: string;
|
|
303
|
+
type: InteractionType;
|
|
304
|
+
created_at: number;
|
|
305
|
+
responded_at?: number;
|
|
306
|
+
auto_continued: boolean;
|
|
307
|
+
response?: Record<string, any>;
|
|
284
308
|
}
|
|
285
309
|
interface Progress {
|
|
286
310
|
current_step: number;
|
|
@@ -365,6 +389,9 @@ interface DeepResearchStatusResponse {
|
|
|
365
389
|
usage?: DeepResearchUsage;
|
|
366
390
|
batch_id?: string;
|
|
367
391
|
batch_task_id?: string;
|
|
392
|
+
hitl_config?: Record<string, boolean>;
|
|
393
|
+
interaction?: Interaction;
|
|
394
|
+
hitl_history?: InteractionHistoryEntry[];
|
|
368
395
|
error?: string;
|
|
369
396
|
}
|
|
370
397
|
interface DeepResearchTaskListItem {
|
|
@@ -414,10 +441,17 @@ interface DeepResearchGetAssetsResponse {
|
|
|
414
441
|
contentType?: string;
|
|
415
442
|
error?: string;
|
|
416
443
|
}
|
|
444
|
+
interface DeepResearchRespondResponse {
|
|
445
|
+
success: boolean;
|
|
446
|
+
status?: string;
|
|
447
|
+
deepresearch_id?: string;
|
|
448
|
+
error?: string;
|
|
449
|
+
}
|
|
417
450
|
interface WaitOptions {
|
|
418
451
|
pollInterval?: number;
|
|
419
452
|
maxWaitTime?: number;
|
|
420
453
|
onProgress?: (status: DeepResearchStatusResponse) => void;
|
|
454
|
+
onInteraction?: (interaction: Interaction) => Promise<Record<string, any> | null | undefined> | Record<string, any> | null | undefined;
|
|
421
455
|
}
|
|
422
456
|
interface StreamCallback {
|
|
423
457
|
onMessage?: (message: any) => void;
|
|
@@ -649,6 +683,17 @@ declare class Valyu {
|
|
|
649
683
|
delete: (taskId: string) => Promise<DeepResearchDeleteResponse>;
|
|
650
684
|
togglePublic: (taskId: string, isPublic: boolean) => Promise<DeepResearchTogglePublicResponse>;
|
|
651
685
|
getAssets: (taskId: string, assetId: string, options?: DeepResearchGetAssetsOptions) => Promise<DeepResearchGetAssetsResponse>;
|
|
686
|
+
respond: (taskId: string, interactionId: string, response: Record<string, any>) => Promise<DeepResearchRespondResponse>;
|
|
687
|
+
respondPlanningQuestions: (taskId: string, interactionId: string, answers: {
|
|
688
|
+
question: string;
|
|
689
|
+
answer: string;
|
|
690
|
+
}[]) => Promise<DeepResearchRespondResponse>;
|
|
691
|
+
approvePlan: (taskId: string, interactionId: string, modifications?: string) => Promise<DeepResearchRespondResponse>;
|
|
692
|
+
respondSourceReview: (taskId: string, interactionId: string, options?: {
|
|
693
|
+
includedDomains?: string[];
|
|
694
|
+
excludedDomains?: string[];
|
|
695
|
+
}) => Promise<DeepResearchRespondResponse>;
|
|
696
|
+
approveOutline: (taskId: string, interactionId: string, modifications?: string) => Promise<DeepResearchRespondResponse>;
|
|
652
697
|
};
|
|
653
698
|
batch: {
|
|
654
699
|
create: (options?: CreateBatchOptions) => Promise<CreateBatchResponse>;
|
|
@@ -767,6 +812,29 @@ declare class Valyu {
|
|
|
767
812
|
* DeepResearch: Add follow-up instruction
|
|
768
813
|
*/
|
|
769
814
|
private _deepresearchUpdate;
|
|
815
|
+
/**
|
|
816
|
+
* DeepResearch: Respond to a HITL checkpoint
|
|
817
|
+
* @param taskId - The task ID to respond to
|
|
818
|
+
* @param interactionId - The interaction_id from the task's interaction field
|
|
819
|
+
* @param response - Response data matching the checkpoint type
|
|
820
|
+
*/
|
|
821
|
+
private _deepresearchRespond;
|
|
822
|
+
/**
|
|
823
|
+
* DeepResearch: Respond to a planning_questions checkpoint
|
|
824
|
+
*/
|
|
825
|
+
private _deepresearchRespondPlanningQuestions;
|
|
826
|
+
/**
|
|
827
|
+
* DeepResearch: Approve or request modifications to a plan_review checkpoint
|
|
828
|
+
*/
|
|
829
|
+
private _deepresearchApprovePlan;
|
|
830
|
+
/**
|
|
831
|
+
* DeepResearch: Respond to a source_review checkpoint
|
|
832
|
+
*/
|
|
833
|
+
private _deepresearchRespondSourceReview;
|
|
834
|
+
/**
|
|
835
|
+
* DeepResearch: Approve or request modifications to an outline_review checkpoint
|
|
836
|
+
*/
|
|
837
|
+
private _deepresearchApproveOutline;
|
|
770
838
|
/**
|
|
771
839
|
* DeepResearch: Cancel task
|
|
772
840
|
*/
|
|
@@ -900,4 +968,4 @@ declare class Valyu {
|
|
|
900
968
|
private _datasourcesCategories;
|
|
901
969
|
}
|
|
902
970
|
|
|
903
|
-
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 };
|
|
971
|
+
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 DeepResearchRespondResponse, 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 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, Valyu, type WaitOptions, verifyContentsWebhookSignature };
|
package/dist/index.js
CHANGED
|
@@ -97,7 +97,12 @@ var Valyu = class {
|
|
|
97
97
|
cancel: this._deepresearchCancel.bind(this),
|
|
98
98
|
delete: this._deepresearchDelete.bind(this),
|
|
99
99
|
togglePublic: this._deepresearchTogglePublic.bind(this),
|
|
100
|
-
getAssets: this._deepresearchGetAssets.bind(this)
|
|
100
|
+
getAssets: this._deepresearchGetAssets.bind(this),
|
|
101
|
+
respond: this._deepresearchRespond.bind(this),
|
|
102
|
+
respondPlanningQuestions: this._deepresearchRespondPlanningQuestions.bind(this),
|
|
103
|
+
approvePlan: this._deepresearchApprovePlan.bind(this),
|
|
104
|
+
respondSourceReview: this._deepresearchRespondSourceReview.bind(this),
|
|
105
|
+
approveOutline: this._deepresearchApproveOutline.bind(this)
|
|
101
106
|
};
|
|
102
107
|
this.batch = {
|
|
103
108
|
create: this._batchCreate.bind(this),
|
|
@@ -708,6 +713,17 @@ var Valyu = class {
|
|
|
708
713
|
}
|
|
709
714
|
}
|
|
710
715
|
if (options.metadata) payload.metadata = options.metadata;
|
|
716
|
+
if (options.hitl) {
|
|
717
|
+
payload.hitl = {};
|
|
718
|
+
if (options.hitl.planningQuestions !== void 0)
|
|
719
|
+
payload.hitl.planning_questions = options.hitl.planningQuestions;
|
|
720
|
+
if (options.hitl.planReview !== void 0)
|
|
721
|
+
payload.hitl.plan_review = options.hitl.planReview;
|
|
722
|
+
if (options.hitl.sourceReview !== void 0)
|
|
723
|
+
payload.hitl.source_review = options.hitl.sourceReview;
|
|
724
|
+
if (options.hitl.outlineReview !== void 0)
|
|
725
|
+
payload.hitl.outline_review = options.hitl.outlineReview;
|
|
726
|
+
}
|
|
711
727
|
const response = await import_axios.default.post(
|
|
712
728
|
`${this.baseUrl}/deepresearch/tasks`,
|
|
713
729
|
payload,
|
|
@@ -753,6 +769,19 @@ var Valyu = class {
|
|
|
753
769
|
if (options.onProgress) {
|
|
754
770
|
options.onProgress(status);
|
|
755
771
|
}
|
|
772
|
+
if ((status.status === "awaiting_input" || status.status === "paused") && status.interaction) {
|
|
773
|
+
if (options.onInteraction) {
|
|
774
|
+
const response = await options.onInteraction(status.interaction);
|
|
775
|
+
if (response) {
|
|
776
|
+
await this._deepresearchRespond(
|
|
777
|
+
taskId,
|
|
778
|
+
status.interaction.interaction_id,
|
|
779
|
+
response
|
|
780
|
+
);
|
|
781
|
+
continue;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
}
|
|
756
785
|
if (status.status === "completed" || status.status === "failed" || status.status === "cancelled") {
|
|
757
786
|
return status;
|
|
758
787
|
}
|
|
@@ -854,6 +883,69 @@ var Valyu = class {
|
|
|
854
883
|
};
|
|
855
884
|
}
|
|
856
885
|
}
|
|
886
|
+
/**
|
|
887
|
+
* DeepResearch: Respond to a HITL checkpoint
|
|
888
|
+
* @param taskId - The task ID to respond to
|
|
889
|
+
* @param interactionId - The interaction_id from the task's interaction field
|
|
890
|
+
* @param response - Response data matching the checkpoint type
|
|
891
|
+
*/
|
|
892
|
+
async _deepresearchRespond(taskId, interactionId, response) {
|
|
893
|
+
try {
|
|
894
|
+
const resp = await import_axios.default.post(
|
|
895
|
+
`${this.baseUrl}/deepresearch/tasks/${taskId}/respond`,
|
|
896
|
+
{
|
|
897
|
+
interaction_id: interactionId,
|
|
898
|
+
response
|
|
899
|
+
},
|
|
900
|
+
{ headers: this.headers }
|
|
901
|
+
);
|
|
902
|
+
return { success: true, ...resp.data };
|
|
903
|
+
} catch (e) {
|
|
904
|
+
return {
|
|
905
|
+
success: false,
|
|
906
|
+
error: e.response?.data?.error || e.message
|
|
907
|
+
};
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* DeepResearch: Respond to a planning_questions checkpoint
|
|
912
|
+
*/
|
|
913
|
+
async _deepresearchRespondPlanningQuestions(taskId, interactionId, answers) {
|
|
914
|
+
return this._deepresearchRespond(taskId, interactionId, {
|
|
915
|
+
answers
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* DeepResearch: Approve or request modifications to a plan_review checkpoint
|
|
920
|
+
*/
|
|
921
|
+
async _deepresearchApprovePlan(taskId, interactionId, modifications) {
|
|
922
|
+
const response = { approved: true };
|
|
923
|
+
if (modifications) {
|
|
924
|
+
response.approved = false;
|
|
925
|
+
response.modifications = modifications;
|
|
926
|
+
}
|
|
927
|
+
return this._deepresearchRespond(taskId, interactionId, response);
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* DeepResearch: Respond to a source_review checkpoint
|
|
931
|
+
*/
|
|
932
|
+
async _deepresearchRespondSourceReview(taskId, interactionId, options = {}) {
|
|
933
|
+
return this._deepresearchRespond(taskId, interactionId, {
|
|
934
|
+
included_domains: options.includedDomains || [],
|
|
935
|
+
excluded_domains: options.excludedDomains || []
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* DeepResearch: Approve or request modifications to an outline_review checkpoint
|
|
940
|
+
*/
|
|
941
|
+
async _deepresearchApproveOutline(taskId, interactionId, modifications) {
|
|
942
|
+
const response = { approved: true };
|
|
943
|
+
if (modifications) {
|
|
944
|
+
response.approved = false;
|
|
945
|
+
response.modifications = modifications;
|
|
946
|
+
}
|
|
947
|
+
return this._deepresearchRespond(taskId, interactionId, response);
|
|
948
|
+
}
|
|
857
949
|
/**
|
|
858
950
|
* DeepResearch: Cancel task
|
|
859
951
|
*/
|