Skip to content

Commit 15ae417

Browse files
committed
improvement(peopledatalabs): add titlecase, placeholders, and 404 handling on search
1 parent 29affda commit 15ae417

8 files changed

Lines changed: 95 additions & 0 deletions

File tree

apps/sim/blocks/blocks/peopledatalabs.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,15 @@ export const PeopleDataLabsBlock: BlockConfig<PdlPersonEnrichResponse> = {
6464
id: 'first_name',
6565
title: 'First Name',
6666
type: 'short-input',
67+
placeholder: 'Jane',
6768
condition: { field: 'operation', value: ['pdl_person_enrich', 'pdl_person_identify'] },
6869
mode: 'advanced',
6970
},
7071
{
7172
id: 'last_name',
7273
title: 'Last Name',
7374
type: 'short-input',
75+
placeholder: 'Doe',
7476
condition: { field: 'operation', value: ['pdl_person_enrich', 'pdl_person_identify'] },
7577
mode: 'advanced',
7678
},
@@ -185,6 +187,7 @@ export const PeopleDataLabsBlock: BlockConfig<PdlPersonEnrichResponse> = {
185187
id: 'pdl_id',
186188
title: 'PDL Company ID',
187189
type: 'short-input',
190+
placeholder: 'people-data-labs',
188191
condition: { field: 'operation', value: 'pdl_company_enrich' },
189192
mode: 'advanced',
190193
},
@@ -268,6 +271,7 @@ export const PeopleDataLabsBlock: BlockConfig<PdlPersonEnrichResponse> = {
268271
id: 'identify_postal_code',
269272
title: 'Postal Code',
270273
type: 'short-input',
274+
placeholder: '94103',
271275
condition: { field: 'operation', value: 'pdl_person_identify' },
272276
mode: 'advanced',
273277
},
@@ -366,6 +370,25 @@ export const PeopleDataLabsBlock: BlockConfig<PdlPersonEnrichResponse> = {
366370
mode: 'advanced',
367371
},
368372

373+
// Title case (shared by Person Enrich/Identify/Search, Company Enrich, Autocomplete)
374+
{
375+
id: 'titlecase',
376+
title: 'Title Case Names',
377+
type: 'switch',
378+
condition: {
379+
field: 'operation',
380+
value: [
381+
'pdl_person_enrich',
382+
'pdl_person_identify',
383+
'pdl_person_search',
384+
'pdl_company_enrich',
385+
'pdl_company_search',
386+
'pdl_autocomplete',
387+
],
388+
},
389+
mode: 'advanced',
390+
},
391+
369392
// API Key
370393
{
371394
id: 'apiKey',
@@ -488,6 +511,18 @@ export const PeopleDataLabsBlock: BlockConfig<PdlPersonEnrichResponse> = {
488511
result.min_likelihood = undefined
489512
}
490513

514+
// titlecase is honored by enrich/identify/search/autocomplete; clear it for others
515+
if (
516+
op !== 'pdl_person_enrich' &&
517+
op !== 'pdl_person_identify' &&
518+
op !== 'pdl_person_search' &&
519+
op !== 'pdl_company_enrich' &&
520+
op !== 'pdl_company_search' &&
521+
op !== 'pdl_autocomplete'
522+
) {
523+
result.titlecase = undefined
524+
}
525+
491526
if (op === 'pdl_person_identify') {
492527
if (params.identify_locality !== undefined) result.locality = params.identify_locality
493528
if (params.identify_region !== undefined) result.region = params.identify_region
@@ -575,6 +610,8 @@ export const PeopleDataLabsBlock: BlockConfig<PdlPersonEnrichResponse> = {
575610
// Bulk
576611
requests: { type: 'string', description: 'JSON array of bulk request objects' },
577612
required: { type: 'string', description: 'Required-fields expression for bulk' },
613+
// Shared
614+
titlecase: { type: 'boolean', description: 'Return name fields in title case' },
578615
},
579616

580617
outputs: {

apps/sim/tools/peopledatalabs/autocomplete.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ export const autocompleteTool: ToolConfig<PdlAutocompleteParams, PdlAutocomplete
4545
visibility: 'user-or-llm',
4646
description: 'Number of suggestions to return (1-100, default 10)',
4747
},
48+
titlecase: {
49+
type: 'boolean',
50+
required: false,
51+
visibility: 'user-or-llm',
52+
description: 'Return name fields in title case',
53+
},
4854
},
4955

5056
request: {
@@ -53,6 +59,7 @@ export const autocompleteTool: ToolConfig<PdlAutocompleteParams, PdlAutocomplete
5359
field: params.field,
5460
text: params.text,
5561
size: params.size,
62+
titlecase: params.titlecase,
5663
})
5764
return `https://api.peopledatalabs.com/v5/autocomplete${qs}`
5865
},

