d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
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
98 lines
3.0 KiB
TypeScript
98 lines
3.0 KiB
TypeScript
import { prospeoHosting } from '@/tools/prospeo/hosting'
|
|
import {
|
|
extractProspeoError,
|
|
PROSPEO_PAGINATION_OUTPUT,
|
|
type ProspeoSearchPersonParams,
|
|
type ProspeoSearchPersonResponse,
|
|
} from '@/tools/prospeo/types'
|
|
import { parseFiltersObject } from '@/tools/prospeo/utils'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export const searchPersonTool: ToolConfig<ProspeoSearchPersonParams, ProspeoSearchPersonResponse> =
|
|
{
|
|
id: 'prospeo_search_person',
|
|
name: 'Prospeo Search Person',
|
|
description: 'Search for leads using 20+ filters to build targeted contact lists.',
|
|
version: '1.0.0',
|
|
|
|
hosting: prospeoHosting<ProspeoSearchPersonParams>((_params, output) => {
|
|
// 1 credit per page that returns at least one result; free on 30-day dedup.
|
|
if (output.free === true) return 0
|
|
const results = output.results
|
|
return Array.isArray(results) && results.length > 0 ? 1 : 0
|
|
}),
|
|
|
|
params: {
|
|
apiKey: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'Prospeo API key',
|
|
},
|
|
filters: {
|
|
type: 'json',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description:
|
|
'Filter configuration object. See https://prospeo.io/api-docs/filters-documentation for all supported filters (e.g., person_seniority, company_industry, person_location).',
|
|
},
|
|
page: {
|
|
type: 'number',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Page number (defaults to 1). Up to 1000 pages of 25 results.',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: 'https://api.prospeo.io/search-person',
|
|
method: 'POST',
|
|
headers: (params) => ({
|
|
'X-KEY': params.apiKey,
|
|
'Content-Type': 'application/json',
|
|
}),
|
|
body: (params) => {
|
|
const body: Record<string, unknown> = { filters: parseFiltersObject(params.filters) }
|
|
if (params.page !== undefined) body.page = params.page
|
|
return body
|
|
},
|
|
},
|
|
|
|
transformResponse: async (response: Response) => {
|
|
if (!response.ok) {
|
|
throw new Error(await extractProspeoError(response))
|
|
}
|
|
const data = await response.json()
|
|
return {
|
|
success: true,
|
|
output: {
|
|
free: data.free ?? false,
|
|
results: data.results ?? [],
|
|
pagination: data.pagination ?? null,
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
free: {
|
|
type: 'boolean',
|
|
description: 'True if the request was free due to 30-day result-set deduplication',
|
|
},
|
|
results: {
|
|
type: 'array',
|
|
description: 'Up to 25 search results (person + company, no email/mobile)',
|
|
items: {
|
|
type: 'object',
|
|
properties: {
|
|
person: {
|
|
type: 'json',
|
|
description: 'Matched person (no email/mobile in search response)',
|
|
},
|
|
company: { type: 'json', description: 'Current company of the person', optional: true },
|
|
},
|
|
},
|
|
},
|
|
pagination: PROSPEO_PAGINATION_OUTPUT,
|
|
},
|
|
}
|