66
77from typing import Any , Dict , Optional
88
9- from pydantic import BaseModel , Field , conint , model_validator
9+ from pydantic import BaseModel , ConfigDict , Field , conint , model_validator
10+ from pydantic .alias_generators import to_camel
1011
1112from .shared import LlmConfig
1213
1314
1415class SearchRequest (BaseModel ):
1516 """Request model for POST /v2/search."""
1617
18+ model_config = ConfigDict (
19+ alias_generator = to_camel ,
20+ populate_by_name = True ,
21+ )
22+
1723 query : str = Field (..., description = "The search query" )
1824 num_results : conint (ge = 3 , le = 20 ) = Field (
1925 default = 5 , description = "Number of results to return (3-20)"
2026 )
2127 output_schema : Optional [Dict [str , Any ]] = Field (
2228 default = None ,
29+ alias = "schema" ,
2330 description = "JSON Schema defining the structure of the extracted data" ,
2431 )
32+ location_geo_code : Optional [str ] = Field (
33+ default = None ,
34+ max_length = 10 ,
35+ description = "Two-letter country code for geo-targeted search results (e.g. 'us', 'gb', 'de')" ,
36+ )
2537 llm_config : Optional [LlmConfig ] = Field (
2638 default = None , description = "LLM configuration options"
2739 )
@@ -34,4 +46,5 @@ def validate_query(self) -> "SearchRequest":
3446
3547 def model_dump (self , * args : Any , ** kwargs : Any ) -> Dict [str , Any ]:
3648 kwargs .setdefault ("exclude_none" , True )
49+ kwargs .setdefault ("by_alias" , True )
3750 return super ().model_dump (* args , ** kwargs )
0 commit comments