chore: import upstream snapshot with attribution
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
import type {
|
||||
BrightDataCancelSnapshotParams,
|
||||
BrightDataCancelSnapshotResponse,
|
||||
} from '@/tools/brightdata/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const brightDataCancelSnapshotTool: ToolConfig<
|
||||
BrightDataCancelSnapshotParams,
|
||||
BrightDataCancelSnapshotResponse
|
||||
> = {
|
||||
id: 'brightdata_cancel_snapshot',
|
||||
name: 'Bright Data Cancel Snapshot',
|
||||
description:
|
||||
'Cancel an active Bright Data scraping job using its snapshot ID. Terminates data collection in progress.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Bright Data API token',
|
||||
},
|
||||
snapshotId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The snapshot ID of the collection to cancel (e.g., "s_m4x7enmven8djfqak")',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
method: 'POST',
|
||||
url: (params) =>
|
||||
`https://api.brightdata.com/datasets/v3/snapshot/${params.snapshotId?.trim()}/cancel`,
|
||||
headers: (params) => ({
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response, params) => {
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text()
|
||||
throw new Error(errorText || `Cancel snapshot failed with status ${response.status}`)
|
||||
}
|
||||
|
||||
await response.json().catch(() => null)
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
snapshotId: params?.snapshotId ?? null,
|
||||
cancelled: true,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
snapshotId: {
|
||||
type: 'string',
|
||||
description: 'The snapshot ID that was cancelled',
|
||||
optional: true,
|
||||
},
|
||||
cancelled: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the cancellation was successful',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,250 @@
|
||||
import { createLogger } from '@sim/logger'
|
||||
import { toError } from '@sim/utils/errors'
|
||||
import { sleep } from '@sim/utils/helpers'
|
||||
import { DEFAULT_EXECUTION_TIMEOUT_MS } from '@/lib/core/execution-limits'
|
||||
import type { BrightDataDiscoverParams, BrightDataDiscoverResponse } from '@/tools/brightdata/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
const logger = createLogger('tools:brightdata:discover')
|
||||
|
||||
const POLL_INTERVAL_MS = 3000
|
||||
const MAX_POLL_TIME_MS = DEFAULT_EXECUTION_TIMEOUT_MS
|
||||
|
||||
export const brightDataDiscoverTool: ToolConfig<
|
||||
BrightDataDiscoverParams,
|
||||
BrightDataDiscoverResponse
|
||||
> = {
|
||||
id: 'brightdata_discover',
|
||||
name: 'Bright Data Discover',
|
||||
description:
|
||||
'AI-powered web discovery that finds and ranks results by intent. Returns up to 20 results with optional cleaned page content for RAG and verification.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Bright Data API token',
|
||||
},
|
||||
query: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The search query (e.g., "competitor pricing changes enterprise plan")',
|
||||
},
|
||||
numResults: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Number of results to return (1-20). Defaults to 10',
|
||||
},
|
||||
mode: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Search depth and ranking mode: "standard" (balanced), "deep" (exhaustive, broader search), "fast" (optimized for speed), or "zeroRanking" (raw volume without AI filtering). Defaults to "standard"',
|
||||
},
|
||||
intent: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Describes what the agent is trying to accomplish, used to rank results by relevance (e.g., "find official pricing pages and change notes")',
|
||||
},
|
||||
includeContent: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether to include cleaned page content in results',
|
||||
},
|
||||
format: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Response format: "json" or "md". Defaults to "json"',
|
||||
},
|
||||
language: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Search language code (e.g., "en", "es", "fr"). Defaults to "en"',
|
||||
},
|
||||
country: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Two-letter ISO country code for localized results (e.g., "us", "gb")',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
method: 'POST',
|
||||
url: 'https://api.brightdata.com/discover',
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
body: (params) => {
|
||||
const body: Record<string, unknown> = {
|
||||
query: params.query,
|
||||
}
|
||||
if (params.numResults) body.num_results = params.numResults
|
||||
if (params.mode) body.mode = params.mode
|
||||
if (params.intent) body.intent = params.intent
|
||||
if (params.includeContent != null) body.include_content = params.includeContent
|
||||
if (params.format) body.format = params.format
|
||||
if (params.language) body.language = params.language
|
||||
if (params.country) body.country = params.country
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response, params) => {
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text()
|
||||
throw new Error(errorText || `Discover request failed with status ${response.status}`)
|
||||
}
|
||||
|
||||
const data = await response.json()
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
results: [],
|
||||
query: params?.query ?? null,
|
||||
totalResults: 0,
|
||||
taskId: data.task_id ?? null,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
postProcess: async (result, params) => {
|
||||
if (!result.success) return result
|
||||
|
||||
const taskId = result.output.taskId
|
||||
if (!taskId) {
|
||||
return {
|
||||
...result,
|
||||
success: false,
|
||||
error: 'Discover API did not return a task_id. Cannot poll for results.',
|
||||
}
|
||||
}
|
||||
|
||||
logger.info(`Bright Data Discover task ${taskId} created, polling for results...`)
|
||||
|
||||
let elapsedTime = 0
|
||||
|
||||
while (elapsedTime < MAX_POLL_TIME_MS) {
|
||||
try {
|
||||
const pollResponse = await fetch(
|
||||
`https://api.brightdata.com/discover?task_id=${encodeURIComponent(taskId)}`,
|
||||
{
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
if (!pollResponse.ok) {
|
||||
return {
|
||||
...result,
|
||||
success: false,
|
||||
error: `Failed to poll discover results: ${pollResponse.statusText}`,
|
||||
}
|
||||
}
|
||||
|
||||
const data = await pollResponse.json()
|
||||
logger.info(`Bright Data Discover task ${taskId} status: ${data.status}`)
|
||||
|
||||
if (data.status === 'done') {
|
||||
const items = Array.isArray(data.results) ? data.results : []
|
||||
|
||||
const results = items.map((item: Record<string, unknown>) => ({
|
||||
url: (item.link as string) ?? (item.url as string) ?? null,
|
||||
title: (item.title as string) ?? null,
|
||||
description: (item.description as string) ?? (item.snippet as string) ?? null,
|
||||
relevanceScore: (item.relevance_score as number) ?? null,
|
||||
content: (item.content as string) ?? null,
|
||||
}))
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
results,
|
||||
query: params.query ?? null,
|
||||
totalResults: results.length,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
if (data.status === 'failed' || data.status === 'error') {
|
||||
return {
|
||||
...result,
|
||||
success: false,
|
||||
error: `Discover task failed: ${data.error ?? 'Unknown error'}`,
|
||||
}
|
||||
}
|
||||
|
||||
await sleep(POLL_INTERVAL_MS)
|
||||
elapsedTime += POLL_INTERVAL_MS
|
||||
} catch (error) {
|
||||
logger.error('Error polling for discover task:', {
|
||||
message: toError(error).message,
|
||||
taskId,
|
||||
})
|
||||
|
||||
return {
|
||||
...result,
|
||||
success: false,
|
||||
error: `Error polling for discover task: ${toError(error).message}`,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logger.warn(
|
||||
`Discover task ${taskId} did not complete within the maximum polling time (${MAX_POLL_TIME_MS / 1000}s)`
|
||||
)
|
||||
|
||||
return {
|
||||
...result,
|
||||
success: false,
|
||||
error: `Discover task ${taskId} timed out after ${MAX_POLL_TIME_MS / 1000}s. Check status manually.`,
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
results: {
|
||||
type: 'array',
|
||||
description: 'Array of discovered web results ranked by intent relevance',
|
||||
items: {
|
||||
type: 'object',
|
||||
description: 'A discovered result',
|
||||
properties: {
|
||||
url: { type: 'string', description: 'URL of the discovered page', optional: true },
|
||||
title: { type: 'string', description: 'Page title', optional: true },
|
||||
description: {
|
||||
type: 'string',
|
||||
description: 'Page description or snippet',
|
||||
optional: true,
|
||||
},
|
||||
relevanceScore: {
|
||||
type: 'number',
|
||||
description: 'AI-calculated relevance score for intent-based ranking',
|
||||
optional: true,
|
||||
},
|
||||
content: {
|
||||
type: 'string',
|
||||
description:
|
||||
'Cleaned page content in the requested format (when includeContent is true)',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
query: { type: 'string', description: 'The search query that was executed', optional: true },
|
||||
totalResults: { type: 'number', description: 'Total number of results returned' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
import type {
|
||||
BrightDataDownloadSnapshotParams,
|
||||
BrightDataDownloadSnapshotResponse,
|
||||
} from '@/tools/brightdata/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const brightDataDownloadSnapshotTool: ToolConfig<
|
||||
BrightDataDownloadSnapshotParams,
|
||||
BrightDataDownloadSnapshotResponse
|
||||
> = {
|
||||
id: 'brightdata_download_snapshot',
|
||||
name: 'Bright Data Download Snapshot',
|
||||
description:
|
||||
'Download the results of a completed Bright Data scraping job using its snapshot ID. The snapshot must have ready status.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Bright Data API token',
|
||||
},
|
||||
snapshotId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'The snapshot ID returned when the collection was triggered (e.g., "s_m4x7enmven8djfqak")',
|
||||
},
|
||||
format: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Output format: "json", "ndjson", "jsonl", or "csv". Defaults to "json"',
|
||||
},
|
||||
compress: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether to compress the results',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
method: 'GET',
|
||||
url: (params) => {
|
||||
const queryParams = new URLSearchParams()
|
||||
if (params.format) queryParams.set('format', params.format)
|
||||
if (params.compress) queryParams.set('compress', 'true')
|
||||
const qs = queryParams.toString()
|
||||
return `https://api.brightdata.com/datasets/v3/snapshot/${params.snapshotId?.trim()}${qs ? `?${qs}` : ''}`
|
||||
},
|
||||
headers: (params) => ({
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response, params) => {
|
||||
if (response.status === 409) {
|
||||
throw new Error(
|
||||
'Snapshot is not ready for download. Check the snapshot status first and wait until it is "ready".'
|
||||
)
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text()
|
||||
throw new Error(errorText || `Snapshot download failed with status ${response.status}`)
|
||||
}
|
||||
|
||||
const contentType = response.headers.get('content-type') || ''
|
||||
let data: Array<Record<string, unknown>>
|
||||
|
||||
if (contentType.includes('application/json')) {
|
||||
const parsed = await response.json()
|
||||
data = Array.isArray(parsed) ? parsed : [parsed]
|
||||
} else {
|
||||
const text = await response.text()
|
||||
try {
|
||||
const parsed = JSON.parse(text)
|
||||
data = Array.isArray(parsed) ? parsed : [parsed]
|
||||
} catch {
|
||||
data = [{ raw: text }]
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
data,
|
||||
format: contentType,
|
||||
snapshotId: params?.snapshotId ?? null,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
data: {
|
||||
type: 'array',
|
||||
description: 'Array of scraped result records',
|
||||
items: {
|
||||
type: 'json',
|
||||
description: 'A scraped record with dataset-specific fields',
|
||||
},
|
||||
},
|
||||
format: {
|
||||
type: 'string',
|
||||
description: 'The content type of the downloaded data',
|
||||
},
|
||||
snapshotId: {
|
||||
type: 'string',
|
||||
description: 'The snapshot ID that was downloaded',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { brightDataCancelSnapshotTool } from '@/tools/brightdata/cancel_snapshot'
|
||||
import { brightDataDiscoverTool } from '@/tools/brightdata/discover'
|
||||
import { brightDataDownloadSnapshotTool } from '@/tools/brightdata/download_snapshot'
|
||||
import { brightDataScrapeDatasetTool } from '@/tools/brightdata/scrape_dataset'
|
||||
import { brightDataScrapeUrlTool } from '@/tools/brightdata/scrape_url'
|
||||
import { brightDataSerpSearchTool } from '@/tools/brightdata/serp_search'
|
||||
import { brightDataSnapshotStatusTool } from '@/tools/brightdata/snapshot_status'
|
||||
import { brightDataSyncScrapeTool } from '@/tools/brightdata/sync_scrape'
|
||||
|
||||
export {
|
||||
brightDataCancelSnapshotTool,
|
||||
brightDataDiscoverTool,
|
||||
brightDataDownloadSnapshotTool,
|
||||
brightDataScrapeDatasetTool,
|
||||
brightDataScrapeUrlTool,
|
||||
brightDataSerpSearchTool,
|
||||
brightDataSnapshotStatusTool,
|
||||
brightDataSyncScrapeTool,
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
import type {
|
||||
BrightDataScrapeDatasetParams,
|
||||
BrightDataScrapeDatasetResponse,
|
||||
} from '@/tools/brightdata/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const brightDataScrapeDatasetTool: ToolConfig<
|
||||
BrightDataScrapeDatasetParams,
|
||||
BrightDataScrapeDatasetResponse
|
||||
> = {
|
||||
id: 'brightdata_scrape_dataset',
|
||||
name: 'Bright Data Scrape Dataset',
|
||||
description:
|
||||
'Trigger a Bright Data pre-built scraper to extract structured data from URLs. Supports 660+ scrapers for platforms like Amazon, LinkedIn, Instagram, and more.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Bright Data API token',
|
||||
},
|
||||
datasetId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Dataset scraper ID from your Bright Data dashboard (e.g., "gd_l1viktl72bvl7bjuj0")',
|
||||
},
|
||||
urls: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'JSON array of URL objects to scrape (e.g., [{"url": "https://example.com/product"}])',
|
||||
},
|
||||
format: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Output format: "json" or "csv". Defaults to "json"',
|
||||
},
|
||||
includeErrors: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether to include a per-input error report in the results',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
method: 'POST',
|
||||
url: (params) => {
|
||||
const queryParams = new URLSearchParams()
|
||||
queryParams.set('dataset_id', params.datasetId.trim())
|
||||
queryParams.set('format', params.format || 'json')
|
||||
if (params.includeErrors) queryParams.set('include_errors', 'true')
|
||||
return `https://api.brightdata.com/datasets/v3/trigger?${queryParams.toString()}`
|
||||
},
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
body: (params) => {
|
||||
if (typeof params.urls === 'string') {
|
||||
try {
|
||||
return JSON.parse(params.urls)
|
||||
} catch {
|
||||
return [{ url: params.urls }]
|
||||
}
|
||||
}
|
||||
return params.urls
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text()
|
||||
throw new Error(errorText || `Dataset trigger failed with status ${response.status}`)
|
||||
}
|
||||
|
||||
const data = await response.json()
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
snapshotId: data.snapshot_id ?? data.snapshotId ?? '',
|
||||
status: data.status ?? 'triggered',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
snapshotId: {
|
||||
type: 'string',
|
||||
description: 'The snapshot ID to retrieve results later',
|
||||
},
|
||||
status: {
|
||||
type: 'string',
|
||||
description: 'Status of the scraping job (e.g., "triggered", "running")',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
import type {
|
||||
BrightDataScrapeUrlParams,
|
||||
BrightDataScrapeUrlResponse,
|
||||
} from '@/tools/brightdata/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const brightDataScrapeUrlTool: ToolConfig<
|
||||
BrightDataScrapeUrlParams,
|
||||
BrightDataScrapeUrlResponse
|
||||
> = {
|
||||
id: 'brightdata_scrape_url',
|
||||
name: 'Bright Data Scrape URL',
|
||||
description:
|
||||
'Fetch content from any URL using Bright Data Web Unlocker. Bypasses anti-bot protections, CAPTCHAs, and IP blocks automatically.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Bright Data API token',
|
||||
},
|
||||
zone: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Web Unlocker zone name from your Bright Data dashboard (e.g., "web_unlocker1")',
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The URL to scrape (e.g., "https://example.com/page")',
|
||||
},
|
||||
format: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Response format: "raw" for HTML or "json" for parsed content. Defaults to "raw"',
|
||||
},
|
||||
country: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Two-letter country code for geo-targeting (e.g., "us", "gb")',
|
||||
},
|
||||
dataFormat: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Convert the response to "markdown" instead of raw HTML, useful for feeding page content to an LLM. Omit for the default HTML/JSON response',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
method: 'POST',
|
||||
url: 'https://api.brightdata.com/request',
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
body: (params) => {
|
||||
const body: Record<string, unknown> = {
|
||||
zone: params.zone,
|
||||
url: params.url,
|
||||
format: params.format || 'raw',
|
||||
}
|
||||
if (params.country) body.country = params.country
|
||||
if (params.dataFormat) body.data_format = params.dataFormat
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response, params) => {
|
||||
const contentType = response.headers.get('content-type') || ''
|
||||
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text()
|
||||
throw new Error(errorText || `Request failed with status ${response.status}`)
|
||||
}
|
||||
|
||||
let content: string
|
||||
if (contentType.includes('application/json')) {
|
||||
const data = await response.json()
|
||||
content = typeof data === 'string' ? data : JSON.stringify(data)
|
||||
} else {
|
||||
content = await response.text()
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
content,
|
||||
url: params?.url ?? null,
|
||||
statusCode: response.status,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
content: {
|
||||
type: 'string',
|
||||
description: 'The scraped page content (HTML or JSON depending on format)',
|
||||
},
|
||||
url: { type: 'string', description: 'The URL that was scraped', optional: true },
|
||||
statusCode: { type: 'number', description: 'HTTP status code of the response', optional: true },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
import type {
|
||||
BrightDataSerpSearchParams,
|
||||
BrightDataSerpSearchResponse,
|
||||
} from '@/tools/brightdata/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
const SEARCH_ENGINE_CONFIG: Record<
|
||||
string,
|
||||
{ url: string; queryKey: string; numKey: string; langKey: string; countryKey: string }
|
||||
> = {
|
||||
google: {
|
||||
url: 'https://www.google.com/search',
|
||||
queryKey: 'q',
|
||||
numKey: 'num',
|
||||
langKey: 'hl',
|
||||
countryKey: 'gl',
|
||||
},
|
||||
bing: {
|
||||
url: 'https://www.bing.com/search',
|
||||
queryKey: 'q',
|
||||
numKey: 'count',
|
||||
langKey: 'setLang',
|
||||
countryKey: 'cc',
|
||||
},
|
||||
duckduckgo: {
|
||||
url: 'https://duckduckgo.com/',
|
||||
queryKey: 'q',
|
||||
numKey: '',
|
||||
langKey: '',
|
||||
countryKey: '',
|
||||
},
|
||||
yandex: {
|
||||
url: 'https://yandex.com/search/',
|
||||
queryKey: 'text',
|
||||
numKey: 'numdoc',
|
||||
langKey: 'lang',
|
||||
countryKey: '',
|
||||
},
|
||||
} as const
|
||||
|
||||
export const brightDataSerpSearchTool: ToolConfig<
|
||||
BrightDataSerpSearchParams,
|
||||
BrightDataSerpSearchResponse
|
||||
> = {
|
||||
id: 'brightdata_serp_search',
|
||||
name: 'Bright Data SERP Search',
|
||||
description:
|
||||
'Search Google, Bing, DuckDuckGo, or Yandex and get structured search results using Bright Data SERP API.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Bright Data API token',
|
||||
},
|
||||
zone: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'SERP API zone name from your Bright Data dashboard (e.g., "serp_api1")',
|
||||
},
|
||||
query: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The search query (e.g., "best project management tools")',
|
||||
},
|
||||
searchEngine: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Search engine to use: "google", "bing", "duckduckgo", or "yandex". Defaults to "google"',
|
||||
},
|
||||
country: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Two-letter country code for localized results (e.g., "us", "gb")',
|
||||
},
|
||||
language: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Two-letter language code (e.g., "en", "es")',
|
||||
},
|
||||
numResults: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Number of results to return (e.g., 10, 20). Defaults to 10',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
method: 'POST',
|
||||
url: 'https://api.brightdata.com/request',
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
body: (params) => {
|
||||
const engine = params.searchEngine || 'google'
|
||||
const config = SEARCH_ENGINE_CONFIG[engine] || SEARCH_ENGINE_CONFIG.google
|
||||
|
||||
const searchParams = new URLSearchParams()
|
||||
searchParams.set(config.queryKey, params.query)
|
||||
if (params.numResults && config.numKey) {
|
||||
searchParams.set(config.numKey, String(params.numResults))
|
||||
}
|
||||
if (params.language && config.langKey) {
|
||||
searchParams.set(config.langKey, params.language)
|
||||
}
|
||||
if (params.country && config.countryKey) {
|
||||
searchParams.set(config.countryKey, params.country)
|
||||
}
|
||||
|
||||
searchParams.set('brd_json', '1')
|
||||
|
||||
const body: Record<string, unknown> = {
|
||||
zone: params.zone,
|
||||
url: `${config.url}?${searchParams.toString()}`,
|
||||
format: 'raw',
|
||||
}
|
||||
if (params.country) body.country = params.country
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response, params) => {
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text()
|
||||
throw new Error(errorText || `SERP request failed with status ${response.status}`)
|
||||
}
|
||||
|
||||
const contentType = response.headers.get('content-type') || ''
|
||||
let results: Array<{
|
||||
title: string | null
|
||||
url: string | null
|
||||
description: string | null
|
||||
rank: number | null
|
||||
}> = []
|
||||
let data: Record<string, unknown> | null = null
|
||||
|
||||
if (contentType.includes('application/json')) {
|
||||
data = await response.json()
|
||||
|
||||
if (Array.isArray(data?.organic)) {
|
||||
results = data.organic.map((item: Record<string, unknown>, index: number) => ({
|
||||
title: (item.title as string) ?? null,
|
||||
url: (item.link as string) ?? (item.url as string) ?? null,
|
||||
description: (item.description as string) ?? (item.snippet as string) ?? null,
|
||||
rank: index + 1,
|
||||
}))
|
||||
} else if (Array.isArray(data)) {
|
||||
results = data.map((item: Record<string, unknown>, index: number) => ({
|
||||
title: (item.title as string) ?? null,
|
||||
url: (item.link as string) ?? (item.url as string) ?? null,
|
||||
description: (item.description as string) ?? (item.snippet as string) ?? null,
|
||||
rank: index + 1,
|
||||
}))
|
||||
}
|
||||
} else {
|
||||
const text = await response.text()
|
||||
results = [
|
||||
{
|
||||
title: 'Raw SERP Response',
|
||||
url: null,
|
||||
description: text.slice(0, 500),
|
||||
rank: 1,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
results,
|
||||
query:
|
||||
((data?.general as Record<string, unknown> | undefined)?.query as string) ??
|
||||
params?.query ??
|
||||
null,
|
||||
searchEngine:
|
||||
((data?.general as Record<string, unknown> | undefined)?.search_engine as string) ??
|
||||
params?.searchEngine ??
|
||||
null,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
results: {
|
||||
type: 'array',
|
||||
description: 'Array of search results',
|
||||
items: {
|
||||
type: 'object',
|
||||
description: 'A search result entry',
|
||||
properties: {
|
||||
title: { type: 'string', description: 'Title of the search result', optional: true },
|
||||
url: { type: 'string', description: 'URL of the search result', optional: true },
|
||||
description: {
|
||||
type: 'string',
|
||||
description: 'Snippet or description of the result',
|
||||
optional: true,
|
||||
},
|
||||
rank: { type: 'number', description: 'Position in search results', optional: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
query: { type: 'string', description: 'The search query that was executed', optional: true },
|
||||
searchEngine: {
|
||||
type: 'string',
|
||||
description: 'The search engine that was used',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import type {
|
||||
BrightDataSnapshotStatusParams,
|
||||
BrightDataSnapshotStatusResponse,
|
||||
} from '@/tools/brightdata/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const brightDataSnapshotStatusTool: ToolConfig<
|
||||
BrightDataSnapshotStatusParams,
|
||||
BrightDataSnapshotStatusResponse
|
||||
> = {
|
||||
id: 'brightdata_snapshot_status',
|
||||
name: 'Bright Data Snapshot Status',
|
||||
description:
|
||||
'Check the progress of an async Bright Data scraping job. Returns status: starting, running, ready, or failed.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Bright Data API token',
|
||||
},
|
||||
snapshotId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'The snapshot ID returned when the collection was triggered (e.g., "s_m4x7enmven8djfqak")',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
method: 'GET',
|
||||
url: (params) => `https://api.brightdata.com/datasets/v3/progress/${params.snapshotId?.trim()}`,
|
||||
headers: (params) => ({
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text()
|
||||
throw new Error(errorText || `Snapshot status check failed with status ${response.status}`)
|
||||
}
|
||||
|
||||
const data = await response.json()
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
snapshotId: data.snapshot_id ?? null,
|
||||
datasetId: data.dataset_id ?? null,
|
||||
status: data.status ?? 'unknown',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
snapshotId: {
|
||||
type: 'string',
|
||||
description: 'The snapshot ID that was queried',
|
||||
},
|
||||
datasetId: {
|
||||
type: 'string',
|
||||
description: 'The dataset ID associated with this snapshot',
|
||||
optional: true,
|
||||
},
|
||||
status: {
|
||||
type: 'string',
|
||||
description: 'Current status of the snapshot: "starting", "running", "ready", or "failed"',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
import type {
|
||||
BrightDataSyncScrapeParams,
|
||||
BrightDataSyncScrapeResponse,
|
||||
} from '@/tools/brightdata/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const brightDataSyncScrapeTool: ToolConfig<
|
||||
BrightDataSyncScrapeParams,
|
||||
BrightDataSyncScrapeResponse
|
||||
> = {
|
||||
id: 'brightdata_sync_scrape',
|
||||
name: 'Bright Data Sync Scrape',
|
||||
description:
|
||||
'Scrape URLs synchronously using a Bright Data pre-built scraper and get structured results directly. Supports up to 20 URLs with a 1-minute timeout.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Bright Data API token',
|
||||
},
|
||||
datasetId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Dataset scraper ID from your Bright Data dashboard (e.g., "gd_l1viktl72bvl7bjuj0")',
|
||||
},
|
||||
urls: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'JSON array of URL objects to scrape, up to 20 (e.g., [{"url": "https://example.com/product"}])',
|
||||
},
|
||||
format: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Output format: "json", "ndjson", or "csv". Defaults to "json"',
|
||||
},
|
||||
includeErrors: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether to include error reports in results',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
method: 'POST',
|
||||
url: (params) => {
|
||||
const queryParams = new URLSearchParams()
|
||||
queryParams.set('dataset_id', params.datasetId.trim())
|
||||
queryParams.set('format', params.format || 'json')
|
||||
if (params.includeErrors) queryParams.set('include_errors', 'true')
|
||||
return `https://api.brightdata.com/datasets/v3/scrape?${queryParams.toString()}`
|
||||
},
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
body: (params) => {
|
||||
if (typeof params.urls === 'string') {
|
||||
try {
|
||||
const parsed = JSON.parse(params.urls)
|
||||
return { input: Array.isArray(parsed) ? parsed : [parsed] }
|
||||
} catch {
|
||||
return { input: [{ url: params.urls }] }
|
||||
}
|
||||
}
|
||||
return { input: params.urls }
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text()
|
||||
throw new Error(errorText || `Sync scrape failed with status ${response.status}`)
|
||||
}
|
||||
|
||||
if (response.status === 202) {
|
||||
const data = await response.json()
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
data: [],
|
||||
snapshotId: data.snapshot_id ?? null,
|
||||
isAsync: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const data = await response.json()
|
||||
const results = Array.isArray(data) ? data : [data]
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
data: results,
|
||||
snapshotId: null,
|
||||
isAsync: false,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
data: {
|
||||
type: 'array',
|
||||
description:
|
||||
'Array of scraped result objects with fields specific to the dataset scraper used',
|
||||
items: {
|
||||
type: 'json',
|
||||
description: 'A scraped record with dataset-specific fields',
|
||||
},
|
||||
},
|
||||
snapshotId: {
|
||||
type: 'string',
|
||||
description:
|
||||
'Snapshot ID returned if the request exceeded the 1-minute timeout and switched to async processing',
|
||||
optional: true,
|
||||
},
|
||||
isAsync: {
|
||||
type: 'boolean',
|
||||
description:
|
||||
'Whether the request fell back to async mode (true means use snapshot ID to retrieve results)',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
import type { ToolResponse } from '@/tools/types'
|
||||
|
||||
export interface BrightDataScrapeUrlParams {
|
||||
apiKey: string
|
||||
zone: string
|
||||
url: string
|
||||
format?: string
|
||||
country?: string
|
||||
dataFormat?: string
|
||||
}
|
||||
|
||||
export interface BrightDataScrapeUrlResponse extends ToolResponse {
|
||||
output: {
|
||||
content: string
|
||||
url: string | null
|
||||
statusCode: number | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface BrightDataSerpSearchParams {
|
||||
apiKey: string
|
||||
zone: string
|
||||
query: string
|
||||
searchEngine?: string
|
||||
country?: string
|
||||
language?: string
|
||||
numResults?: number
|
||||
}
|
||||
|
||||
export interface BrightDataSerpSearchResponse extends ToolResponse {
|
||||
output: {
|
||||
results: Array<{
|
||||
title: string | null
|
||||
url: string | null
|
||||
description: string | null
|
||||
rank: number | null
|
||||
}>
|
||||
query: string | null
|
||||
searchEngine: string | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface BrightDataScrapeDatasetParams {
|
||||
apiKey: string
|
||||
datasetId: string
|
||||
urls: string
|
||||
format?: string
|
||||
includeErrors?: boolean
|
||||
}
|
||||
|
||||
export interface BrightDataScrapeDatasetResponse extends ToolResponse {
|
||||
output: {
|
||||
snapshotId: string
|
||||
status: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface BrightDataSyncScrapeParams {
|
||||
apiKey: string
|
||||
datasetId: string
|
||||
urls: string
|
||||
format?: string
|
||||
includeErrors?: boolean
|
||||
}
|
||||
|
||||
export interface BrightDataSyncScrapeResponse extends ToolResponse {
|
||||
output: {
|
||||
data: Array<Record<string, unknown>>
|
||||
snapshotId: string | null
|
||||
isAsync: boolean
|
||||
}
|
||||
}
|
||||
|
||||
export interface BrightDataSnapshotStatusParams {
|
||||
apiKey: string
|
||||
snapshotId: string
|
||||
}
|
||||
|
||||
export interface BrightDataSnapshotStatusResponse extends ToolResponse {
|
||||
output: {
|
||||
snapshotId: string | null
|
||||
datasetId: string | null
|
||||
status: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface BrightDataDownloadSnapshotParams {
|
||||
apiKey: string
|
||||
snapshotId: string
|
||||
format?: string
|
||||
compress?: boolean
|
||||
}
|
||||
|
||||
export interface BrightDataDownloadSnapshotResponse extends ToolResponse {
|
||||
output: {
|
||||
data: Array<Record<string, unknown>>
|
||||
format: string
|
||||
snapshotId: string | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface BrightDataCancelSnapshotParams {
|
||||
apiKey: string
|
||||
snapshotId: string
|
||||
}
|
||||
|
||||
export interface BrightDataCancelSnapshotResponse extends ToolResponse {
|
||||
output: {
|
||||
snapshotId: string | null
|
||||
cancelled: boolean
|
||||
}
|
||||
}
|
||||
|
||||
export interface BrightDataDiscoverParams {
|
||||
apiKey: string
|
||||
query: string
|
||||
numResults?: number
|
||||
mode?: string
|
||||
intent?: string
|
||||
includeContent?: boolean
|
||||
format?: string
|
||||
language?: string
|
||||
country?: string
|
||||
}
|
||||
|
||||
export interface BrightDataDiscoverResponse extends ToolResponse {
|
||||
output: {
|
||||
results: Array<{
|
||||
url: string | null
|
||||
title: string | null
|
||||
description: string | null
|
||||
relevanceScore: number | null
|
||||
content: string | null
|
||||
}>
|
||||
query: string | null
|
||||
totalResults: number
|
||||
taskId?: string | null
|
||||
}
|
||||
}
|
||||
|
||||
export type BrightDataResponse =
|
||||
| BrightDataScrapeUrlResponse
|
||||
| BrightDataSerpSearchResponse
|
||||
| BrightDataScrapeDatasetResponse
|
||||
| BrightDataSyncScrapeResponse
|
||||
| BrightDataSnapshotStatusResponse
|
||||
| BrightDataDownloadSnapshotResponse
|
||||
| BrightDataCancelSnapshotResponse
|
||||
| BrightDataDiscoverResponse
|
||||
Reference in New Issue
Block a user