Add missing country parameter to search API #15
      
        
          +153
        
        
          −3
        
        
          
        
      
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Summary
This PR resolves issue #12 by adding the missing
countryparameter to the search API. The parameter is available in the Perplexity API playground but was missing from the Python SDK.Changes
🔧 Core Changes
countryparameter toSearchCreateParams- Added the parameter definition with proper typing (Optional[str])countryparameter to bothSearchResource.create()andAsyncSearchResource.create()methods📚 Documentation & Examples
examples/search_with_country.pydemonstrating both sync and async usage📝 Files Modified
src/perplexity/types/search_create_params.py- Added country parameter definitionsrc/perplexity/resources/search.py- Added country parameter to both sync and async methodsREADME.md- Added documentation section for country parameterexamples/search_with_country.py- New example demonstrating usageUsage
Parameter Details
Optional[str]Testing
The fix includes:
Related Issues
Backward Compatibility
This change is fully backward compatible as the
countryparameter is optional and defaults toomit. Existing code will continue to work without modification.Note: This parameter was already available in the Perplexity API but was missing from the Python SDK. This PR brings the SDK in line with the actual API capabilities shown in the playground.