module pixeltable.functions.parallel
Pixeltable UDFs that wrap Parallel’s web search and extraction APIs. Without an API key, the UDFs call Parallel’s free MCP endpoint, which needspip install mcp and serves searches in
Fast mode under the service’s anonymous rate limits. Specify PARALLEL_API_KEY, or api_key in the parallel
section of the Pixeltable config file, to call the Search and Extract REST APIs, which also accept the search and
extraction settings the free endpoint does not.
udf extract()
Signature
fetch_policy and links then
require one, and allow_live_fetch is the freshness setting it offers in place of fetch_policy.
Request throttling:
Applies the rate limit set in the config (section parallel, key rate_limit). If no rate
limit is configured, uses a default of 600 RPM.
Parameters:
url(pxt.String): An HTTP or HTTPS page URL.objective(pxt.String | None): Information to extract, up to 200 characters. Omit for general page excerpts.search_queries(pxt.Json[(String): Keyword queries of three to six words each, which focus the excerpts alongsideobjective; pass the queries of the search that producedurl.full_content(Any): Return the whole page as markdown instead of excerpts. A long page can run to tens of thousands of tokens. Defaults to the service’s setting, which returns excerpts.fetch_policy(Any): How fresh the page contents have to be, asmax_age_seconds,timeout_secondsanddisable_cache_fallback. Defaults to the service’s setting, which decides fromurlandobjective. Requires an API key.links(Any): Also return the page’s outgoing links. Requires an API key.allow_live_fetch(Any): Whether the free endpoint may read the page live rather than serve its cached copy. Defaults to the service’s setting ofTrue. With an API key, usefetch_policyinstead.session_id(Any): Application-owned conversation ID; pass the ID used by the related searches.
-
ParallelExtractResponse: A dictionary with the following entries:-
extract_id(str): Parallel’s ID for this extraction, for support requests -
results(list): one entry if the page was read, otherwise empty, withurl(str): the page URLtitle(str | None): the page titlepublish_date(str | None): the publication date, asYYYY-MM-DDexcerpts(list[str]): passages relevant toobjectivefull_content(str | None): the whole page as markdown, iffull_contentasked for itlinks(list[str] | None): the page’s outgoing links, iflinksasked for them
-
errors(list): one entry if the page could not be read, otherwise empty, withurl(str): the page URLerror_type(str): Parallel’s error classification, e.g.fetch_errorhttp_status_code(int | None): the status returned by the pagecontent(str | None): the error body, if the page returned one
-
warnings(list | None): the adjustments the service made to the request, each with atype, amessageand an optionaldetail -
usage(list | None): what the request billed, each entry with anameand acount -
session_id(str): the conversation ID, echoed back, or one generated by the service
errorsrather than as a UDF error. -
udf search()
Signature
fast searches; mode, max_results, source_policy and
fetch_policy then require one.
Request throttling:
Applies the rate limit set in the config (section parallel, key rate_limit). If no rate
limit is configured, uses a default of 600 RPM.
Parameters:
objective(pxt.String): The information to find, including any source or freshness requirements.search_queries(pxt.Json[(String): Keyword queries of three to six words each, which may use search operators; two or three work best. The service ranks sources against them and againstobjective. Defaults toobjectiveas the only query.mode(Any): How much work the service puts into the search, in increasing order of latency and cost.advancedandbasiccost five timesfastandturbo. See https://docs.parallel.ai/search/modes.max_results(Any): How many sources to return. Defaults to the service’s setting of 10, and is capped at 20.source_policy(Any): Which sources to search, asinclude_domains,exclude_domainsandafter_date. See https://docs.parallel.ai/search/advanced-search-settings.fetch_policy(Any): How fresh the page contents have to be, asmax_age_seconds,timeout_secondsanddisable_cache_fallback. Defaults to the service’s setting, which serves its cached index.session_id(Any): Application-owned conversation ID, a UUID or a hex string of at least 32 characters. Pass the same ID for related search and extract calls; omit it for standalone requests. Use a new opaque ID for a new conversation.
-
ParallelSearchResponse: A dictionary with the following entries:-
search_id(str): Parallel’s ID for this search, for support requests -
results(list): the sources, ordered by decreasing relevance, each withurl(str): the source URLtitle(str | None): the page titlepublish_date(str | None): the publication date, asYYYY-MM-DDexcerpts(list[str]): passages relevant toobjective
-
warnings(list | None): the adjustments the service made to the request, each with atype, amessageand an optionaldetail -
usage(list | None): what the request billed, each entry with anameand acount -
session_id(str): the conversation ID, echoed back, or one generated by the service
-