Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/builders/workflow-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ export abstract class WorkflowBuilder {
return this;
}

/** Enable or disable comparison with the previous successful run. */
monitorChanges(enabled: boolean = true): this {
this.meta.compareRuns = enabled;
return this;
}

/**
* Add a new step to the workflow
*/
Expand Down
2 changes: 2 additions & 0 deletions src/client/maxun-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ export class Client {
llmApiKey?: string;
llmBaseUrl?: string;
robotName?: string;
compareRuns?: boolean;
}): Promise<any> {
const response = await this.axios.post<ApiResponse<any>>(
'/extract/llm',
Expand All @@ -340,6 +341,7 @@ export class Client {
...(options.llmApiKey ? { llmApiKey: options.llmApiKey } : {}),
...(options.llmBaseUrl ? { llmBaseUrl: options.llmBaseUrl } : {}),
robotName: options.robotName,
...(options.compareRuns !== undefined ? { compareRuns: options.compareRuns } : {}),
},
{
timeout: 300000,
Expand Down
1 change: 1 addition & 0 deletions src/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export class Extract {
llmApiKey?: string;
llmBaseUrl?: string;
robotName?: string;
compareRuns?: boolean;
}): Promise<Robot> {
const robotData = await this.client.extractWithLLM(options);
const robot = await this.client.getRobot(robotData.robotId);
Expand Down
2 changes: 2 additions & 0 deletions src/scrape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface ScrapeOptions extends LlmOptions {
* Adds 2 extra credits per run on top of the base 1 scrape credit.
*/
smartQueries?: string;
compareRuns?: boolean;
}

export class Scrape {
Expand Down Expand Up @@ -55,6 +56,7 @@ export class Scrape {
robotType: 'scrape',
url,
formats: options?.formats || ['markdown'],
...(options?.compareRuns !== undefined ? { compareRuns: options.compareRuns } : {}),
...(options?.smartQueries ? { smartQueries: options.smartQueries } : {}),
...buildLlmPayload(options || {}),
} as any,
Expand Down
4 changes: 4 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface RobotMeta extends LlmOptions {
formats?: Format[];
subscriptionLevel?: number;
smartQueries?: string;
compareRuns?: boolean;
}

export interface Where {
Expand Down Expand Up @@ -99,6 +100,7 @@ export interface Run {
runId: string;
startedAt: string;
finishedAt: string | null;
hasChanges?: boolean;
serializableOutput?: {
scrapeSchema?: Record<string, any>;
scrapeList?: Record<string, any>[];
Expand Down Expand Up @@ -155,6 +157,8 @@ export interface RunResult {
screenshots?: Array<string | { data: string; mimeType: string }>;
status: RunStatus;
runId: string;
hasChanges?: boolean;
changedFormats?: string[];
}

export interface ExecutionOptions {
Expand Down