Skip to content

Commit 57c4ae2

Browse files
feat(api): Add Findall Candidates
client.beta.findall.candidates
1 parent ec3a717 commit 57c4ae2

7 files changed

Lines changed: 265 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 23
1+
configured_endpoints: 24
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/parallel-web%2Fparallel-sdk-c4cc922783460c6e65811d13c9abe35807a551c77c126d452806f93caaaf48fb.yml
33
openapi_spec_hash: 99c9e48d4dafaca71f058107008d174b
4-
config_hash: fe820a5a10ee48e143c9e49a153b23b4
4+
config_hash: 80e7ee7ad8e3424616aca7189ffd5ae7

src/parallel/resources/beta/api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ Types:
7373
```python
7474
from parallel.types.beta import (
7575
FindAllCandidateMatchStatusEvent,
76+
FindAllCandidatesRequest,
77+
FindAllCandidatesResponse,
7678
FindAllEnrichInput,
7779
FindAllExtendInput,
7880
FindAllRun,
@@ -91,6 +93,7 @@ Methods:
9193
- <code title="post /v1beta/findall/runs">client.beta.findall.<a href="./src/parallel/resources/beta/findall.py">create</a>(\*\*<a href="src/parallel/types/beta/findall_create_params.py">params</a>) -> <a href="./src/parallel/types/beta/findall_run.py">FindAllRun</a></code>
9294
- <code title="get /v1beta/findall/runs/{findall_id}">client.beta.findall.<a href="./src/parallel/resources/beta/findall.py">retrieve</a>(findall_id) -> <a href="./src/parallel/types/beta/findall_run.py">FindAllRun</a></code>
9395
- <code title="post /v1beta/findall/runs/{findall_id}/cancel">client.beta.findall.<a href="./src/parallel/resources/beta/findall.py">cancel</a>(findall_id) -> object</code>
96+
- <code title="post /v1beta/findall/candidates">client.beta.findall.<a href="./src/parallel/resources/beta/findall.py">candidates</a>(\*\*<a href="src/parallel/types/beta/findall_candidates_params.py">params</a>) -> <a href="./src/parallel/types/beta/findall_candidates_response.py">FindAllCandidatesResponse</a></code>
9497
- <code title="post /v1beta/findall/runs/{findall_id}/enrich">client.beta.findall.<a href="./src/parallel/resources/beta/findall.py">enrich</a>(findall_id, \*\*<a href="src/parallel/types/beta/findall_enrich_params.py">params</a>) -> <a href="./src/parallel/types/beta/findall_schema.py">FindAllSchema</a></code>
9598
- <code title="get /v1beta/findall/runs/{findall_id}/events">client.beta.findall.<a href="./src/parallel/resources/beta/findall.py">events</a>(findall_id, \*\*<a href="src/parallel/types/beta/findall_events_params.py">params</a>) -> <a href="./src/parallel/types/beta/findall_events_response.py">FindAllEventsResponse</a></code>
9699
- <code title="post /v1beta/findall/runs/{findall_id}/extend">client.beta.findall.<a href="./src/parallel/resources/beta/findall.py">extend</a>(findall_id, \*\*<a href="src/parallel/types/beta/findall_extend_params.py">params</a>) -> <a href="./src/parallel/types/beta/findall_schema.py">FindAllSchema</a></code>

src/parallel/resources/beta/findall.py

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
findall_events_params,
2626
findall_extend_params,
2727
findall_ingest_params,
28+
findall_candidates_params,
2829
)
2930
from ..._base_client import make_request_options
3031
from ...types.beta.findall_run import FindAllRun
@@ -35,6 +36,7 @@
3536
from ...types.beta.findall_run_result import FindAllRunResult
3637
from ...types.beta.parallel_beta_param import ParallelBetaParam
3738
from ...types.beta.findall_events_response import FindAllEventsResponse
39+
from ...types.beta.findall_candidates_response import FindAllCandidatesResponse
3840

3941
__all__ = [
4042
"FindAllResource",
@@ -263,6 +265,59 @@ def cancel(
263265
cast_to=object,
264266
)
265267

268+
def candidates(
269+
self,
270+
*,
271+
entity_type: Literal["company", "people"],
272+
objective: str,
273+
match_limit: int | Omit = omit,
274+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
275+
# The extra values given here take precedence over values defined on the client or passed to this method.
276+
extra_headers: Headers | None = None,
277+
extra_query: Query | None = None,
278+
extra_body: Body | None = None,
279+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
280+
) -> FindAllCandidatesResponse:
281+
"""
282+
Return ranked entity candidates matching a natural language objective.
283+
284+
This endpoint performs a best-effort search optimised for low latency. For
285+
comprehensive match evaluation and enrichment, use the
286+
[FindAll API](https://docs.parallel.ai/findall-api/findall-quickstart).
287+
288+
Args:
289+
entity_type: Type of entity to search for.
290+
291+
objective: Natural language description of target entities.
292+
293+
match_limit: Maximum number of candidates to return. Must be between 5 and 1000 (inclusive).
294+
May return fewer results. Defaults to 100.
295+
296+
extra_headers: Send extra headers
297+
298+
extra_query: Add additional query parameters to the request
299+
300+
extra_body: Add additional JSON properties to the request
301+
302+
timeout: Override the client-level default timeout for this request, in seconds
303+
"""
304+
extra_headers = {"parallel-beta": "findall-2025-09-15", **(extra_headers or {})}
305+
return self._post(
306+
"/v1beta/findall/candidates",
307+
body=maybe_transform(
308+
{
309+
"entity_type": entity_type,
310+
"objective": objective,
311+
"match_limit": match_limit,
312+
},
313+
findall_candidates_params.FindAllCandidatesParams,
314+
),
315+
options=make_request_options(
316+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
317+
),
318+
cast_to=FindAllCandidatesResponse,
319+
)
320+
266321
def enrich(
267322
self,
268323
findall_id: str,
@@ -808,6 +863,59 @@ async def cancel(
808863
cast_to=object,
809864
)
810865

866+
async def candidates(
867+
self,
868+
*,
869+
entity_type: Literal["company", "people"],
870+
objective: str,
871+
match_limit: int | Omit = omit,
872+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
873+
# The extra values given here take precedence over values defined on the client or passed to this method.
874+
extra_headers: Headers | None = None,
875+
extra_query: Query | None = None,
876+
extra_body: Body | None = None,
877+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
878+
) -> FindAllCandidatesResponse:
879+
"""
880+
Return ranked entity candidates matching a natural language objective.
881+
882+
This endpoint performs a best-effort search optimised for low latency. For
883+
comprehensive match evaluation and enrichment, use the
884+
[FindAll API](https://docs.parallel.ai/findall-api/findall-quickstart).
885+
886+
Args:
887+
entity_type: Type of entity to search for.
888+
889+
objective: Natural language description of target entities.
890+
891+
match_limit: Maximum number of candidates to return. Must be between 5 and 1000 (inclusive).
892+
May return fewer results. Defaults to 100.
893+
894+
extra_headers: Send extra headers
895+
896+
extra_query: Add additional query parameters to the request
897+
898+
extra_body: Add additional JSON properties to the request
899+
900+
timeout: Override the client-level default timeout for this request, in seconds
901+
"""
902+
extra_headers = {"parallel-beta": "findall-2025-09-15", **(extra_headers or {})}
903+
return await self._post(
904+
"/v1beta/findall/candidates",
905+
body=await async_maybe_transform(
906+
{
907+
"entity_type": entity_type,
908+
"objective": objective,
909+
"match_limit": match_limit,
910+
},
911+
findall_candidates_params.FindAllCandidatesParams,
912+
),
913+
options=make_request_options(
914+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
915+
),
916+
cast_to=FindAllCandidatesResponse,
917+
)
918+
811919
async def enrich(
812920
self,
813921
findall_id: str,
@@ -1155,6 +1263,9 @@ def __init__(self, findall: FindAllResource) -> None:
11551263
self.cancel = to_raw_response_wrapper(
11561264
findall.cancel,
11571265
)
1266+
self.candidates = to_raw_response_wrapper(
1267+
findall.candidates,
1268+
)
11581269
self.enrich = to_raw_response_wrapper(
11591270
findall.enrich,
11601271
)
@@ -1188,6 +1299,9 @@ def __init__(self, findall: AsyncFindAllResource) -> None:
11881299
self.cancel = async_to_raw_response_wrapper(
11891300
findall.cancel,
11901301
)
1302+
self.candidates = async_to_raw_response_wrapper(
1303+
findall.candidates,
1304+
)
11911305
self.enrich = async_to_raw_response_wrapper(
11921306
findall.enrich,
11931307
)
@@ -1221,6 +1335,9 @@ def __init__(self, findall: FindAllResource) -> None:
12211335
self.cancel = to_streamed_response_wrapper(
12221336
findall.cancel,
12231337
)
1338+
self.candidates = to_streamed_response_wrapper(
1339+
findall.candidates,
1340+
)
12241341
self.enrich = to_streamed_response_wrapper(
12251342
findall.enrich,
12261343
)
@@ -1254,6 +1371,9 @@ def __init__(self, findall: AsyncFindAllResource) -> None:
12541371
self.cancel = async_to_streamed_response_wrapper(
12551372
findall.cancel,
12561373
)
1374+
self.candidates = async_to_streamed_response_wrapper(
1375+
findall.candidates,
1376+
)
12571377
self.enrich = async_to_streamed_response_wrapper(
12581378
findall.enrich,
12591379
)

src/parallel/types/beta/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@
6363
from .task_group_create_params import TaskGroupCreateParams as TaskGroupCreateParams
6464
from .task_group_events_params import TaskGroupEventsParams as TaskGroupEventsParams
6565
from .task_run_events_response import TaskRunEventsResponse as TaskRunEventsResponse
66+
from .findall_candidates_params import FindAllCandidatesParams as FindAllCandidatesParams
6667
from .task_group_add_runs_params import TaskGroupAddRunsParams as TaskGroupAddRunsParams
6768
from .task_group_events_response import TaskGroupEventsResponse as TaskGroupEventsResponse
6869
from .task_group_get_runs_params import TaskGroupGetRunsParams as TaskGroupGetRunsParams
70+
from .findall_candidates_response import FindAllCandidatesResponse as FindAllCandidatesResponse
6971
from .findall_schema_updated_event import (
7072
FindAllSchemaUpdatedEvent as FindAllSchemaUpdatedEvent,
7173
FindallSchemaUpdatedEvent as FindallSchemaUpdatedEvent,
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import Literal, Required, TypedDict
6+
7+
__all__ = ["FindAllCandidatesParams"]
8+
9+
10+
class FindAllCandidatesParams(TypedDict, total=False):
11+
entity_type: Required[Literal["company", "people"]]
12+
"""Type of entity to search for."""
13+
14+
objective: Required[str]
15+
"""Natural language description of target entities."""
16+
17+
match_limit: int
18+
"""Maximum number of candidates to return.
19+
20+
Must be between 5 and 1000 (inclusive). May return fewer results. Defaults
21+
to 100.
22+
"""
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List
4+
5+
from ..._models import BaseModel
6+
7+
__all__ = ["FindAllCandidatesResponse", "Candidate"]
8+
9+
10+
class Candidate(BaseModel):
11+
description: str
12+
"""Descriptive text about the entity."""
13+
14+
name: str
15+
"""Entity name."""
16+
17+
url: str
18+
"""Canonical URL for the entity."""
19+
20+
21+
class FindAllCandidatesResponse(BaseModel):
22+
candidate_set_id: str
23+
"""Candidate set request ID.
24+
25+
Example: `candidate_set_cad0a6d2dec046bd95ae900527d880e7`
26+
"""
27+
28+
candidates: List[Candidate]
29+
"""Ranked list of entity candidates."""

tests/api_resources/beta/test_findall.py

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
FindAllRun,
1414
FindAllSchema,
1515
FindAllRunResult,
16+
FindAllCandidatesResponse,
1617
)
1718

1819
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -199,6 +200,49 @@ def test_path_params_cancel(self, client: Parallel) -> None:
199200
findall_id="",
200201
)
201202

203+
@parametrize
204+
def test_method_candidates(self, client: Parallel) -> None:
205+
findall = client.beta.findall.candidates(
206+
entity_type="company",
207+
objective="objective",
208+
)
209+
assert_matches_type(FindAllCandidatesResponse, findall, path=["response"])
210+
211+
@parametrize
212+
def test_method_candidates_with_all_params(self, client: Parallel) -> None:
213+
findall = client.beta.findall.candidates(
214+
entity_type="company",
215+
objective="objective",
216+
match_limit=5,
217+
)
218+
assert_matches_type(FindAllCandidatesResponse, findall, path=["response"])
219+
220+
@parametrize
221+
def test_raw_response_candidates(self, client: Parallel) -> None:
222+
response = client.beta.findall.with_raw_response.candidates(
223+
entity_type="company",
224+
objective="objective",
225+
)
226+
227+
assert response.is_closed is True
228+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
229+
findall = response.parse()
230+
assert_matches_type(FindAllCandidatesResponse, findall, path=["response"])
231+
232+
@parametrize
233+
def test_streaming_response_candidates(self, client: Parallel) -> None:
234+
with client.beta.findall.with_streaming_response.candidates(
235+
entity_type="company",
236+
objective="objective",
237+
) as response:
238+
assert not response.is_closed
239+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
240+
241+
findall = response.parse()
242+
assert_matches_type(FindAllCandidatesResponse, findall, path=["response"])
243+
244+
assert cast(Any, response.is_closed) is True
245+
202246
@parametrize
203247
def test_method_enrich(self, client: Parallel) -> None:
204248
findall = client.beta.findall.enrich(
@@ -709,6 +753,49 @@ async def test_path_params_cancel(self, async_client: AsyncParallel) -> None:
709753
findall_id="",
710754
)
711755

756+
@parametrize
757+
async def test_method_candidates(self, async_client: AsyncParallel) -> None:
758+
findall = await async_client.beta.findall.candidates(
759+
entity_type="company",
760+
objective="objective",
761+
)
762+
assert_matches_type(FindAllCandidatesResponse, findall, path=["response"])
763+
764+
@parametrize
765+
async def test_method_candidates_with_all_params(self, async_client: AsyncParallel) -> None:
766+
findall = await async_client.beta.findall.candidates(
767+
entity_type="company",
768+
objective="objective",
769+
match_limit=5,
770+
)
771+
assert_matches_type(FindAllCandidatesResponse, findall, path=["response"])
772+
773+
@parametrize
774+
async def test_raw_response_candidates(self, async_client: AsyncParallel) -> None:
775+
response = await async_client.beta.findall.with_raw_response.candidates(
776+
entity_type="company",
777+
objective="objective",
778+
)
779+
780+
assert response.is_closed is True
781+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
782+
findall = await response.parse()
783+
assert_matches_type(FindAllCandidatesResponse, findall, path=["response"])
784+
785+
@parametrize
786+
async def test_streaming_response_candidates(self, async_client: AsyncParallel) -> None:
787+
async with async_client.beta.findall.with_streaming_response.candidates(
788+
entity_type="company",
789+
objective="objective",
790+
) as response:
791+
assert not response.is_closed
792+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
793+
794+
findall = await response.parse()
795+
assert_matches_type(FindAllCandidatesResponse, findall, path=["response"])
796+
797+
assert cast(Any, response.is_closed) is True
798+
712799
@parametrize
713800
async def test_method_enrich(self, async_client: AsyncParallel) -> None:
714801
findall = await async_client.beta.findall.enrich(

0 commit comments

Comments
 (0)