Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

feat(python-sdk): normalize docs in search results (#2098)

Rafael Miller471feacb229a
diff --git a/apps/python-sdk/firecrawl/v2/methods/aio/search.py b/apps/python-sdk/firecrawl/v2/methods/aio/search.py
index a86454db4..846a201ae 100644
--- a/apps/python-sdk/firecrawl/v2/methods/aio/search.py
+++ b/apps/python-sdk/firecrawl/v2/methods/aio/search.py
@@ -10,6 +10,7 @@ from ...types import (
)
from ...utils.http_client_async import AsyncHttpClient
from ...utils.error_handler import handle_response_error
+from ...utils.normalize import normalize_document_input
from ...utils.validation import validate_scrape_options, prepare_scrape_options
T = TypeVar("T")
@@ -73,7 +74,7 @@ def _transform_array(arr: List[Any], result_type: Type[T]) -> List[Union[T, Docu
"summary" in item or
"json" in item
):
- results.append(Document(**item))
+ results.append(Document(**normalize_document_input(item)))
else:
results.append(result_type(**item))
else:
diff --git a/apps/python-sdk/firecrawl/v2/methods/search.py b/apps/python-sdk/firecrawl/v2/methods/search.py
index aedd51c1c..56735866c 100644
--- a/apps/python-sdk/firecrawl/v2/methods/search.py
+++ b/apps/python-sdk/firecrawl/v2/methods/search.py
@@ -71,7 +71,7 @@ def _transform_array(arr: List[Any], result_type: Type[T]) -> List[Union[T, 'Doc
"summary" in item or
"json" in item
):
- results.append(Document(**item))
+ results.append(Document(**normalize_document_input(item)))
else:
results.append(result_type(**item))
else: