From a1ff84916a2ec4b1714207f2536488ccca9d47f2 Mon Sep 17 00:00:00 2001 From: Theodore Li Date: Sat, 30 May 2026 19:17:54 -0700 Subject: [PATCH] improvement(enrichments): limit company-info to fields both providers return MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hunter's company dataset returns null industry/foundedYear for many large companies (verified against the live API for Microsoft, Amazon, Google), so under the first-non-empty-wins cascade those columns appeared inconsistently across rows. Limit company-info outputs to employee count and description — the fields Hunter and PDL both reliably return — so every row is consistent. employeeCount is a string so Hunter's range bucket and PDL's exact count share the column. --- .../enrichments/company-info/company-info.ts | 58 ++++++++----------- 1 file changed, 25 insertions(+), 33 deletions(-) diff --git a/apps/sim/enrichments/company-info/company-info.ts b/apps/sim/enrichments/company-info/company-info.ts index 6f86d8ef75..b3fdc541ec 100644 --- a/apps/sim/enrichments/company-info/company-info.ts +++ b/apps/sim/enrichments/company-info/company-info.ts @@ -3,63 +3,55 @@ import { Building2 } from 'lucide-react' import { normalizeDomain, str, toolProvider } from '@/enrichments/providers' import type { EnrichmentConfig } from '@/enrichments/types' -/** Returns the value when it's a finite number, else `undefined`. */ -function num(value: unknown): number | undefined { - return typeof value === 'number' && Number.isFinite(value) ? value : undefined -} - /** - * Company Info enrichment. Looks up firmographics for a company domain, trying - * People Data Labs first (richest record, incl. employee count) then Hunter as - * a fallback. + * Company Info enrichment. Looks up a company by domain, trying Hunter first + * (free) then People Data Labs as a fallback. Outputs are limited to the fields + * both providers reliably return — employee count and description — so the + * result stays consistent regardless of which provider fills the cell. + * `employeeCount` is a string so Hunter's range bucket (e.g. `"11-50"`) and + * PDL's exact count map onto the same column. */ export const companyInfoEnrichment: EnrichmentConfig = { id: 'company-info', name: 'Company Info', - description: - "Look up a company's industry, size, founding year, and description from its domain.", + description: "Look up a company's size and description from its domain.", icon: Building2, inputs: [{ id: 'domain', name: 'Company domain', type: 'string', required: true }], outputs: [ - { id: 'industry', name: 'industry', type: 'string' }, - { id: 'employeeCount', name: 'employee count', type: 'number' }, - { id: 'foundedYear', name: 'founded year', type: 'number' }, + { id: 'employeeCount', name: 'employee count', type: 'string' }, { id: 'description', name: 'description', type: 'string' }, ], providers: [ toolProvider({ - id: 'pdl', - label: 'People Data Labs', - toolId: 'pdl_company_enrich', + id: 'hunter', + label: 'Hunter', + toolId: 'hunter_companies_find', buildParams: (inputs) => { - const website = normalizeDomain(inputs.domain) - if (!website) return null - return { website } + const domain = normalizeDomain(inputs.domain) + if (!domain) return null + return { domain } }, mapOutput: (output) => { - const company = output.company as Record | undefined return filterUndefined({ - industry: str(company?.industry) || undefined, - employeeCount: num(company?.employee_count), - foundedYear: num(company?.founded), - description: str(company?.summary) || undefined, + employeeCount: str(output.size) || undefined, + description: str(output.description) || undefined, }) }, }), toolProvider({ - id: 'hunter', - label: 'Hunter', - toolId: 'hunter_companies_find', + id: 'pdl', + label: 'People Data Labs', + toolId: 'pdl_company_enrich', buildParams: (inputs) => { - const domain = normalizeDomain(inputs.domain) - if (!domain) return null - return { domain } + const website = normalizeDomain(inputs.domain) + if (!website) return null + return { website } }, mapOutput: (output) => { + const company = output.company as Record | undefined return filterUndefined({ - industry: str(output.industry) || undefined, - foundedYear: num(output.founded_year), - description: str(output.description) || undefined, + employeeCount: str(company?.employee_count) || undefined, + description: str(company?.summary) || undefined, }) }, }),