Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
refactor: rename to gov
PhantomInTheWire163359e968c4
diff --git a/apps/js-sdk/firecrawl/README.md b/apps/js-sdk/firecrawl/README.mdindex a09467c9c..d52246c6d 100644--- a/apps/js-sdk/firecrawl/README.md+++ b/apps/js-sdk/firecrawl/README.md@@ -238,7 +238,7 @@ OR-combines GitHub-backed and documentation results.### Government search-Use `legalRegulatorySearch` to search the Firecrawl Government Index: primary+Use `govSearch` to search the Firecrawl Government Index: primarylaw and regulatory material from US federal, state, and local governmentsources, including statutes, regulations, codes, court opinions, and othergovernment publications. Results come back in the ordinary web-result shape.@@ -247,7 +247,7 @@ returns index results inside `.web`; like `developer`, it cannot be combinedwith other categories.```js-const law = await app.legalRegulatorySearch('food labeling requirements', {+const law = await app.govSearch('food labeling requirements', {k: 5,});diff --git a/apps/js-sdk/firecrawl/src/__tests__/unit/v2/legal-regulatory.test.ts b/apps/js-sdk/firecrawl/src/__tests__/unit/v2/gov.test.tssimilarity index 80%rename from apps/js-sdk/firecrawl/src/__tests__/unit/v2/legal-regulatory.test.tsrename to apps/js-sdk/firecrawl/src/__tests__/unit/v2/gov.test.tsindex 7407a5f6d..007ddee1c 100644--- a/apps/js-sdk/firecrawl/src/__tests__/unit/v2/legal-regulatory.test.ts+++ b/apps/js-sdk/firecrawl/src/__tests__/unit/v2/gov.test.ts@@ -24,7 +24,7 @@ function clientWith(http: any) {return client;}-describe("legalRegulatorySearch", () => {+describe("govSearch", () => {test.each([[{ k: 5 }, { query: "food labeling requirements", k: 5 }],[undefined, { query: "food labeling requirements" }],@@ -33,7 +33,7 @@ describe("legalRegulatorySearch", () => {post: jest.fn(async () => ({ status: 200, data: response })),} as any;- const result = await clientWith(http).legalRegulatorySearch(+ const result = await clientWith(http).govSearch("food labeling requirements",options,);@@ -45,9 +45,9 @@ describe("legalRegulatorySearch", () => {test("rejects an empty query", async () => {const http = { post: jest.fn() } as any;- await expect(- clientWith(http).legalRegulatorySearch(" "),- ).rejects.toThrow("query cannot be empty");+ await expect(clientWith(http).govSearch(" ")).rejects.toThrow(+ "query cannot be empty",+ );expect(http.post).not.toHaveBeenCalled();});@@ -59,8 +59,8 @@ describe("legalRegulatorySearch", () => {})),} as any;- await expect(- clientWith(http).legalRegulatorySearch("zoning variance"),- ).rejects.toThrow("Search failed");+ await expect(clientWith(http).govSearch("zoning variance")).rejects.toThrow(+ "Search failed",+ );});});diff --git a/apps/js-sdk/firecrawl/src/v2/client.ts b/apps/js-sdk/firecrawl/src/v2/client.tsindex 945609796..5f62d3c61 100644--- a/apps/js-sdk/firecrawl/src/v2/client.ts+++ b/apps/js-sdk/firecrawl/src/v2/client.ts@@ -8,7 +8,7 @@ import { parse as parseMethod, getParseFormats } from "./methods/parse";import { search } from "./methods/search";import { scrapeAlexandria, findTools } from "./methods/tools";import { developerSearch as developerSearchMethod } from "./methods/developer";-import { legalRegulatorySearch as legalRegulatorySearchMethod } from "./methods/legalRegulatory";+import { govSearch as govSearchMethod } from "./methods/gov";import { map as mapMethod } from "./methods/map";import { feedback as feedbackMethod, searchFeedback as searchFeedbackMethod } from "./methods/feedback";import {@@ -61,8 +61,8 @@ import type {SearchRequest,DeveloperSearchOptions,DeveloperSearchResponse,- LegalRegulatorySearchOptions,- LegalRegulatorySearchResponse,+ GovSearchOptions,+ GovSearchResponse,EndpointFeedbackRequest,FeedbackResponse,SearchFeedbackRequest,@@ -313,11 +313,11 @@ export class FirecrawlClient {* Search the Government Index: primary law and regulatory material* from US federal, state, and local government sources.*/- async legalRegulatorySearch(+ async govSearch(query: string,- options: LegalRegulatorySearchOptions = {},- ): Promise<LegalRegulatorySearchResponse> {- return legalRegulatorySearchMethod(this.http, query, options);+ options: GovSearchOptions = {},+ ): Promise<GovSearchResponse> {+ return govSearchMethod(this.http, query, options);}/**diff --git a/apps/js-sdk/firecrawl/src/v2/methods/legalRegulatory.ts b/apps/js-sdk/firecrawl/src/v2/methods/gov.tssimilarity index 69%rename from apps/js-sdk/firecrawl/src/v2/methods/legalRegulatory.tsrename to apps/js-sdk/firecrawl/src/v2/methods/gov.tsindex 8b7e797a3..8717b1297 100644--- a/apps/js-sdk/firecrawl/src/v2/methods/legalRegulatory.ts+++ b/apps/js-sdk/firecrawl/src/v2/methods/gov.ts@@ -1,7 +1,4 @@-import type {- LegalRegulatorySearchOptions,- LegalRegulatorySearchResponse,-} from "../types";+import type { GovSearchOptions, GovSearchResponse } from "../types";import { HttpClient } from "../utils/httpClient";import {normalizeAxiosError,@@ -11,15 +8,15 @@ import {const ENDPOINT = "/v2/search/gov";/** Search the Government Index. */-export async function legalRegulatorySearch(+export async function govSearch(http: HttpClient,query: string,- options: LegalRegulatorySearchOptions = {},-): Promise<LegalRegulatorySearchResponse> {+ options: GovSearchOptions = {},+): Promise<GovSearchResponse> {if (!query || !query.trim()) throw new Error("query cannot be empty");try {- const response = await http.post<LegalRegulatorySearchResponse>(ENDPOINT, {+ const response = await http.post<GovSearchResponse>(ENDPOINT, {query,...(options.k !== undefined ? { k: options.k } : {}),});diff --git a/apps/js-sdk/firecrawl/src/v2/types.ts b/apps/js-sdk/firecrawl/src/v2/types.tsindex 283531ff2..ee0cd0a36 100644--- a/apps/js-sdk/firecrawl/src/v2/types.ts+++ b/apps/js-sdk/firecrawl/src/v2/types.ts@@ -806,12 +806,12 @@ export interface DeveloperSearchResponse {sources?: DeveloperSearchSourceStatus[];}-export interface LegalRegulatorySearchOptions {+export interface GovSearchOptions {/** Total ranked results, 1–100 (default 10). */k?: number;}-export interface LegalRegulatorySearchResponse {+export interface GovSearchResponse {success: boolean;data: { web: SearchResultWeb[] };}diff --git a/apps/python-sdk/README.md b/apps/python-sdk/README.mdindex 98095bf64..5cdf39ebc 100644--- a/apps/python-sdk/README.md+++ b/apps/python-sdk/README.md@@ -260,7 +260,7 @@ OR-combines GitHub-backed and documentation results.### Government search-Use `legal_regulatory_search` to search the Firecrawl Government Index: primary+Use `gov_search` to search the Firecrawl Government Index: primarylaw and regulatory material from US federal, state, and local governmentsources, including statutes, regulations, codes, court opinions, and othergovernment publications. Results come back in the ordinary web-result shape.@@ -269,7 +269,7 @@ index results inside `.web`; like `developer`, it cannot be combined with othercategories.```python-law = firecrawl.legal_regulatory_search("food labeling requirements", k=5)+law = firecrawl.gov_search("food labeling requirements", k=5)for result in law.data.web:print(result.position, result.title, result.url)diff --git a/apps/python-sdk/firecrawl/__tests__/unit/v2/methods/test_legal_regulatory_search.py b/apps/python-sdk/firecrawl/__tests__/unit/v2/methods/test_gov_search.pysimilarity index 80%rename from apps/python-sdk/firecrawl/__tests__/unit/v2/methods/test_legal_regulatory_search.pyrename to apps/python-sdk/firecrawl/__tests__/unit/v2/methods/test_gov_search.pyindex 4b8322f31..972c40ba1 100644--- a/apps/python-sdk/firecrawl/__tests__/unit/v2/methods/test_legal_regulatory_search.py+++ b/apps/python-sdk/firecrawl/__tests__/unit/v2/methods/test_gov_search.py@@ -39,37 +39,37 @@ def _response(body=RESPONSE):({}, {"query": "food labeling requirements"}),],)-def test_legal_regulatory_search_posts_body_and_parses_web_results(kwargs, body):+def test_gov_search_posts_body_and_parses_web_results(kwargs, body):transport = Mock()transport.post.return_value = _response()client = FirecrawlClient.__new__(FirecrawlClient)client.http_client = transport- result = client.legal_regulatory_search("food labeling requirements", **kwargs)+ result = client.gov_search("food labeling requirements", **kwargs)transport.post.assert_called_once_with("/v2/search/gov", body)assert result.data.web[0].title == "21 CFR Part 101 -- Food Labeling"assert result.data.web[0].position == 1-def test_legal_regulatory_search_rejects_empty_query():+def test_gov_search_rejects_empty_query():transport = Mock()client = FirecrawlClient.__new__(FirecrawlClient)client.http_client = transportwith pytest.raises(ValueError, match="query cannot be empty"):- client.legal_regulatory_search(" ")+ client.gov_search(" ")transport.post.assert_not_called()@pytest.mark.asyncio-async def test_async_legal_regulatory_search_posts_query_and_k():+async def test_async_gov_search_posts_query_and_k():transport = Mock()transport.post = AsyncMock(return_value=_response())client = AsyncFirecrawlClient.__new__(AsyncFirecrawlClient)client.async_http_client = transport- result = await client.legal_regulatory_search("food labeling requirements", k=5)+ result = await client.gov_search("food labeling requirements", k=5)transport.post.assert_awaited_once_with("/v2/search/gov", {"query": "food labeling requirements", "k": 5}@@ -77,11 +77,11 @@ async def test_async_legal_regulatory_search_posts_query_and_k():assert result.data.web[0].url.startswith("https://www.ecfr.gov/")-def test_legal_regulatory_search_raises_on_unsuccessful_body():+def test_gov_search_raises_on_unsuccessful_body():transport = Mock()transport.post.return_value = _response(FAILED)client = FirecrawlClient.__new__(FirecrawlClient)client.http_client = transportwith pytest.raises(FirecrawlError, match="Search failed"):- client.legal_regulatory_search("zoning variance")+ client.gov_search("zoning variance")diff --git a/apps/python-sdk/firecrawl/client.py b/apps/python-sdk/firecrawl/client.pyindex 3919c063b..d066011f4 100644--- a/apps/python-sdk/firecrawl/client.py+++ b/apps/python-sdk/firecrawl/client.py@@ -82,7 +82,7 @@ class V2Proxy:self.get_parse_formats = client_instance.get_parse_formatsself.search = client_instance.searchself.developer_search = client_instance.developer_search- self.legal_regulatory_search = client_instance.legal_regulatory_search+ self.gov_search = client_instance.gov_searchself.crawl = client_instance.crawlself.start_crawl = client_instance.start_crawlself.get_crawl_status = client_instance.get_crawl_status@@ -176,7 +176,7 @@ class AsyncV2Proxy:self.get_parse_formats = client_instance.get_parse_formatsself.search = client_instance.searchself.developer_search = client_instance.developer_search- self.legal_regulatory_search = client_instance.legal_regulatory_search+ self.gov_search = client_instance.gov_searchself.crawl = client_instance.crawlself.start_crawl = client_instance.start_crawlself.wait_crawl = client_instance.wait_crawl@@ -294,7 +294,7 @@ class Firecrawl:self.get_parse_formats = self._v2_client.get_parse_formatsself.search = self._v2_client.searchself.developer_search = self._v2_client.developer_search- self.legal_regulatory_search = self._v2_client.legal_regulatory_search+ self.gov_search = self._v2_client.gov_searchself.map = self._v2_client.mapself.create_monitor = self._v2_client.create_monitorself.list_monitors = self._v2_client.list_monitors@@ -440,7 +440,7 @@ class AsyncFirecrawl:self.get_parse_formats = self._v2_client.get_parse_formatsself.search = self._v2_client.searchself.developer_search = self._v2_client.developer_search- self.legal_regulatory_search = self._v2_client.legal_regulatory_search+ self.gov_search = self._v2_client.gov_searchself.map = self._v2_client.mapself.create_monitor = self._v2_client.create_monitorself.list_monitors = self._v2_client.list_monitorsdiff --git a/apps/python-sdk/firecrawl/types.py b/apps/python-sdk/firecrawl/types.pyindex ed127f24b..ff39f6da3 100644--- a/apps/python-sdk/firecrawl/types.py+++ b/apps/python-sdk/firecrawl/types.py@@ -69,9 +69,9 @@ from .v2.types import (DeveloperSearchRepoStatus,DeveloperSearchSourceStatus,DeveloperSearchResponse,- LegalRegulatorySearchRequest,- LegalRegulatorySearchData,- LegalRegulatorySearchResponse,+ GovSearchRequest,+ GovSearchData,+ GovSearchResponse,# Action typesWaitAction,@@ -172,9 +172,9 @@ __all__ = ['DeveloperSearchRepoStatus','DeveloperSearchSourceStatus','DeveloperSearchResponse',- 'LegalRegulatorySearchRequest',- 'LegalRegulatorySearchData',- 'LegalRegulatorySearchResponse',+ 'GovSearchRequest',+ 'GovSearchData',+ 'GovSearchResponse',# Action types'WaitAction',diff --git a/apps/python-sdk/firecrawl/v2/client.py b/apps/python-sdk/firecrawl/v2/client.pyindex 0ece91cc2..9f3d5c0c7 100644--- a/apps/python-sdk/firecrawl/v2/client.py+++ b/apps/python-sdk/firecrawl/v2/client.py@@ -17,7 +17,7 @@ from .types import (SearchData,DeveloperSearchResponse,DeveloperSearchType,- LegalRegulatorySearchResponse,+ GovSearchResponse,SourceOption,CategoryOption,FindToolsData,@@ -70,7 +70,7 @@ from .methods import crawl as crawl_modulefrom .methods import batch as batch_modulefrom .methods import search as search_modulefrom .methods import developer as developer_module-from .methods import legal_regulatory as legal_regulatory_module+from .methods import gov as gov_modulefrom .methods import map as map_modulefrom .methods import batch as batch_methodsfrom .methods import usage as usage_methods@@ -587,13 +587,13 @@ class FirecrawlClient:skills=skills,)- def legal_regulatory_search(+ def gov_search(self,query: str,k: Optional[int] = None,- ) -> LegalRegulatorySearchResponse:+ ) -> GovSearchResponse:"""Search the Government Index of US primary law and regulatory material."""- return legal_regulatory_module.legal_regulatory_search(+ return gov_module.gov_search(self.http_client, query, k=k)diff --git a/apps/python-sdk/firecrawl/v2/client_async.py b/apps/python-sdk/firecrawl/v2/client_async.pyindex d2bc611bc..ca58054ea 100644--- a/apps/python-sdk/firecrawl/v2/client_async.py+++ b/apps/python-sdk/firecrawl/v2/client_async.py@@ -20,7 +20,7 @@ from .types import (SearchData,DeveloperSearchResponse,DeveloperSearchType,- LegalRegulatorySearchResponse,+ GovSearchResponse,SourceOption,FindToolsData,AlexandriaCall,@@ -66,7 +66,7 @@ from .methods.aio import batch as async_batch # type: ignore[attr-defined]from .methods.aio import crawl as async_crawl # type: ignore[attr-defined]from .methods.aio import search as async_search # type: ignore[attr-defined]from .methods.aio import developer as async_developer # type: ignore[attr-defined]-from .methods.aio import legal_regulatory as async_legal_regulatory # type: ignore[attr-defined]+from .methods.aio import gov as async_gov # type: ignore[attr-defined]from .methods.aio import map as async_map # type: ignore[attr-defined]from .methods.aio import usage as async_usage # type: ignore[attr-defined]from .methods.aio import extract as async_extract # type: ignore[attr-defined]@@ -358,13 +358,13 @@ class AsyncFirecrawlClient:skills=skills,)- async def legal_regulatory_search(+ async def gov_search(self,query: str,k: Optional[int] = None,- ) -> LegalRegulatorySearchResponse:+ ) -> GovSearchResponse:"""Search the Government Index of US primary law and regulatory material."""- return await async_legal_regulatory.legal_regulatory_search(+ return await async_gov.gov_search(self.async_http_client, query, k=k)diff --git a/apps/python-sdk/firecrawl/v2/methods/aio/legal_regulatory.py b/apps/python-sdk/firecrawl/v2/methods/aio/gov.pysimilarity index 73%rename from apps/python-sdk/firecrawl/v2/methods/aio/legal_regulatory.pyrename to apps/python-sdk/firecrawl/v2/methods/aio/gov.pyindex 4ef5b1d27..cfcc30e16 100644--- a/apps/python-sdk/firecrawl/v2/methods/aio/legal_regulatory.py+++ b/apps/python-sdk/firecrawl/v2/methods/aio/gov.py@@ -2,7 +2,7 @@from typing import Optional-from ...types import LegalRegulatorySearchRequest, LegalRegulatorySearchResponse+from ...types import GovSearchRequest, GovSearchResponsefrom ...utils.error_handler import handle_response_errorfrom ...utils.http_client_async import AsyncHttpClient@@ -10,21 +10,21 @@ from ...utils.http_client_async import AsyncHttpClientENDPOINT = "/v2/search/gov"-async def legal_regulatory_search(+async def gov_search(client: AsyncHttpClient,query: str,*,k: Optional[int] = None,-) -> LegalRegulatorySearchResponse:+) -> GovSearchResponse:"""Search the Government Index asynchronously."""if not query or not query.strip():raise ValueError("query cannot be empty")- request = LegalRegulatorySearchRequest(query=query, k=k)+ request = GovSearchRequest(query=query, k=k)response = await client.post(ENDPOINT, request.model_dump(exclude_none=True))if response.status_code != 200:handle_response_error(response, "search the Government Index")response_data = response.json()if not response_data.get("success"):handle_response_error(response, "search the Government Index")- return LegalRegulatorySearchResponse.model_validate(response_data)+ return GovSearchResponse.model_validate(response_data)diff --git a/apps/python-sdk/firecrawl/v2/methods/legal_regulatory.py b/apps/python-sdk/firecrawl/v2/methods/gov.pysimilarity index 72%rename from apps/python-sdk/firecrawl/v2/methods/legal_regulatory.pyrename to apps/python-sdk/firecrawl/v2/methods/gov.pyindex 0db499a18..e06d0041b 100644--- a/apps/python-sdk/firecrawl/v2/methods/legal_regulatory.py+++ b/apps/python-sdk/firecrawl/v2/methods/gov.py@@ -2,28 +2,28 @@from typing import Optional-from ..types import LegalRegulatorySearchRequest, LegalRegulatorySearchResponse+from ..types import GovSearchRequest, GovSearchResponsefrom ..utils import HttpClient, handle_response_errorENDPOINT = "/v2/search/gov"-def legal_regulatory_search(+def gov_search(client: HttpClient,query: str,*,k: Optional[int] = None,-) -> LegalRegulatorySearchResponse:+) -> GovSearchResponse:"""Search the Government Index."""if not query or not query.strip():raise ValueError("query cannot be empty")- request = LegalRegulatorySearchRequest(query=query, k=k)+ request = GovSearchRequest(query=query, k=k)response = client.post(ENDPOINT, request.model_dump(exclude_none=True))if response.status_code != 200:handle_response_error(response, "search the Government Index")response_data = response.json()if not response_data.get("success"):handle_response_error(response, "search the Government Index")- return LegalRegulatorySearchResponse.model_validate(response_data)+ return GovSearchResponse.model_validate(response_data)diff --git a/apps/python-sdk/firecrawl/v2/types.py b/apps/python-sdk/firecrawl/v2/types.pyindex 1eb4df9b7..6e6bc2a72 100644--- a/apps/python-sdk/firecrawl/v2/types.py+++ b/apps/python-sdk/firecrawl/v2/types.py@@ -2414,20 +2414,20 @@ class DeveloperSearchResponse(BaseModel):sources: Optional[List[DeveloperSearchSourceStatus]] = None-class LegalRegulatorySearchRequest(BaseModel):+class GovSearchRequest(BaseModel):"""Request for the Government Index search endpoint."""query: strk: Optional[int] = Field(default=None, ge=1, le=100)-class LegalRegulatorySearchData(BaseModel):+class GovSearchData(BaseModel):web: List[SearchResultWeb]-class LegalRegulatorySearchResponse(BaseModel):+class GovSearchResponse(BaseModel):success: bool- data: LegalRegulatorySearchData+ data: GovSearchDataclass SearchRequest(BaseModel):