1212- Supports both AI extraction and markdown conversion modes
1313"""
1414
15+ from enum import Enum
1516from typing import Optional , Type
1617from uuid import UUID
1718
1819from pydantic import BaseModel , Field , model_validator
1920
2021
22+ class TimeRange (str , Enum ):
23+ """Time range filter for search results.
24+
25+ Controls how recent the search results should be. This is useful for
26+ finding recent news, updates, or time-sensitive information.
27+
28+ Values:
29+ PAST_HOUR: Results from the past hour
30+ PAST_24_HOURS: Results from the past 24 hours
31+ PAST_WEEK: Results from the past week
32+ PAST_MONTH: Results from the past month
33+ PAST_YEAR: Results from the past year
34+ """
35+
36+ PAST_HOUR = "past_hour"
37+ PAST_24_HOURS = "past_24_hours"
38+ PAST_WEEK = "past_week"
39+ PAST_MONTH = "past_month"
40+ PAST_YEAR = "past_year"
41+
42+
2143class SearchScraperRequest (BaseModel ):
2244 """
2345 Request model for the SearchScraper endpoint.
@@ -34,6 +56,7 @@ class SearchScraperRequest(BaseModel):
3456 mock: Whether to use mock mode for testing
3557 render_heavy_js: Whether to render heavy JavaScript
3658 location_geo_code: Optional geo code for location-based search (e.g., "us")
59+ time_range: Optional time range filter for search results
3760
3861 Example:
3962 >>> request = SearchScraperRequest(
@@ -74,6 +97,17 @@ class SearchScraperRequest(BaseModel):
7497 description = "The geo code of the location to search in" ,
7598 example = "us" ,
7699 )
100+ time_range : Optional [TimeRange ] = Field (
101+ None ,
102+ description = "The date range to filter search results" ,
103+ examples = [
104+ TimeRange .PAST_HOUR ,
105+ TimeRange .PAST_24_HOURS ,
106+ TimeRange .PAST_WEEK ,
107+ TimeRange .PAST_MONTH ,
108+ TimeRange .PAST_YEAR ,
109+ ],
110+ )
77111
78112 @model_validator (mode = "after" )
79113 def validate_user_prompt (self ) -> "SearchScraperRequest" :
0 commit comments