apps/sim/tools/peopledatalabs/company_enrich.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ export const companyEnrichTool: ToolConfig<PdlCompanyEnrichParams, PdlCompanyEnr
8383
visibility: 'user-or-llm',
8484
description: 'Required-fields expression',
8585
},
86+
titlecase: {
87+
type: 'boolean',
88+
required: false,
89+
visibility: 'user-or-llm',
90+
description: 'Return name fields in title case',
91+
},
8692
},
8793

8894
request: {
@@ -99,6 +105,7 @@ export const companyEnrichTool: ToolConfig<PdlCompanyEnrichParams, PdlCompanyEnr
99105
country: params.country,
100106
min_likelihood: params.min_likelihood,
101107
required: params.required,
108+
titlecase: params.titlecase,
102109
})
103110
return `https://api.peopledatalabs.com/v5/company/enrich${qs}`
104111
},

apps/sim/tools/peopledatalabs/company_search.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ export const companySearchTool: ToolConfig<PdlCompanySearchParams, PdlCompanySea
4242
visibility: 'user-or-llm',
4343
description: 'Pagination token returned from a prior response',
4444
},
45+
titlecase: {
46+
type: 'boolean',
47+
required: false,
48+
visibility: 'user-or-llm',
49+
description: 'Return name fields in title case',
50+
},
4551
},
4652

4753
request: {
@@ -64,12 +70,18 @@ export const companySearchTool: ToolConfig<PdlCompanySearchParams, PdlCompanySea
6470
}
6571
if (params.size !== undefined) body.size = Number(params.size)
6672
if (params.scroll_token) body.scroll_token = params.scroll_token
73+
if (params.titlecase !== undefined) body.titlecase = params.titlecase
6774
return body
6875
},
6976
},
7077

7178
transformResponse: async (response: Response) => {
7279
const data = (await response.json()) as Record<string, unknown>
80+
const status = (data.status as number) ?? response.status
81+
82+
if (status === 404) {
83+
return { success: true, output: { total: 0, scroll_token: null, results: [] } }
84+
}
7385

7486
if (!response.ok) {
7587
const error = (data.error as { message?: string })?.message

apps/sim/tools/peopledatalabs/person_enrich.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ export const personEnrichTool: ToolConfig<PdlPersonEnrichParams, PdlPersonEnrich
8989
visibility: 'user-or-llm',
9090
description: 'Required-fields expression (e.g., "emails AND job_title")',
9191
},
92+
titlecase: {
93+
type: 'boolean',
94+
required: false,
95+
visibility: 'user-or-llm',
96+
description: 'Return name fields in title case',
97+
},
9298
},
9399

94100
request: {
@@ -106,6 +112,7 @@ export const personEnrichTool: ToolConfig<PdlPersonEnrichParams, PdlPersonEnrich
106112
location: params.location,
107113
min_likelihood: params.min_likelihood,
108114
required: params.required,
115+
titlecase: params.titlecase,
109116
})
110117
return `https://api.peopledatalabs.com/v5/person/enrich${qs}`
111118
},

