From db6443944113d321c98efd0092478498bd4a34af Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Oct 2025 13:21:58 +0000 Subject: [PATCH 1/3] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 49a87f3..eb05b46 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 5 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/perplexity-ai%2Fperplexity-aba0c21c569842e93e17b69cae9cee58d389fce9c2482f4d251fd8727db05679.yml openapi_spec_hash: 3d01b1c1425f7d43a8acf8b99bb9b321 -config_hash: d7ba8374a217375f59388ce2ae8a5f90 +config_hash: 0be7520657a7a0fb6b5a839e716fe30c From 6c510eaf7239b14380059214d2fdb65fe2048d5c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 8 Oct 2025 21:43:08 +0000 Subject: [PATCH 2/3] feat(api): manual updates --- .stats.yml | 4 +- .../resources/async_/chat/completions.py | 22 ++++---- src/perplexity/resources/chat/completions.py | 52 ++++++++++++++++--- src/perplexity/resources/search.py | 12 ++--- .../async_/chat/completion_create_params.py | 10 +++- .../async_/chat/completion_get_params.py | 2 + .../types/chat/completion_create_params.py | 10 +++- src/perplexity/types/search_create_params.py | 2 +- .../types/search_create_response.py | 2 + .../types/shared/api_public_search_result.py | 3 ++ .../shared_params/api_public_search_result.py | 4 +- src/perplexity/types/stream_chunk.py | 4 +- .../async_/chat/test_completions.py | 14 +++++ tests/api_resources/chat/test_completions.py | 24 +++++++++ tests/api_resources/test_search.py | 4 +- 15 files changed, 135 insertions(+), 34 deletions(-) diff --git a/.stats.yml b/.stats.yml index eb05b46..b8499aa 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 5 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/perplexity-ai%2Fperplexity-aba0c21c569842e93e17b69cae9cee58d389fce9c2482f4d251fd8727db05679.yml -openapi_spec_hash: 3d01b1c1425f7d43a8acf8b99bb9b321 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/perplexity-ai%2Fperplexity-51a3b755ae8040a6baeff490b3226a94c02a71aca6c4754dd365d7d0de8e399d.yml +openapi_spec_hash: 03d28237de381a5b914ef738b3587bb5 config_hash: 0be7520657a7a0fb6b5a839e716fe30c diff --git a/src/perplexity/resources/async_/chat/completions.py b/src/perplexity/resources/async_/chat/completions.py index 198ff50..6f94a31 100644 --- a/src/perplexity/resources/async_/chat/completions.py +++ b/src/perplexity/resources/async_/chat/completions.py @@ -58,10 +58,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CompletionCreateResponse: """ - FastAPI wrapper around async chat completions - - This endpoint creates an asynchronous chat completion job and returns a job ID - that can be used to poll for results. + Submit an asynchronous chat completion request. Args: extra_headers: Send extra headers @@ -97,7 +94,7 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CompletionListResponse: - """list all async chat completion requests for a given user.""" + """Retrieve a list of all asynchronous chat completion requests for a given user.""" return self._get( "/async/chat/completions", options=make_request_options( @@ -113,6 +110,7 @@ def get( local_mode: bool | Omit = omit, x_client_env: str | Omit = omit, x_client_name: str | Omit = omit, + x_created_at_epoch_seconds: str | Omit = omit, x_request_time: str | Omit = omit, x_usage_tier: str | Omit = omit, x_user_id: str | Omit = omit, @@ -124,7 +122,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CompletionGetResponse: """ - get the response for a given async chat completion request. + Retrieve the response for a given asynchronous chat completion request. Args: extra_headers: Send extra headers @@ -142,6 +140,7 @@ def get( { "x-client-env": x_client_env, "x-client-name": x_client_name, + "x-created-at-epoch-seconds": x_created_at_epoch_seconds, "x-request-time": x_request_time, "x-usage-tier": x_usage_tier, "x-user-id": x_user_id, @@ -195,10 +194,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CompletionCreateResponse: """ - FastAPI wrapper around async chat completions - - This endpoint creates an asynchronous chat completion job and returns a job ID - that can be used to poll for results. + Submit an asynchronous chat completion request. Args: extra_headers: Send extra headers @@ -234,7 +230,7 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CompletionListResponse: - """list all async chat completion requests for a given user.""" + """Retrieve a list of all asynchronous chat completion requests for a given user.""" return await self._get( "/async/chat/completions", options=make_request_options( @@ -250,6 +246,7 @@ async def get( local_mode: bool | Omit = omit, x_client_env: str | Omit = omit, x_client_name: str | Omit = omit, + x_created_at_epoch_seconds: str | Omit = omit, x_request_time: str | Omit = omit, x_usage_tier: str | Omit = omit, x_user_id: str | Omit = omit, @@ -261,7 +258,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CompletionGetResponse: """ - get the response for a given async chat completion request. + Retrieve the response for a given asynchronous chat completion request. Args: extra_headers: Send extra headers @@ -279,6 +276,7 @@ async def get( { "x-client-env": x_client_env, "x-client-name": x_client_name, + "x-created-at-epoch-seconds": x_created_at_epoch_seconds, "x-request-time": x_request_time, "x-usage-tier": x_usage_tier, "x-user-id": x_user_id, diff --git a/src/perplexity/resources/chat/completions.py b/src/perplexity/resources/chat/completions.py index 02b2b7d..d44129b 100644 --- a/src/perplexity/resources/chat/completions.py +++ b/src/perplexity/resources/chat/completions.py @@ -68,6 +68,7 @@ def create( has_image_url: bool | Omit = omit, image_domain_filter: Optional[SequenceNotStr[str]] | Omit = omit, image_format_filter: Optional[SequenceNotStr[str]] | Omit = omit, + language_preference: Optional[str] | Omit = omit, last_updated_after_filter: Optional[str] | Omit = omit, last_updated_before_filter: Optional[str] | Omit = omit, latitude: Optional[float] | Omit = omit, @@ -95,7 +96,9 @@ def create( search_tenant: Optional[str] | Omit = omit, stop: Union[str, SequenceNotStr[str], None] | Omit = omit, stream: Optional[Literal[False]] | Omit = omit, + stream_mode: Literal["full", "concise"] | Omit = omit, temperature: Optional[float] | Omit = omit, + thread_id: Optional[str] | Omit = omit, tool_choice: Optional[Literal["none", "auto", "required"]] | Omit = omit, tools: Optional[Iterable[completion_create_params.Tool]] | Omit = omit, top_k: Optional[int] | Omit = omit, @@ -103,6 +106,7 @@ def create( top_p: Optional[float] | Omit = omit, updated_after_timestamp: Optional[int] | Omit = omit, updated_before_timestamp: Optional[int] | Omit = omit, + use_threads: Optional[bool] | Omit = omit, web_search_options: completion_create_params.WebSearchOptions | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -112,7 +116,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StreamChunk: """ - FastAPI wrapper around chat completions + Generate a chat completion response for the given conversation. Args: extra_headers: Send extra headers @@ -148,6 +152,7 @@ def create( has_image_url: bool | Omit = omit, image_domain_filter: Optional[SequenceNotStr[str]] | Omit = omit, image_format_filter: Optional[SequenceNotStr[str]] | Omit = omit, + language_preference: Optional[str] | Omit = omit, last_updated_after_filter: Optional[str] | Omit = omit, last_updated_before_filter: Optional[str] | Omit = omit, latitude: Optional[float] | Omit = omit, @@ -174,7 +179,9 @@ def create( search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]] | Omit = omit, search_tenant: Optional[str] | Omit = omit, stop: Union[str, SequenceNotStr[str], None] | Omit = omit, + stream_mode: Literal["full", "concise"] | Omit = omit, temperature: Optional[float] | Omit = omit, + thread_id: Optional[str] | Omit = omit, tool_choice: Optional[Literal["none", "auto", "required"]] | Omit = omit, tools: Optional[Iterable[completion_create_params.Tool]] | Omit = omit, top_k: Optional[int] | Omit = omit, @@ -182,6 +189,7 @@ def create( top_p: Optional[float] | Omit = omit, updated_after_timestamp: Optional[int] | Omit = omit, updated_before_timestamp: Optional[int] | Omit = omit, + use_threads: Optional[bool] | Omit = omit, web_search_options: completion_create_params.WebSearchOptions | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -191,7 +199,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Stream[StreamChunk]: """ - FastAPI wrapper around chat completions + Generate a chat completion response for the given conversation. Args: extra_headers: Send extra headers @@ -227,6 +235,7 @@ def create( has_image_url: bool | Omit = omit, image_domain_filter: Optional[SequenceNotStr[str]] | Omit = omit, image_format_filter: Optional[SequenceNotStr[str]] | Omit = omit, + language_preference: Optional[str] | Omit = omit, last_updated_after_filter: Optional[str] | Omit = omit, last_updated_before_filter: Optional[str] | Omit = omit, latitude: Optional[float] | Omit = omit, @@ -253,7 +262,9 @@ def create( search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]] | Omit = omit, search_tenant: Optional[str] | Omit = omit, stop: Union[str, SequenceNotStr[str], None] | Omit = omit, + stream_mode: Literal["full", "concise"] | Omit = omit, temperature: Optional[float] | Omit = omit, + thread_id: Optional[str] | Omit = omit, tool_choice: Optional[Literal["none", "auto", "required"]] | Omit = omit, tools: Optional[Iterable[completion_create_params.Tool]] | Omit = omit, top_k: Optional[int] | Omit = omit, @@ -261,6 +272,7 @@ def create( top_p: Optional[float] | Omit = omit, updated_after_timestamp: Optional[int] | Omit = omit, updated_before_timestamp: Optional[int] | Omit = omit, + use_threads: Optional[bool] | Omit = omit, web_search_options: completion_create_params.WebSearchOptions | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -270,7 +282,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StreamChunk | Stream[StreamChunk]: """ - FastAPI wrapper around chat completions + Generate a chat completion response for the given conversation. Args: extra_headers: Send extra headers @@ -305,6 +317,7 @@ def create( has_image_url: bool | Omit = omit, image_domain_filter: Optional[SequenceNotStr[str]] | Omit = omit, image_format_filter: Optional[SequenceNotStr[str]] | Omit = omit, + language_preference: Optional[str] | Omit = omit, last_updated_after_filter: Optional[str] | Omit = omit, last_updated_before_filter: Optional[str] | Omit = omit, latitude: Optional[float] | Omit = omit, @@ -332,7 +345,9 @@ def create( search_tenant: Optional[str] | Omit = omit, stop: Union[str, SequenceNotStr[str], None] | Omit = omit, stream: Optional[Literal[False]] | Literal[True] | Omit = omit, + stream_mode: Literal["full", "concise"] | Omit = omit, temperature: Optional[float] | Omit = omit, + thread_id: Optional[str] | Omit = omit, tool_choice: Optional[Literal["none", "auto", "required"]] | Omit = omit, tools: Optional[Iterable[completion_create_params.Tool]] | Omit = omit, top_k: Optional[int] | Omit = omit, @@ -340,6 +355,7 @@ def create( top_p: Optional[float] | Omit = omit, updated_after_timestamp: Optional[int] | Omit = omit, updated_before_timestamp: Optional[int] | Omit = omit, + use_threads: Optional[bool] | Omit = omit, web_search_options: completion_create_params.WebSearchOptions | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -370,6 +386,7 @@ def create( "has_image_url": has_image_url, "image_domain_filter": image_domain_filter, "image_format_filter": image_format_filter, + "language_preference": language_preference, "last_updated_after_filter": last_updated_after_filter, "last_updated_before_filter": last_updated_before_filter, "latitude": latitude, @@ -397,7 +414,9 @@ def create( "search_tenant": search_tenant, "stop": stop, "stream": stream, + "stream_mode": stream_mode, "temperature": temperature, + "thread_id": thread_id, "tool_choice": tool_choice, "tools": tools, "top_k": top_k, @@ -405,6 +424,7 @@ def create( "top_p": top_p, "updated_after_timestamp": updated_after_timestamp, "updated_before_timestamp": updated_before_timestamp, + "use_threads": use_threads, "web_search_options": web_search_options, }, completion_create_params.CompletionCreateParamsStreaming @@ -462,6 +482,7 @@ async def create( has_image_url: bool | Omit = omit, image_domain_filter: Optional[SequenceNotStr[str]] | Omit = omit, image_format_filter: Optional[SequenceNotStr[str]] | Omit = omit, + language_preference: Optional[str] | Omit = omit, last_updated_after_filter: Optional[str] | Omit = omit, last_updated_before_filter: Optional[str] | Omit = omit, latitude: Optional[float] | Omit = omit, @@ -489,7 +510,9 @@ async def create( search_tenant: Optional[str] | Omit = omit, stop: Union[str, SequenceNotStr[str], None] | Omit = omit, stream: Optional[Literal[False]] | Omit = omit, + stream_mode: Literal["full", "concise"] | Omit = omit, temperature: Optional[float] | Omit = omit, + thread_id: Optional[str] | Omit = omit, tool_choice: Optional[Literal["none", "auto", "required"]] | Omit = omit, tools: Optional[Iterable[completion_create_params.Tool]] | Omit = omit, top_k: Optional[int] | Omit = omit, @@ -497,6 +520,7 @@ async def create( top_p: Optional[float] | Omit = omit, updated_after_timestamp: Optional[int] | Omit = omit, updated_before_timestamp: Optional[int] | Omit = omit, + use_threads: Optional[bool] | Omit = omit, web_search_options: completion_create_params.WebSearchOptions | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -506,7 +530,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StreamChunk: """ - FastAPI wrapper around chat completions + Generate a chat completion response for the given conversation. Args: extra_headers: Send extra headers @@ -542,6 +566,7 @@ async def create( has_image_url: bool | Omit = omit, image_domain_filter: Optional[SequenceNotStr[str]] | Omit = omit, image_format_filter: Optional[SequenceNotStr[str]] | Omit = omit, + language_preference: Optional[str] | Omit = omit, last_updated_after_filter: Optional[str] | Omit = omit, last_updated_before_filter: Optional[str] | Omit = omit, latitude: Optional[float] | Omit = omit, @@ -568,7 +593,9 @@ async def create( search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]] | Omit = omit, search_tenant: Optional[str] | Omit = omit, stop: Union[str, SequenceNotStr[str], None] | Omit = omit, + stream_mode: Literal["full", "concise"] | Omit = omit, temperature: Optional[float] | Omit = omit, + thread_id: Optional[str] | Omit = omit, tool_choice: Optional[Literal["none", "auto", "required"]] | Omit = omit, tools: Optional[Iterable[completion_create_params.Tool]] | Omit = omit, top_k: Optional[int] | Omit = omit, @@ -576,6 +603,7 @@ async def create( top_p: Optional[float] | Omit = omit, updated_after_timestamp: Optional[int] | Omit = omit, updated_before_timestamp: Optional[int] | Omit = omit, + use_threads: Optional[bool] | Omit = omit, web_search_options: completion_create_params.WebSearchOptions | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -585,7 +613,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncStream[StreamChunk]: """ - FastAPI wrapper around chat completions + Generate a chat completion response for the given conversation. Args: extra_headers: Send extra headers @@ -621,6 +649,7 @@ async def create( has_image_url: bool | Omit = omit, image_domain_filter: Optional[SequenceNotStr[str]] | Omit = omit, image_format_filter: Optional[SequenceNotStr[str]] | Omit = omit, + language_preference: Optional[str] | Omit = omit, last_updated_after_filter: Optional[str] | Omit = omit, last_updated_before_filter: Optional[str] | Omit = omit, latitude: Optional[float] | Omit = omit, @@ -647,7 +676,9 @@ async def create( search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]] | Omit = omit, search_tenant: Optional[str] | Omit = omit, stop: Union[str, SequenceNotStr[str], None] | Omit = omit, + stream_mode: Literal["full", "concise"] | Omit = omit, temperature: Optional[float] | Omit = omit, + thread_id: Optional[str] | Omit = omit, tool_choice: Optional[Literal["none", "auto", "required"]] | Omit = omit, tools: Optional[Iterable[completion_create_params.Tool]] | Omit = omit, top_k: Optional[int] | Omit = omit, @@ -655,6 +686,7 @@ async def create( top_p: Optional[float] | Omit = omit, updated_after_timestamp: Optional[int] | Omit = omit, updated_before_timestamp: Optional[int] | Omit = omit, + use_threads: Optional[bool] | Omit = omit, web_search_options: completion_create_params.WebSearchOptions | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -664,7 +696,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StreamChunk | AsyncStream[StreamChunk]: """ - FastAPI wrapper around chat completions + Generate a chat completion response for the given conversation. Args: extra_headers: Send extra headers @@ -699,6 +731,7 @@ async def create( has_image_url: bool | Omit = omit, image_domain_filter: Optional[SequenceNotStr[str]] | Omit = omit, image_format_filter: Optional[SequenceNotStr[str]] | Omit = omit, + language_preference: Optional[str] | Omit = omit, last_updated_after_filter: Optional[str] | Omit = omit, last_updated_before_filter: Optional[str] | Omit = omit, latitude: Optional[float] | Omit = omit, @@ -726,7 +759,9 @@ async def create( search_tenant: Optional[str] | Omit = omit, stop: Union[str, SequenceNotStr[str], None] | Omit = omit, stream: Optional[Literal[False]] | Literal[True] | Omit = omit, + stream_mode: Literal["full", "concise"] | Omit = omit, temperature: Optional[float] | Omit = omit, + thread_id: Optional[str] | Omit = omit, tool_choice: Optional[Literal["none", "auto", "required"]] | Omit = omit, tools: Optional[Iterable[completion_create_params.Tool]] | Omit = omit, top_k: Optional[int] | Omit = omit, @@ -734,6 +769,7 @@ async def create( top_p: Optional[float] | Omit = omit, updated_after_timestamp: Optional[int] | Omit = omit, updated_before_timestamp: Optional[int] | Omit = omit, + use_threads: Optional[bool] | Omit = omit, web_search_options: completion_create_params.WebSearchOptions | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -764,6 +800,7 @@ async def create( "has_image_url": has_image_url, "image_domain_filter": image_domain_filter, "image_format_filter": image_format_filter, + "language_preference": language_preference, "last_updated_after_filter": last_updated_after_filter, "last_updated_before_filter": last_updated_before_filter, "latitude": latitude, @@ -791,7 +828,9 @@ async def create( "search_tenant": search_tenant, "stop": stop, "stream": stream, + "stream_mode": stream_mode, "temperature": temperature, + "thread_id": thread_id, "tool_choice": tool_choice, "tools": tools, "top_k": top_k, @@ -799,6 +838,7 @@ async def create( "top_p": top_p, "updated_after_timestamp": updated_after_timestamp, "updated_before_timestamp": updated_before_timestamp, + "use_threads": use_threads, "web_search_options": web_search_options, }, completion_create_params.CompletionCreateParamsStreaming diff --git a/src/perplexity/resources/search.py b/src/perplexity/resources/search.py index 96c3464..b6e2c26 100644 --- a/src/perplexity/resources/search.py +++ b/src/perplexity/resources/search.py @@ -48,7 +48,7 @@ def create( self, *, query: Union[str, SequenceNotStr[str]], - country: Optional[str] | Omit = omit, + display_server_time: bool | Omit = omit, max_results: int | Omit = omit, max_tokens: int | Omit = omit, max_tokens_per_page: int | Omit = omit, @@ -61,7 +61,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SearchCreateResponse: """ - Search + Search the web and retrieve relevant web page contents. Args: extra_headers: Send extra headers @@ -77,7 +77,7 @@ def create( body=maybe_transform( { "query": query, - "country": country, + "display_server_time": display_server_time, "max_results": max_results, "max_tokens": max_tokens, "max_tokens_per_page": max_tokens_per_page, @@ -116,7 +116,7 @@ async def create( self, *, query: Union[str, SequenceNotStr[str]], - country: Optional[str] | Omit = omit, + display_server_time: bool | Omit = omit, max_results: int | Omit = omit, max_tokens: int | Omit = omit, max_tokens_per_page: int | Omit = omit, @@ -129,7 +129,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SearchCreateResponse: """ - Search + Search the web and retrieve relevant web page contents. Args: extra_headers: Send extra headers @@ -145,7 +145,7 @@ async def create( body=await async_maybe_transform( { "query": query, - "country": country, + "display_server_time": display_server_time, "max_results": max_results, "max_tokens": max_tokens, "max_tokens_per_page": max_tokens_per_page, diff --git a/src/perplexity/types/async_/chat/completion_create_params.py b/src/perplexity/types/async_/chat/completion_create_params.py index e709a3b..351de27 100644 --- a/src/perplexity/types/async_/chat/completion_create_params.py +++ b/src/perplexity/types/async_/chat/completion_create_params.py @@ -124,7 +124,7 @@ class RequestWebSearchOptions(TypedDict, total=False): search_context_size: Literal["low", "medium", "high"] - search_type: Literal["fast", "pro", "auto"] + search_type: Optional[Literal["fast", "pro", "auto"]] user_location: Optional[RequestWebSearchOptionsUserLocation] @@ -166,6 +166,8 @@ class Request(TypedDict, total=False): image_format_filter: Optional[SequenceNotStr[str]] + language_preference: Optional[str] + last_updated_after_filter: Optional[str] last_updated_before_filter: Optional[str] @@ -220,8 +222,12 @@ class Request(TypedDict, total=False): stream: Optional[bool] + stream_mode: Literal["full", "concise"] + temperature: Optional[float] + thread_id: Optional[str] + tool_choice: Optional[Literal["none", "auto", "required"]] tools: Optional[Iterable[RequestTool]] @@ -236,4 +242,6 @@ class Request(TypedDict, total=False): updated_before_timestamp: Optional[int] + use_threads: Optional[bool] + web_search_options: RequestWebSearchOptions diff --git a/src/perplexity/types/async_/chat/completion_get_params.py b/src/perplexity/types/async_/chat/completion_get_params.py index 47b75d1..ff2f4ae 100644 --- a/src/perplexity/types/async_/chat/completion_get_params.py +++ b/src/perplexity/types/async_/chat/completion_get_params.py @@ -16,6 +16,8 @@ class CompletionGetParams(TypedDict, total=False): x_client_name: Annotated[str, PropertyInfo(alias="x-client-name")] + x_created_at_epoch_seconds: Annotated[str, PropertyInfo(alias="x-created-at-epoch-seconds")] + x_request_time: Annotated[str, PropertyInfo(alias="x-request-time")] x_usage_tier: Annotated[str, PropertyInfo(alias="x-usage-tier")] diff --git a/src/perplexity/types/chat/completion_create_params.py b/src/perplexity/types/chat/completion_create_params.py index 6e0413b..8a26fa0 100644 --- a/src/perplexity/types/chat/completion_create_params.py +++ b/src/perplexity/types/chat/completion_create_params.py @@ -64,6 +64,8 @@ class CompletionCreateParamsBase(TypedDict, total=False): image_format_filter: Optional[SequenceNotStr[str]] + language_preference: Optional[str] + last_updated_after_filter: Optional[str] last_updated_before_filter: Optional[str] @@ -116,8 +118,12 @@ class CompletionCreateParamsBase(TypedDict, total=False): stop: Union[str, SequenceNotStr[str], None] + stream_mode: Literal["full", "concise"] + temperature: Optional[float] + thread_id: Optional[str] + tool_choice: Optional[Literal["none", "auto", "required"]] tools: Optional[Iterable[Tool]] @@ -132,6 +138,8 @@ class CompletionCreateParamsBase(TypedDict, total=False): updated_before_timestamp: Optional[int] + use_threads: Optional[bool] + web_search_options: WebSearchOptions @@ -225,7 +233,7 @@ class WebSearchOptions(TypedDict, total=False): search_context_size: Literal["low", "medium", "high"] - search_type: Literal["fast", "pro", "auto"] + search_type: Optional[Literal["fast", "pro", "auto"]] user_location: Optional[WebSearchOptionsUserLocation] diff --git a/src/perplexity/types/search_create_params.py b/src/perplexity/types/search_create_params.py index 7046484..4eee96d 100644 --- a/src/perplexity/types/search_create_params.py +++ b/src/perplexity/types/search_create_params.py @@ -13,7 +13,7 @@ class SearchCreateParams(TypedDict, total=False): query: Required[Union[str, SequenceNotStr[str]]] - country: Optional[str] + display_server_time: bool max_results: int diff --git a/src/perplexity/types/search_create_response.py b/src/perplexity/types/search_create_response.py index feced6e..89b1c40 100644 --- a/src/perplexity/types/search_create_response.py +++ b/src/perplexity/types/search_create_response.py @@ -23,3 +23,5 @@ class SearchCreateResponse(BaseModel): id: str results: List[Result] + + server_time: Optional[str] = None diff --git a/src/perplexity/types/shared/api_public_search_result.py b/src/perplexity/types/shared/api_public_search_result.py index 6f02620..9f0a172 100644 --- a/src/perplexity/types/shared/api_public_search_result.py +++ b/src/perplexity/types/shared/api_public_search_result.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from typing_extensions import Literal from ..._models import BaseModel @@ -17,3 +18,5 @@ class APIPublicSearchResult(BaseModel): last_updated: Optional[str] = None snippet: Optional[str] = None + + source: Optional[Literal["web", "attachment"]] = None diff --git a/src/perplexity/types/shared_params/api_public_search_result.py b/src/perplexity/types/shared_params/api_public_search_result.py index 51a7431..0c003b4 100644 --- a/src/perplexity/types/shared_params/api_public_search_result.py +++ b/src/perplexity/types/shared_params/api_public_search_result.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Optional -from typing_extensions import Required, TypedDict +from typing_extensions import Literal, Required, TypedDict __all__ = ["APIPublicSearchResult"] @@ -18,3 +18,5 @@ class APIPublicSearchResult(TypedDict, total=False): last_updated: Optional[str] snippet: str + + source: Literal["web", "attachment"] diff --git a/src/perplexity/types/stream_chunk.py b/src/perplexity/types/stream_chunk.py index 58515fc..e2a9309 100644 --- a/src/perplexity/types/stream_chunk.py +++ b/src/perplexity/types/stream_chunk.py @@ -20,8 +20,6 @@ class StreamChunk(BaseModel): model: str - usage: UsageInfo - citations: Optional[List[str]] = None object: Optional[str] = None @@ -31,3 +29,5 @@ class StreamChunk(BaseModel): status: Optional[Literal["PENDING", "COMPLETED"]] = None type: Optional[Literal["message", "info", "end_of_stream"]] = None + + usage: Optional[UsageInfo] = None diff --git a/tests/api_resources/async_/chat/test_completions.py b/tests/api_resources/async_/chat/test_completions.py index c6c6bdd..e689e1e 100644 --- a/tests/api_resources/async_/chat/test_completions.py +++ b/tests/api_resources/async_/chat/test_completions.py @@ -72,6 +72,7 @@ def test_method_create_with_all_params(self, client: Perplexity) -> None: "date": "date", "last_updated": "last_updated", "snippet": "snippet", + "source": "web", } ] }, @@ -85,6 +86,7 @@ def test_method_create_with_all_params(self, client: Perplexity) -> None: "date": "date", "last_updated": "last_updated", "snippet": "snippet", + "source": "web", } ], }, @@ -122,6 +124,7 @@ def test_method_create_with_all_params(self, client: Perplexity) -> None: "has_image_url": True, "image_domain_filter": ["string"], "image_format_filter": ["string"], + "language_preference": "language_preference", "last_updated_after_filter": "last_updated_after_filter", "last_updated_before_filter": "last_updated_before_filter", "latitude": 0, @@ -149,7 +152,9 @@ def test_method_create_with_all_params(self, client: Perplexity) -> None: "search_tenant": "search_tenant", "stop": "string", "stream": True, + "stream_mode": "full", "temperature": 0, + "thread_id": "thread_id", "tool_choice": "none", "tools": [ { @@ -172,6 +177,7 @@ def test_method_create_with_all_params(self, client: Perplexity) -> None: "top_p": 0, "updated_after_timestamp": 0, "updated_before_timestamp": 0, + "use_threads": True, "web_search_options": { "image_results_enhanced_relevance": True, "search_context_size": "low", @@ -275,6 +281,7 @@ def test_method_get_with_all_params(self, client: Perplexity) -> None: local_mode=True, x_client_env="x-client-env", x_client_name="x-client-name", + x_created_at_epoch_seconds="x-created-at-epoch-seconds", x_request_time="x-request-time", x_usage_tier="x-usage-tier", x_user_id="x-user-id", @@ -372,6 +379,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncPerplexity "date": "date", "last_updated": "last_updated", "snippet": "snippet", + "source": "web", } ] }, @@ -385,6 +393,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncPerplexity "date": "date", "last_updated": "last_updated", "snippet": "snippet", + "source": "web", } ], }, @@ -422,6 +431,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncPerplexity "has_image_url": True, "image_domain_filter": ["string"], "image_format_filter": ["string"], + "language_preference": "language_preference", "last_updated_after_filter": "last_updated_after_filter", "last_updated_before_filter": "last_updated_before_filter", "latitude": 0, @@ -449,7 +459,9 @@ async def test_method_create_with_all_params(self, async_client: AsyncPerplexity "search_tenant": "search_tenant", "stop": "string", "stream": True, + "stream_mode": "full", "temperature": 0, + "thread_id": "thread_id", "tool_choice": "none", "tools": [ { @@ -472,6 +484,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncPerplexity "top_p": 0, "updated_after_timestamp": 0, "updated_before_timestamp": 0, + "use_threads": True, "web_search_options": { "image_results_enhanced_relevance": True, "search_context_size": "low", @@ -575,6 +588,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncPerplexity) - local_mode=True, x_client_env="x-client-env", x_client_name="x-client-name", + x_created_at_epoch_seconds="x-created-at-epoch-seconds", x_request_time="x-request-time", x_usage_tier="x-usage-tier", x_user_id="x-user-id", diff --git a/tests/api_resources/chat/test_completions.py b/tests/api_resources/chat/test_completions.py index a1d4329..0ce77a1 100644 --- a/tests/api_resources/chat/test_completions.py +++ b/tests/api_resources/chat/test_completions.py @@ -65,6 +65,7 @@ def test_method_create_with_all_params_overload_1(self, client: Perplexity) -> N "date": "date", "last_updated": "last_updated", "snippet": "snippet", + "source": "web", } ] }, @@ -78,6 +79,7 @@ def test_method_create_with_all_params_overload_1(self, client: Perplexity) -> N "date": "date", "last_updated": "last_updated", "snippet": "snippet", + "source": "web", } ], }, @@ -115,6 +117,7 @@ def test_method_create_with_all_params_overload_1(self, client: Perplexity) -> N has_image_url=True, image_domain_filter=["string"], image_format_filter=["string"], + language_preference="language_preference", last_updated_after_filter="last_updated_after_filter", last_updated_before_filter="last_updated_before_filter", latitude=0, @@ -142,7 +145,9 @@ def test_method_create_with_all_params_overload_1(self, client: Perplexity) -> N search_tenant="search_tenant", stop="string", stream=False, + stream_mode="full", temperature=0, + thread_id="thread_id", tool_choice="none", tools=[ { @@ -165,6 +170,7 @@ def test_method_create_with_all_params_overload_1(self, client: Perplexity) -> N top_p=0, updated_after_timestamp=0, updated_before_timestamp=0, + use_threads=True, web_search_options={ "image_results_enhanced_relevance": True, "search_context_size": "low", @@ -267,6 +273,7 @@ def test_method_create_with_all_params_overload_2(self, client: Perplexity) -> N "date": "date", "last_updated": "last_updated", "snippet": "snippet", + "source": "web", } ] }, @@ -280,6 +287,7 @@ def test_method_create_with_all_params_overload_2(self, client: Perplexity) -> N "date": "date", "last_updated": "last_updated", "snippet": "snippet", + "source": "web", } ], }, @@ -318,6 +326,7 @@ def test_method_create_with_all_params_overload_2(self, client: Perplexity) -> N has_image_url=True, image_domain_filter=["string"], image_format_filter=["string"], + language_preference="language_preference", last_updated_after_filter="last_updated_after_filter", last_updated_before_filter="last_updated_before_filter", latitude=0, @@ -344,7 +353,9 @@ def test_method_create_with_all_params_overload_2(self, client: Perplexity) -> N search_recency_filter="hour", search_tenant="search_tenant", stop="string", + stream_mode="full", temperature=0, + thread_id="thread_id", tool_choice="none", tools=[ { @@ -367,6 +378,7 @@ def test_method_create_with_all_params_overload_2(self, client: Perplexity) -> N top_p=0, updated_after_timestamp=0, updated_before_timestamp=0, + use_threads=True, web_search_options={ "image_results_enhanced_relevance": True, "search_context_size": "low", @@ -475,6 +487,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn "date": "date", "last_updated": "last_updated", "snippet": "snippet", + "source": "web", } ] }, @@ -488,6 +501,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn "date": "date", "last_updated": "last_updated", "snippet": "snippet", + "source": "web", } ], }, @@ -525,6 +539,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn has_image_url=True, image_domain_filter=["string"], image_format_filter=["string"], + language_preference="language_preference", last_updated_after_filter="last_updated_after_filter", last_updated_before_filter="last_updated_before_filter", latitude=0, @@ -552,7 +567,9 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn search_tenant="search_tenant", stop="string", stream=False, + stream_mode="full", temperature=0, + thread_id="thread_id", tool_choice="none", tools=[ { @@ -575,6 +592,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn top_p=0, updated_after_timestamp=0, updated_before_timestamp=0, + use_threads=True, web_search_options={ "image_results_enhanced_relevance": True, "search_context_size": "low", @@ -677,6 +695,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn "date": "date", "last_updated": "last_updated", "snippet": "snippet", + "source": "web", } ] }, @@ -690,6 +709,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn "date": "date", "last_updated": "last_updated", "snippet": "snippet", + "source": "web", } ], }, @@ -728,6 +748,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn has_image_url=True, image_domain_filter=["string"], image_format_filter=["string"], + language_preference="language_preference", last_updated_after_filter="last_updated_after_filter", last_updated_before_filter="last_updated_before_filter", latitude=0, @@ -754,7 +775,9 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn search_recency_filter="hour", search_tenant="search_tenant", stop="string", + stream_mode="full", temperature=0, + thread_id="thread_id", tool_choice="none", tools=[ { @@ -777,6 +800,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn top_p=0, updated_after_timestamp=0, updated_before_timestamp=0, + use_threads=True, web_search_options={ "image_results_enhanced_relevance": True, "search_context_size": "low", diff --git a/tests/api_resources/test_search.py b/tests/api_resources/test_search.py index ebe7d59..b396c85 100644 --- a/tests/api_resources/test_search.py +++ b/tests/api_resources/test_search.py @@ -30,7 +30,7 @@ def test_method_create(self, client: Perplexity) -> None: def test_method_create_with_all_params(self, client: Perplexity) -> None: search = client.search.create( query="string", - country="country", + display_server_time=True, max_results=0, max_tokens=0, max_tokens_per_page=0, @@ -83,7 +83,7 @@ async def test_method_create(self, async_client: AsyncPerplexity) -> None: async def test_method_create_with_all_params(self, async_client: AsyncPerplexity) -> None: search = await async_client.search.create( query="string", - country="country", + display_server_time=True, max_results=0, max_tokens=0, max_tokens_per_page=0, From c649829e3c6d2dbba9951921623b5643411f3096 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 8 Oct 2025 21:43:25 +0000 Subject: [PATCH 3/3] release: 0.14.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/perplexity/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d52d2b9..a26ebfc 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.13.0" + ".": "0.14.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2292ec7..5f22096 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.14.0 (2025-10-08) + +Full Changelog: [v0.13.0...v0.14.0](https://github.com/perplexityai/perplexity-py/compare/v0.13.0...v0.14.0) + +### Features + +* **api:** manual updates ([6c510ea](https://github.com/perplexityai/perplexity-py/commit/6c510eaf7239b14380059214d2fdb65fe2048d5c)) + ## 0.13.0 (2025-10-02) Full Changelog: [v0.12.1...v0.13.0](https://github.com/perplexityai/perplexity-py/compare/v0.12.1...v0.13.0) diff --git a/pyproject.toml b/pyproject.toml index a3ec816..8c43f55 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "perplexityai" -version = "0.13.0" +version = "0.14.0" description = "The official Python library for the perplexity API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/perplexity/_version.py b/src/perplexity/_version.py index 17f1046..2b42c84 100644 --- a/src/perplexity/_version.py +++ b/src/perplexity/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "perplexity" -__version__ = "0.13.0" # x-release-please-version +__version__ = "0.14.0" # x-release-please-version