Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.36.0"
".": "0.37.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 11
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/perplexity-ai/perplexity-c9a4aa7e01c6335588f6d246f5bc498d70ab7164bb8b753c7e031086af55cc64.yml
openapi_spec_hash: 4018d7234b9acf008622b921908b6329
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/perplexity-ai/perplexity-bf28ac7f1a24d27aa2ba57b65aaf7fc99f492d28ab969f570d86abc339c842e9.yml
openapi_spec_hash: 2f086349fe584965e24e58bddbb91672
config_hash: 059988c88f0dc18e9e393daed94b5eb6
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.37.0 (2026-06-02)

Full Changelog: [v0.36.0...v0.37.0](https://github.com/perplexityai/perplexity-py/compare/v0.36.0...v0.37.0)

### Features

* **search:** add search_context_size to search and web_search tool ([44cbf9d](https://github.com/perplexityai/perplexity-py/commit/44cbf9d360d7f86f98f23ade673df470115edf59))

## 0.36.0 (2026-05-30)

Full Changelog: [v0.35.1...v0.36.0](https://github.com/perplexityai/perplexity-py/compare/v0.35.1...v0.36.0)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "perplexityai"
version = "0.36.0"
version = "0.37.0"
description = "The official Python library for the perplexity API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/perplexity/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "perplexity"
__version__ = "0.36.0" # x-release-please-version
__version__ = "0.37.0" # x-release-please-version
12 changes: 12 additions & 0 deletions src/perplexity/resources/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def create(
max_tokens_per_page: int | Omit = omit,
search_after_date_filter: Optional[str] | Omit = omit,
search_before_date_filter: Optional[str] | Omit = omit,
search_context_size: Literal["low", "medium", "high"] | Omit = omit,
search_domain_filter: Optional[SequenceNotStr[str]] | Omit = omit,
search_language_filter: Optional[SequenceNotStr[str]] | Omit = omit,
search_mode: Optional[Literal["web", "academic", "sec"]] | Omit = omit,
Expand All @@ -73,6 +74,10 @@ def create(
Search the web and retrieve relevant web page contents.

Args:
search_context_size: Controls how much content is retrieved per result. Larger sizes return more page
content at higher cost. Defaults to "high". Omit when supplying explicit
max_tokens / max_tokens_per_page.

search_type: Search type — "web" for general web search, "people" for people search.
max_results above 20 is only supported for people search.

Expand All @@ -98,6 +103,7 @@ def create(
"max_tokens_per_page": max_tokens_per_page,
"search_after_date_filter": search_after_date_filter,
"search_before_date_filter": search_before_date_filter,
"search_context_size": search_context_size,
"search_domain_filter": search_domain_filter,
"search_language_filter": search_language_filter,
"search_mode": search_mode,
Expand Down Expand Up @@ -146,6 +152,7 @@ async def create(
max_tokens_per_page: int | Omit = omit,
search_after_date_filter: Optional[str] | Omit = omit,
search_before_date_filter: Optional[str] | Omit = omit,
search_context_size: Literal["low", "medium", "high"] | Omit = omit,
search_domain_filter: Optional[SequenceNotStr[str]] | Omit = omit,
search_language_filter: Optional[SequenceNotStr[str]] | Omit = omit,
search_mode: Optional[Literal["web", "academic", "sec"]] | Omit = omit,
Expand All @@ -162,6 +169,10 @@ async def create(
Search the web and retrieve relevant web page contents.

Args:
search_context_size: Controls how much content is retrieved per result. Larger sizes return more page
content at higher cost. Defaults to "high". Omit when supplying explicit
max_tokens / max_tokens_per_page.

search_type: Search type — "web" for general web search, "people" for people search.
max_results above 20 is only supported for people search.

Expand All @@ -187,6 +198,7 @@ async def create(
"max_tokens_per_page": max_tokens_per_page,
"search_after_date_filter": search_after_date_filter,
"search_before_date_filter": search_before_date_filter,
"search_context_size": search_context_size,
"search_domain_filter": search_domain_filter,
"search_language_filter": search_language_filter,
"search_mode": search_mode,
Expand Down
6 changes: 6 additions & 0 deletions src/perplexity/types/response_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ class ToolWebSearchTool(TypedDict, total=False):

max_tokens_per_page: int

search_context_size: Literal["low", "medium", "high"]
"""Search context size (low, medium, high).

Omit when supplying explicit max_tokens / max_tokens_per_page.
"""

user_location: ToolWebSearchToolUserLocation
"""User's geographic location for search personalization"""

Expand Down
7 changes: 7 additions & 0 deletions src/perplexity/types/search_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ class SearchCreateParams(TypedDict, total=False):

search_before_date_filter: Optional[str]

search_context_size: Literal["low", "medium", "high"]
"""Controls how much content is retrieved per result.

Larger sizes return more page content at higher cost. Defaults to "high". Omit
when supplying explicit max_tokens / max_tokens_per_page.
"""

search_domain_filter: Optional[SequenceNotStr[str]]

search_language_filter: Optional[SequenceNotStr[str]]
Expand Down
4 changes: 4 additions & 0 deletions tests/api_resources/test_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def test_method_create_with_all_params_overload_1(self, client: Perplexity) -> N
},
"max_tokens": 0,
"max_tokens_per_page": 0,
"search_context_size": "low",
"user_location": {
"city": "city",
"country": "country",
Expand Down Expand Up @@ -146,6 +147,7 @@ def test_method_create_with_all_params_overload_2(self, client: Perplexity) -> N
},
"max_tokens": 0,
"max_tokens_per_page": 0,
"search_context_size": "low",
"user_location": {
"city": "city",
"country": "country",
Expand Down Expand Up @@ -278,6 +280,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn
},
"max_tokens": 0,
"max_tokens_per_page": 0,
"search_context_size": "low",
"user_location": {
"city": "city",
"country": "country",
Expand Down Expand Up @@ -362,6 +365,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn
},
"max_tokens": 0,
"max_tokens_per_page": 0,
"search_context_size": "low",
"user_location": {
"city": "city",
"country": "country",
Expand Down
2 changes: 2 additions & 0 deletions tests/api_resources/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def test_method_create_with_all_params(self, client: Perplexity) -> None:
max_tokens_per_page=0,
search_after_date_filter="search_after_date_filter",
search_before_date_filter="search_before_date_filter",
search_context_size="low",
search_domain_filter=["string"],
search_language_filter=["string"],
search_mode="web",
Expand Down Expand Up @@ -101,6 +102,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncPerplexity
max_tokens_per_page=0,
search_after_date_filter="search_after_date_filter",
search_before_date_filter="search_before_date_filter",
search_context_size="low",
search_domain_filter=["string"],
search_language_filter=["string"],
search_mode="web",
Expand Down