apps/sim/tools/peopledatalabs/person_identify.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ export const personIdentifyTool: ToolConfig<PdlPersonIdentifyParams, PdlPersonId
145145
visibility: 'user-or-llm',
146146
description: 'Include `matched_on` for each match',
147147
},
148+
titlecase: {
149+
type: 'boolean',
150+
required: false,
151+
visibility: 'user-or-llm',
152+
description: 'Return name fields in title case',
153+
},
148154
},
149155

150156
request: {
@@ -170,6 +176,7 @@ export const personIdentifyTool: ToolConfig<PdlPersonIdentifyParams, PdlPersonId
170176
birth_date: params.birth_date,
171177
data_include: params.data_include,
172178
include_if_matched: params.include_if_matched,
179+
titlecase: params.titlecase,
173180
})
174181
return `https://api.peopledatalabs.com/v5/person/identify${qs}`
175182
},

apps/sim/tools/peopledatalabs/person_search.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ export const personSearchTool: ToolConfig<PdlPersonSearchParams, PdlPersonSearch
4949
description:
5050
'Dataset filter: all, resume, email, phone, mobile_phone, street_address, consumer_social, developer (combinable with commas, exclude with `-` prefix)',
5151
},
52+
titlecase: {
53+
type: 'boolean',
54+
required: false,
55+
visibility: 'user-or-llm',
56+
description: 'Return name fields in title case',
57+
},
5258
},
5359

5460
request: {
@@ -72,12 +78,18 @@ export const personSearchTool: ToolConfig<PdlPersonSearchParams, PdlPersonSearch
7278
if (params.size !== undefined) body.size = Number(params.size)
7379
if (params.scroll_token) body.scroll_token = params.scroll_token
7480
if (params.dataset) body.dataset = params.dataset
81+
if (params.titlecase !== undefined) body.titlecase = params.titlecase
7582
return body
7683
},
7784
},
7885

7986
transformResponse: async (response: Response) => {
8087
const data = (await response.json()) as Record<string, unknown>
88+
const status = (data.status as number) ?? response.status
89+
90+
if (status === 404) {
91+
return { success: true, output: { total: 0, scroll_token: null, results: [] } }
92+
}
8193

8294
if (!response.ok) {
8395
const error = (data.error as { message?: string })?.message

apps/sim/tools/peopledatalabs/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ export interface PdlPersonEnrichParams {
217217
location?: string
218218
min_likelihood?: number
219219
required?: string
220+
titlecase?: boolean
220221
}
221222

222223
export interface PdlPersonEnrichResponse extends ToolResponse {
@@ -234,6 +235,7 @@ export interface PdlPersonSearchParams {
234235
size?: number
235236
scroll_token?: string
236237
dataset?: string
238+
titlecase?: boolean
237239
}
238240

239241
export interface PdlPersonSearchResponse extends ToolResponse {
@@ -257,6 +259,7 @@ export interface PdlCompanyEnrichParams {
257259
country?: string
258260
min_likelihood?: number
259261
required?: string
262+
titlecase?: boolean
260263
}
261264

262265
export interface PdlCompanyEnrichResponse extends ToolResponse {
@@ -273,6 +276,7 @@ export interface PdlCompanySearchParams {
273276
query?: string
274277
size?: number
275278
scroll_token?: string
279+
titlecase?: boolean
276280
}
277281

278282
export interface PdlCompanySearchResponse extends ToolResponse {
@@ -288,6 +292,7 @@ export interface PdlAutocompleteParams {
288292
field: string
289293
text?: string
290294
size?: number
295+
titlecase?: boolean
291296
}
292297

293298
export interface PdlAutocompleteSuggestion {
@@ -364,6 +369,7 @@ export interface PdlPersonIdentifyParams {
364369
birth_date?: string
365370
data_include?: string
366371
include_if_matched?: boolean
372+
titlecase?: boolean
367373
}
368374

369375
export interface PdlPersonIdentifyMatch {

0 commit comments

Comments
 (0)