perplexityai 0.10.0__py3-none-any.whl → 0.12.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of perplexityai might be problematic. Click here for more details.

perplexity/__init__.py CHANGED
@@ -3,7 +3,7 @@
3
3
  import typing as _t
4
4
 
5
5
  from . import types
6
- from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
6
+ from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes, omit, not_given
7
7
  from ._utils import file_from_path
8
8
  from ._client import (
9
9
  Client,
@@ -48,7 +48,9 @@ __all__ = [
48
48
  "ProxiesTypes",
49
49
  "NotGiven",
50
50
  "NOT_GIVEN",
51
+ "not_given",
51
52
  "Omit",
53
+ "omit",
52
54
  "PerplexityError",
53
55
  "APIError",
54
56
  "APIStatusError",
@@ -42,7 +42,6 @@ from . import _exceptions
42
42
  from ._qs import Querystring
43
43
  from ._files import to_httpx_files, async_to_httpx_files
44
44
  from ._types import (
45
- NOT_GIVEN,
46
45
  Body,
47
46
  Omit,
48
47
  Query,
@@ -57,6 +56,7 @@ from ._types import (
57
56
  RequestOptions,
58
57
  HttpxRequestFiles,
59
58
  ModelBuilderProtocol,
59
+ not_given,
60
60
  )
61
61
  from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping
62
62
  from ._compat import PYDANTIC_V1, model_copy, model_dump
@@ -145,9 +145,9 @@ class PageInfo:
145
145
  def __init__(
146
146
  self,
147
147
  *,
148
- url: URL | NotGiven = NOT_GIVEN,
149
- json: Body | NotGiven = NOT_GIVEN,
150
- params: Query | NotGiven = NOT_GIVEN,
148
+ url: URL | NotGiven = not_given,
149
+ json: Body | NotGiven = not_given,
150
+ params: Query | NotGiven = not_given,
151
151
  ) -> None:
152
152
  self.url = url
153
153
  self.json = json
@@ -595,7 +595,7 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
595
595
  # we internally support defining a temporary header to override the
596
596
  # default `cast_to` type for use with `.with_raw_response` and `.with_streaming_response`
597
597
  # see _response.py for implementation details
598
- override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, NOT_GIVEN)
598
+ override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, not_given)
599
599
  if is_given(override_cast_to):
600
600
  options.headers = headers
601
601
  return cast(Type[ResponseT], override_cast_to)
@@ -825,7 +825,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
825
825
  version: str,
826
826
  base_url: str | URL,
827
827
  max_retries: int = DEFAULT_MAX_RETRIES,
828
- timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
828
+ timeout: float | Timeout | None | NotGiven = not_given,
829
829
  http_client: httpx.Client | None = None,
830
830
  custom_headers: Mapping[str, str] | None = None,
831
831
  custom_query: Mapping[str, object] | None = None,
@@ -1356,7 +1356,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1356
1356
  base_url: str | URL,
1357
1357
  _strict_response_validation: bool,
1358
1358
  max_retries: int = DEFAULT_MAX_RETRIES,
1359
- timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
1359
+ timeout: float | Timeout | None | NotGiven = not_given,
1360
1360
  http_client: httpx.AsyncClient | None = None,
1361
1361
  custom_headers: Mapping[str, str] | None = None,
1362
1362
  custom_query: Mapping[str, object] | None = None,
@@ -1818,8 +1818,8 @@ def make_request_options(
1818
1818
  extra_query: Query | None = None,
1819
1819
  extra_body: Body | None = None,
1820
1820
  idempotency_key: str | None = None,
1821
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1822
- post_parser: PostParser | NotGiven = NOT_GIVEN,
1821
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1822
+ post_parser: PostParser | NotGiven = not_given,
1823
1823
  ) -> RequestOptions:
1824
1824
  """Create a dict of type RequestOptions without keys of NotGiven values."""
1825
1825
  options: RequestOptions = {}
perplexity/_client.py CHANGED
@@ -3,7 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import os
6
- from typing import Any, Union, Mapping
6
+ from typing import Any, Mapping
7
7
  from typing_extensions import Self, override
8
8
 
9
9
  import httpx
@@ -11,13 +11,13 @@ import httpx
11
11
  from . import _exceptions
12
12
  from ._qs import Querystring
13
13
  from ._types import (
14
- NOT_GIVEN,
15
14
  Omit,
16
15
  Timeout,
17
16
  NotGiven,
18
17
  Transport,
19
18
  ProxiesTypes,
20
19
  RequestOptions,
20
+ not_given,
21
21
  )
22
22
  from ._utils import is_given, get_async_library
23
23
  from ._version import __version__
@@ -59,7 +59,7 @@ class Perplexity(SyncAPIClient):
59
59
  *,
60
60
  api_key: str | None = None,
61
61
  base_url: str | httpx.URL | None = None,
62
- timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
62
+ timeout: float | Timeout | None | NotGiven = not_given,
63
63
  max_retries: int = DEFAULT_MAX_RETRIES,
64
64
  default_headers: Mapping[str, str] | None = None,
65
65
  default_query: Mapping[str, object] | None = None,
@@ -136,9 +136,9 @@ class Perplexity(SyncAPIClient):
136
136
  *,
137
137
  api_key: str | None = None,
138
138
  base_url: str | httpx.URL | None = None,
139
- timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
139
+ timeout: float | Timeout | None | NotGiven = not_given,
140
140
  http_client: httpx.Client | None = None,
141
- max_retries: int | NotGiven = NOT_GIVEN,
141
+ max_retries: int | NotGiven = not_given,
142
142
  default_headers: Mapping[str, str] | None = None,
143
143
  set_default_headers: Mapping[str, str] | None = None,
144
144
  default_query: Mapping[str, object] | None = None,
@@ -231,7 +231,7 @@ class AsyncPerplexity(AsyncAPIClient):
231
231
  *,
232
232
  api_key: str | None = None,
233
233
  base_url: str | httpx.URL | None = None,
234
- timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
234
+ timeout: float | Timeout | None | NotGiven = not_given,
235
235
  max_retries: int = DEFAULT_MAX_RETRIES,
236
236
  default_headers: Mapping[str, str] | None = None,
237
237
  default_query: Mapping[str, object] | None = None,
@@ -308,9 +308,9 @@ class AsyncPerplexity(AsyncAPIClient):
308
308
  *,
309
309
  api_key: str | None = None,
310
310
  base_url: str | httpx.URL | None = None,
311
- timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
311
+ timeout: float | Timeout | None | NotGiven = not_given,
312
312
  http_client: httpx.AsyncClient | None = None,
313
- max_retries: int | NotGiven = NOT_GIVEN,
313
+ max_retries: int | NotGiven = not_given,
314
314
  default_headers: Mapping[str, str] | None = None,
315
315
  set_default_headers: Mapping[str, str] | None = None,
316
316
  default_query: Mapping[str, object] | None = None,
perplexity/_qs.py CHANGED
@@ -4,7 +4,7 @@ from typing import Any, List, Tuple, Union, Mapping, TypeVar
4
4
  from urllib.parse import parse_qs, urlencode
5
5
  from typing_extensions import Literal, get_args
6
6
 
7
- from ._types import NOT_GIVEN, NotGiven, NotGivenOr
7
+ from ._types import NotGiven, not_given
8
8
  from ._utils import flatten
9
9
 
10
10
  _T = TypeVar("_T")
@@ -41,8 +41,8 @@ class Querystring:
41
41
  self,
42
42
  params: Params,
43
43
  *,
44
- array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN,
45
- nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN,
44
+ array_format: ArrayFormat | NotGiven = not_given,
45
+ nested_format: NestedFormat | NotGiven = not_given,
46
46
  ) -> str:
47
47
  return urlencode(
48
48
  self.stringify_items(
@@ -56,8 +56,8 @@ class Querystring:
56
56
  self,
57
57
  params: Params,
58
58
  *,
59
- array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN,
60
- nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN,
59
+ array_format: ArrayFormat | NotGiven = not_given,
60
+ nested_format: NestedFormat | NotGiven = not_given,
61
61
  ) -> list[tuple[str, str]]:
62
62
  opts = Options(
63
63
  qs=self,
@@ -143,8 +143,8 @@ class Options:
143
143
  self,
144
144
  qs: Querystring = _qs,
145
145
  *,
146
- array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN,
147
- nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN,
146
+ array_format: ArrayFormat | NotGiven = not_given,
147
+ nested_format: NestedFormat | NotGiven = not_given,
148
148
  ) -> None:
149
149
  self.array_format = qs.array_format if isinstance(array_format, NotGiven) else array_format
150
150
  self.nested_format = qs.nested_format if isinstance(nested_format, NotGiven) else nested_format
perplexity/_types.py CHANGED
@@ -117,18 +117,21 @@ class RequestOptions(TypedDict, total=False):
117
117
  # Sentinel class used until PEP 0661 is accepted
118
118
  class NotGiven:
119
119
  """
120
- A sentinel singleton class used to distinguish omitted keyword arguments
121
- from those passed in with the value None (which may have different behavior).
120
+ For parameters with a meaningful None value, we need to distinguish between
121
+ the user explicitly passing None, and the user not passing the parameter at
122
+ all.
123
+
124
+ User code shouldn't need to use not_given directly.
122
125
 
123
126
  For example:
124
127
 
125
128
  ```py
126
- def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ...
129
+ def create(timeout: Timeout | None | NotGiven = not_given): ...
127
130
 
128
131
 
129
- get(timeout=1) # 1s timeout
130
- get(timeout=None) # No timeout
131
- get() # Default timeout behavior, which may not be statically known at the method definition.
132
+ create(timeout=1) # 1s timeout
133
+ create(timeout=None) # No timeout
134
+ create() # Default timeout behavior
132
135
  ```
133
136
  """
134
137
 
@@ -140,13 +143,14 @@ class NotGiven:
140
143
  return "NOT_GIVEN"
141
144
 
142
145
 
143
- NotGivenOr = Union[_T, NotGiven]
146
+ not_given = NotGiven()
147
+ # for backwards compatibility:
144
148
  NOT_GIVEN = NotGiven()
145
149
 
146
150
 
147
151
  class Omit:
148
- """In certain situations you need to be able to represent a case where a default value has
149
- to be explicitly removed and `None` is not an appropriate substitute, for example:
152
+ """
153
+ To explicitly omit something from being sent in a request, use `omit`.
150
154
 
151
155
  ```py
152
156
  # as the default `Content-Type` header is `application/json` that will be sent
@@ -156,8 +160,8 @@ class Omit:
156
160
  # to look something like: 'multipart/form-data; boundary=0d8382fcf5f8c3be01ca2e11002d2983'
157
161
  client.post(..., headers={"Content-Type": "multipart/form-data"})
158
162
 
159
- # instead you can remove the default `application/json` header by passing Omit
160
- client.post(..., headers={"Content-Type": Omit()})
163
+ # instead you can remove the default `application/json` header by passing omit
164
+ client.post(..., headers={"Content-Type": omit})
161
165
  ```
162
166
  """
163
167
 
@@ -165,6 +169,9 @@ class Omit:
165
169
  return False
166
170
 
167
171
 
172
+ omit = Omit()
173
+
174
+
168
175
  @runtime_checkable
169
176
  class ModelBuilderProtocol(Protocol):
170
177
  @classmethod
@@ -268,7 +268,7 @@ def _transform_typeddict(
268
268
  annotations = get_type_hints(expected_type, include_extras=True)
269
269
  for key, value in data.items():
270
270
  if not is_given(value):
271
- # we don't need to include `NotGiven` values here as they'll
271
+ # we don't need to include omitted values here as they'll
272
272
  # be stripped out before the request is sent anyway
273
273
  continue
274
274
 
@@ -434,7 +434,7 @@ async def _async_transform_typeddict(
434
434
  annotations = get_type_hints(expected_type, include_extras=True)
435
435
  for key, value in data.items():
436
436
  if not is_given(value):
437
- # we don't need to include `NotGiven` values here as they'll
437
+ # we don't need to include omitted values here as they'll
438
438
  # be stripped out before the request is sent anyway
439
439
  continue
440
440
 
@@ -21,7 +21,7 @@ from typing_extensions import TypeGuard
21
21
 
22
22
  import sniffio
23
23
 
24
- from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike
24
+ from .._types import Omit, NotGiven, FileTypes, HeadersLike
25
25
 
26
26
  _T = TypeVar("_T")
27
27
  _TupleT = TypeVar("_TupleT", bound=Tuple[object, ...])
@@ -63,7 +63,7 @@ def _extract_items(
63
63
  try:
64
64
  key = path[index]
65
65
  except IndexError:
66
- if isinstance(obj, NotGiven):
66
+ if not is_given(obj):
67
67
  # no value was provided - we can safely ignore
68
68
  return []
69
69
 
@@ -126,8 +126,8 @@ def _extract_items(
126
126
  return []
127
127
 
128
128
 
129
- def is_given(obj: NotGivenOr[_T]) -> TypeGuard[_T]:
130
- return not isinstance(obj, NotGiven)
129
+ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]:
130
+ return not isinstance(obj, NotGiven) and not isinstance(obj, Omit)
131
131
 
132
132
 
133
133
  # Type safe methods for narrowing types with TypeVars.
perplexity/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "perplexity"
4
- __version__ = "0.10.0" # x-release-please-version
4
+ __version__ = "0.12.0" # x-release-please-version
@@ -27,7 +27,7 @@ class AsyncResource(SyncAPIResource):
27
27
  This property can be used as a prefix for any HTTP method call to return
28
28
  the raw response object instead of the parsed content.
29
29
 
30
- For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
30
+ For more information, see https://www.github.com/perplexityai/perplexity-py#accessing-raw-response-data-eg-headers
31
31
  """
32
32
  return AsyncResourceWithRawResponse(self)
33
33
 
@@ -36,7 +36,7 @@ class AsyncResource(SyncAPIResource):
36
36
  """
37
37
  An alternative to `.with_raw_response` that doesn't eagerly read the response body.
38
38
 
39
- For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
39
+ For more information, see https://www.github.com/perplexityai/perplexity-py#with_streaming_response
40
40
  """
41
41
  return AsyncResourceWithStreamingResponse(self)
42
42
 
@@ -52,7 +52,7 @@ class AsyncAsyncResource(AsyncAPIResource):
52
52
  This property can be used as a prefix for any HTTP method call to return
53
53
  the raw response object instead of the parsed content.
54
54
 
55
- For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
55
+ For more information, see https://www.github.com/perplexityai/perplexity-py#accessing-raw-response-data-eg-headers
56
56
  """
57
57
  return AsyncAsyncResourceWithRawResponse(self)
58
58
 
@@ -61,7 +61,7 @@ class AsyncAsyncResource(AsyncAPIResource):
61
61
  """
62
62
  An alternative to `.with_raw_response` that doesn't eagerly read the response body.
63
63
 
64
- For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
64
+ For more information, see https://www.github.com/perplexityai/perplexity-py#with_streaming_response
65
65
  """
66
66
  return AsyncAsyncResourceWithStreamingResponse(self)
67
67
 
@@ -27,7 +27,7 @@ class ChatResource(SyncAPIResource):
27
27
  This property can be used as a prefix for any HTTP method call to return
28
28
  the raw response object instead of the parsed content.
29
29
 
30
- For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
30
+ For more information, see https://www.github.com/perplexityai/perplexity-py#accessing-raw-response-data-eg-headers
31
31
  """
32
32
  return ChatResourceWithRawResponse(self)
33
33
 
@@ -36,7 +36,7 @@ class ChatResource(SyncAPIResource):
36
36
  """
37
37
  An alternative to `.with_raw_response` that doesn't eagerly read the response body.
38
38
 
39
- For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
39
+ For more information, see https://www.github.com/perplexityai/perplexity-py#with_streaming_response
40
40
  """
41
41
  return ChatResourceWithStreamingResponse(self)
42
42
 
@@ -52,7 +52,7 @@ class AsyncChatResource(AsyncAPIResource):
52
52
  This property can be used as a prefix for any HTTP method call to return
53
53
  the raw response object instead of the parsed content.
54
54
 
55
- For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
55
+ For more information, see https://www.github.com/perplexityai/perplexity-py#accessing-raw-response-data-eg-headers
56
56
  """
57
57
  return AsyncChatResourceWithRawResponse(self)
58
58
 
@@ -61,7 +61,7 @@ class AsyncChatResource(AsyncAPIResource):
61
61
  """
62
62
  An alternative to `.with_raw_response` that doesn't eagerly read the response body.
63
63
 
64
- For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
64
+ For more information, see https://www.github.com/perplexityai/perplexity-py#with_streaming_response
65
65
  """
66
66
  return AsyncChatResourceWithStreamingResponse(self)
67
67
 
@@ -6,7 +6,7 @@ from typing import Optional
6
6
 
7
7
  import httpx
8
8
 
9
- from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
9
+ from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
10
10
  from ...._utils import maybe_transform, strip_not_given, async_maybe_transform
11
11
  from ...._compat import cached_property
12
12
  from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -32,7 +32,7 @@ class CompletionsResource(SyncAPIResource):
32
32
  This property can be used as a prefix for any HTTP method call to return
33
33
  the raw response object instead of the parsed content.
34
34
 
35
- For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
35
+ For more information, see https://www.github.com/perplexityai/perplexity-py#accessing-raw-response-data-eg-headers
36
36
  """
37
37
  return CompletionsResourceWithRawResponse(self)
38
38
 
@@ -41,7 +41,7 @@ class CompletionsResource(SyncAPIResource):
41
41
  """
42
42
  An alternative to `.with_raw_response` that doesn't eagerly read the response body.
43
43
 
44
- For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
44
+ For more information, see https://www.github.com/perplexityai/perplexity-py#with_streaming_response
45
45
  """
46
46
  return CompletionsResourceWithStreamingResponse(self)
47
47
 
@@ -49,13 +49,13 @@ class CompletionsResource(SyncAPIResource):
49
49
  self,
50
50
  *,
51
51
  request: completion_create_params.Request,
52
- idempotency_key: Optional[str] | NotGiven = NOT_GIVEN,
52
+ idempotency_key: Optional[str] | Omit = omit,
53
53
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
54
54
  # The extra values given here take precedence over values defined on the client or passed to this method.
55
55
  extra_headers: Headers | None = None,
56
56
  extra_query: Query | None = None,
57
57
  extra_body: Body | None = None,
58
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
58
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
59
59
  ) -> CompletionCreateResponse:
60
60
  """
61
61
  FastAPI wrapper around async chat completions
@@ -95,7 +95,7 @@ class CompletionsResource(SyncAPIResource):
95
95
  extra_headers: Headers | None = None,
96
96
  extra_query: Query | None = None,
97
97
  extra_body: Body | None = None,
98
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
98
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
99
99
  ) -> CompletionListResponse:
100
100
  """list all async chat completion requests for a given user."""
101
101
  return self._get(
@@ -110,18 +110,18 @@ class CompletionsResource(SyncAPIResource):
110
110
  self,
111
111
  api_request: str,
112
112
  *,
113
- local_mode: bool | NotGiven = NOT_GIVEN,
114
- x_client_env: str | NotGiven = NOT_GIVEN,
115
- x_client_name: str | NotGiven = NOT_GIVEN,
116
- x_request_time: str | NotGiven = NOT_GIVEN,
117
- x_usage_tier: str | NotGiven = NOT_GIVEN,
118
- x_user_id: str | NotGiven = NOT_GIVEN,
113
+ local_mode: bool | Omit = omit,
114
+ x_client_env: str | Omit = omit,
115
+ x_client_name: str | Omit = omit,
116
+ x_request_time: str | Omit = omit,
117
+ x_usage_tier: str | Omit = omit,
118
+ x_user_id: str | Omit = omit,
119
119
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
120
120
  # The extra values given here take precedence over values defined on the client or passed to this method.
121
121
  extra_headers: Headers | None = None,
122
122
  extra_query: Query | None = None,
123
123
  extra_body: Body | None = None,
124
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
124
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
125
125
  ) -> CompletionGetResponse:
126
126
  """
127
127
  get the response for a given async chat completion request.
@@ -169,7 +169,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
169
169
  This property can be used as a prefix for any HTTP method call to return
170
170
  the raw response object instead of the parsed content.
171
171
 
172
- For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
172
+ For more information, see https://www.github.com/perplexityai/perplexity-py#accessing-raw-response-data-eg-headers
173
173
  """
174
174
  return AsyncCompletionsResourceWithRawResponse(self)
175
175
 
@@ -178,7 +178,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
178
178
  """
179
179
  An alternative to `.with_raw_response` that doesn't eagerly read the response body.
180
180
 
181
- For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
181
+ For more information, see https://www.github.com/perplexityai/perplexity-py#with_streaming_response
182
182
  """
183
183
  return AsyncCompletionsResourceWithStreamingResponse(self)
184
184
 
@@ -186,13 +186,13 @@ class AsyncCompletionsResource(AsyncAPIResource):
186
186
  self,
187
187
  *,
188
188
  request: completion_create_params.Request,
189
- idempotency_key: Optional[str] | NotGiven = NOT_GIVEN,
189
+ idempotency_key: Optional[str] | Omit = omit,
190
190
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
191
191
  # The extra values given here take precedence over values defined on the client or passed to this method.
192
192
  extra_headers: Headers | None = None,
193
193
  extra_query: Query | None = None,
194
194
  extra_body: Body | None = None,
195
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
195
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
196
196
  ) -> CompletionCreateResponse:
197
197
  """
198
198
  FastAPI wrapper around async chat completions
@@ -232,7 +232,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
232
232
  extra_headers: Headers | None = None,
233
233
  extra_query: Query | None = None,
234
234
  extra_body: Body | None = None,
235
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
235
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
236
236
  ) -> CompletionListResponse:
237
237
  """list all async chat completion requests for a given user."""
238
238
  return await self._get(
@@ -247,18 +247,18 @@ class AsyncCompletionsResource(AsyncAPIResource):
247
247
  self,
248
248
  api_request: str,
249
249
  *,
250
- local_mode: bool | NotGiven = NOT_GIVEN,
251
- x_client_env: str | NotGiven = NOT_GIVEN,
252
- x_client_name: str | NotGiven = NOT_GIVEN,
253
- x_request_time: str | NotGiven = NOT_GIVEN,
254
- x_usage_tier: str | NotGiven = NOT_GIVEN,
255
- x_user_id: str | NotGiven = NOT_GIVEN,
250
+ local_mode: bool | Omit = omit,
251
+ x_client_env: str | Omit = omit,
252
+ x_client_name: str | Omit = omit,
253
+ x_request_time: str | Omit = omit,
254
+ x_usage_tier: str | Omit = omit,
255
+ x_user_id: str | Omit = omit,
256
256
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
257
257
  # The extra values given here take precedence over values defined on the client or passed to this method.
258
258
  extra_headers: Headers | None = None,
259
259
  extra_query: Query | None = None,
260
260
  extra_body: Body | None = None,
261
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
261
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
262
262
  ) -> CompletionGetResponse:
263
263
  """
264
264
  get the response for a given async chat completion request.
@@ -27,7 +27,7 @@ class ChatResource(SyncAPIResource):
27
27
  This property can be used as a prefix for any HTTP method call to return
28
28
  the raw response object instead of the parsed content.
29
29
 
30
- For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
30
+ For more information, see https://www.github.com/perplexityai/perplexity-py#accessing-raw-response-data-eg-headers
31
31
  """
32
32
  return ChatResourceWithRawResponse(self)
33
33
 
@@ -36,7 +36,7 @@ class ChatResource(SyncAPIResource):
36
36
  """
37
37
  An alternative to `.with_raw_response` that doesn't eagerly read the response body.
38
38
 
39
- For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
39
+ For more information, see https://www.github.com/perplexityai/perplexity-py#with_streaming_response
40
40
  """
41
41
  return ChatResourceWithStreamingResponse(self)
42
42
 
@@ -52,7 +52,7 @@ class AsyncChatResource(AsyncAPIResource):
52
52
  This property can be used as a prefix for any HTTP method call to return
53
53
  the raw response object instead of the parsed content.
54
54
 
55
- For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
55
+ For more information, see https://www.github.com/perplexityai/perplexity-py#accessing-raw-response-data-eg-headers
56
56
  """
57
57
  return AsyncChatResourceWithRawResponse(self)
58
58
 
@@ -61,7 +61,7 @@ class AsyncChatResource(AsyncAPIResource):
61
61
  """
62
62
  An alternative to `.with_raw_response` that doesn't eagerly read the response body.
63
63
 
64
- For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
64
+ For more information, see https://www.github.com/perplexityai/perplexity-py#with_streaming_response
65
65
  """
66
66
  return AsyncChatResourceWithStreamingResponse(self)
67
67
 
@@ -7,7 +7,7 @@ from typing_extensions import Literal
7
7
 
8
8
  import httpx
9
9
 
10
- from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
10
+ from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
11
11
  from ..._utils import maybe_transform, async_maybe_transform
12
12
  from ..._compat import cached_property
13
13
  from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -32,7 +32,7 @@ class CompletionsResource(SyncAPIResource):
32
32
  This property can be used as a prefix for any HTTP method call to return
33
33
  the raw response object instead of the parsed content.
34
34
 
35
- For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
35
+ For more information, see https://www.github.com/perplexityai/perplexity-py#accessing-raw-response-data-eg-headers
36
36
  """
37
37
  return CompletionsResourceWithRawResponse(self)
38
38
 
@@ -41,7 +41,7 @@ class CompletionsResource(SyncAPIResource):
41
41
  """
42
42
  An alternative to `.with_raw_response` that doesn't eagerly read the response body.
43
43
 
44
- For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
44
+ For more information, see https://www.github.com/perplexityai/perplexity-py#with_streaming_response
45
45
  """
46
46
  return CompletionsResourceWithStreamingResponse(self)
47
47
 
@@ -50,64 +50,64 @@ class CompletionsResource(SyncAPIResource):
50
50
  *,
51
51
  messages: Iterable[ChatMessageInput],
52
52
  model: str,
53
- _debug_pro_search: bool | NotGiven = NOT_GIVEN,
54
- _inputs: Optional[Iterable[int]] | NotGiven = NOT_GIVEN,
55
- _is_browser_agent: Optional[bool] | NotGiven = NOT_GIVEN,
56
- _prompt_token_length: Optional[int] | NotGiven = NOT_GIVEN,
57
- best_of: Optional[int] | NotGiven = NOT_GIVEN,
58
- country: Optional[str] | NotGiven = NOT_GIVEN,
59
- cum_logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
60
- debug_params: Optional[completion_create_params.DebugParams] | NotGiven = NOT_GIVEN,
61
- disable_search: Optional[bool] | NotGiven = NOT_GIVEN,
62
- diverse_first_token: Optional[bool] | NotGiven = NOT_GIVEN,
63
- enable_search_classifier: Optional[bool] | NotGiven = NOT_GIVEN,
64
- file_workspace_id: Optional[str] | NotGiven = NOT_GIVEN,
65
- frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
66
- has_image_url: bool | NotGiven = NOT_GIVEN,
67
- image_domain_filter: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
68
- image_format_filter: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
69
- last_updated_after_filter: Optional[str] | NotGiven = NOT_GIVEN,
70
- last_updated_before_filter: Optional[str] | NotGiven = NOT_GIVEN,
71
- latitude: Optional[float] | NotGiven = NOT_GIVEN,
72
- logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
73
- longitude: Optional[float] | NotGiven = NOT_GIVEN,
74
- max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
75
- n: Optional[int] | NotGiven = NOT_GIVEN,
76
- num_images: int | NotGiven = NOT_GIVEN,
77
- num_search_results: int | NotGiven = NOT_GIVEN,
78
- parallel_tool_calls: Optional[bool] | NotGiven = NOT_GIVEN,
79
- presence_penalty: Optional[float] | NotGiven = NOT_GIVEN,
80
- ranking_model: Optional[str] | NotGiven = NOT_GIVEN,
81
- reasoning_effort: Optional[Literal["minimal", "low", "medium", "high"]] | NotGiven = NOT_GIVEN,
82
- response_format: Optional[completion_create_params.ResponseFormat] | NotGiven = NOT_GIVEN,
83
- response_metadata: Optional[Dict[str, object]] | NotGiven = NOT_GIVEN,
84
- return_images: Optional[bool] | NotGiven = NOT_GIVEN,
85
- return_related_questions: Optional[bool] | NotGiven = NOT_GIVEN,
86
- safe_search: Optional[bool] | NotGiven = NOT_GIVEN,
87
- search_after_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
88
- search_before_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
89
- search_domain_filter: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
90
- search_internal_properties: Optional[Dict[str, object]] | NotGiven = NOT_GIVEN,
91
- search_mode: Optional[Literal["web", "academic", "sec"]] | NotGiven = NOT_GIVEN,
92
- search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]] | NotGiven = NOT_GIVEN,
93
- search_tenant: Optional[str] | NotGiven = NOT_GIVEN,
94
- stop: Union[str, SequenceNotStr[str], None] | NotGiven = NOT_GIVEN,
95
- stream: Optional[bool] | NotGiven = NOT_GIVEN,
96
- temperature: Optional[float] | NotGiven = NOT_GIVEN,
97
- tool_choice: Optional[Literal["none", "auto", "required"]] | NotGiven = NOT_GIVEN,
98
- tools: Optional[Iterable[completion_create_params.Tool]] | NotGiven = NOT_GIVEN,
99
- top_k: Optional[int] | NotGiven = NOT_GIVEN,
100
- top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
101
- top_p: Optional[float] | NotGiven = NOT_GIVEN,
102
- updated_after_timestamp: Optional[int] | NotGiven = NOT_GIVEN,
103
- updated_before_timestamp: Optional[int] | NotGiven = NOT_GIVEN,
104
- web_search_options: completion_create_params.WebSearchOptions | NotGiven = NOT_GIVEN,
53
+ _debug_pro_search: bool | Omit = omit,
54
+ _inputs: Optional[Iterable[int]] | Omit = omit,
55
+ _is_browser_agent: Optional[bool] | Omit = omit,
56
+ _prompt_token_length: Optional[int] | Omit = omit,
57
+ best_of: Optional[int] | Omit = omit,
58
+ country: Optional[str] | Omit = omit,
59
+ cum_logprobs: Optional[bool] | Omit = omit,
60
+ debug_params: Optional[completion_create_params.DebugParams] | Omit = omit,
61
+ disable_search: Optional[bool] | Omit = omit,
62
+ diverse_first_token: Optional[bool] | Omit = omit,
63
+ enable_search_classifier: Optional[bool] | Omit = omit,
64
+ file_workspace_id: Optional[str] | Omit = omit,
65
+ frequency_penalty: Optional[float] | Omit = omit,
66
+ has_image_url: bool | Omit = omit,
67
+ image_domain_filter: Optional[SequenceNotStr[str]] | Omit = omit,
68
+ image_format_filter: Optional[SequenceNotStr[str]] | Omit = omit,
69
+ last_updated_after_filter: Optional[str] | Omit = omit,
70
+ last_updated_before_filter: Optional[str] | Omit = omit,
71
+ latitude: Optional[float] | Omit = omit,
72
+ logprobs: Optional[bool] | Omit = omit,
73
+ longitude: Optional[float] | Omit = omit,
74
+ max_tokens: Optional[int] | Omit = omit,
75
+ n: Optional[int] | Omit = omit,
76
+ num_images: int | Omit = omit,
77
+ num_search_results: int | Omit = omit,
78
+ parallel_tool_calls: Optional[bool] | Omit = omit,
79
+ presence_penalty: Optional[float] | Omit = omit,
80
+ ranking_model: Optional[str] | Omit = omit,
81
+ reasoning_effort: Optional[Literal["minimal", "low", "medium", "high"]] | Omit = omit,
82
+ response_format: Optional[completion_create_params.ResponseFormat] | Omit = omit,
83
+ response_metadata: Optional[Dict[str, object]] | Omit = omit,
84
+ return_images: Optional[bool] | Omit = omit,
85
+ return_related_questions: Optional[bool] | Omit = omit,
86
+ safe_search: Optional[bool] | Omit = omit,
87
+ search_after_date_filter: Optional[str] | Omit = omit,
88
+ search_before_date_filter: Optional[str] | Omit = omit,
89
+ search_domain_filter: Optional[SequenceNotStr[str]] | Omit = omit,
90
+ search_internal_properties: Optional[Dict[str, object]] | Omit = omit,
91
+ search_mode: Optional[Literal["web", "academic", "sec"]] | Omit = omit,
92
+ search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]] | Omit = omit,
93
+ search_tenant: Optional[str] | Omit = omit,
94
+ stop: Union[str, SequenceNotStr[str], None] | Omit = omit,
95
+ stream: Optional[bool] | Omit = omit,
96
+ temperature: Optional[float] | Omit = omit,
97
+ tool_choice: Optional[Literal["none", "auto", "required"]] | Omit = omit,
98
+ tools: Optional[Iterable[completion_create_params.Tool]] | Omit = omit,
99
+ top_k: Optional[int] | Omit = omit,
100
+ top_logprobs: Optional[int] | Omit = omit,
101
+ top_p: Optional[float] | Omit = omit,
102
+ updated_after_timestamp: Optional[int] | Omit = omit,
103
+ updated_before_timestamp: Optional[int] | Omit = omit,
104
+ web_search_options: completion_create_params.WebSearchOptions | Omit = omit,
105
105
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
106
106
  # The extra values given here take precedence over values defined on the client or passed to this method.
107
107
  extra_headers: Headers | None = None,
108
108
  extra_query: Query | None = None,
109
109
  extra_body: Body | None = None,
110
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
110
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
111
111
  ) -> CompletionCreateResponse:
112
112
  """
113
113
  FastAPI wrapper around chat completions
@@ -196,7 +196,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
196
196
  This property can be used as a prefix for any HTTP method call to return
197
197
  the raw response object instead of the parsed content.
198
198
 
199
- For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
199
+ For more information, see https://www.github.com/perplexityai/perplexity-py#accessing-raw-response-data-eg-headers
200
200
  """
201
201
  return AsyncCompletionsResourceWithRawResponse(self)
202
202
 
@@ -205,7 +205,7 @@ class AsyncCompletionsResource(AsyncAPIResource):
205
205
  """
206
206
  An alternative to `.with_raw_response` that doesn't eagerly read the response body.
207
207
 
208
- For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
208
+ For more information, see https://www.github.com/perplexityai/perplexity-py#with_streaming_response
209
209
  """
210
210
  return AsyncCompletionsResourceWithStreamingResponse(self)
211
211
 
@@ -214,64 +214,64 @@ class AsyncCompletionsResource(AsyncAPIResource):
214
214
  *,
215
215
  messages: Iterable[ChatMessageInput],
216
216
  model: str,
217
- _debug_pro_search: bool | NotGiven = NOT_GIVEN,
218
- _inputs: Optional[Iterable[int]] | NotGiven = NOT_GIVEN,
219
- _is_browser_agent: Optional[bool] | NotGiven = NOT_GIVEN,
220
- _prompt_token_length: Optional[int] | NotGiven = NOT_GIVEN,
221
- best_of: Optional[int] | NotGiven = NOT_GIVEN,
222
- country: Optional[str] | NotGiven = NOT_GIVEN,
223
- cum_logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
224
- debug_params: Optional[completion_create_params.DebugParams] | NotGiven = NOT_GIVEN,
225
- disable_search: Optional[bool] | NotGiven = NOT_GIVEN,
226
- diverse_first_token: Optional[bool] | NotGiven = NOT_GIVEN,
227
- enable_search_classifier: Optional[bool] | NotGiven = NOT_GIVEN,
228
- file_workspace_id: Optional[str] | NotGiven = NOT_GIVEN,
229
- frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
230
- has_image_url: bool | NotGiven = NOT_GIVEN,
231
- image_domain_filter: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
232
- image_format_filter: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
233
- last_updated_after_filter: Optional[str] | NotGiven = NOT_GIVEN,
234
- last_updated_before_filter: Optional[str] | NotGiven = NOT_GIVEN,
235
- latitude: Optional[float] | NotGiven = NOT_GIVEN,
236
- logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
237
- longitude: Optional[float] | NotGiven = NOT_GIVEN,
238
- max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
239
- n: Optional[int] | NotGiven = NOT_GIVEN,
240
- num_images: int | NotGiven = NOT_GIVEN,
241
- num_search_results: int | NotGiven = NOT_GIVEN,
242
- parallel_tool_calls: Optional[bool] | NotGiven = NOT_GIVEN,
243
- presence_penalty: Optional[float] | NotGiven = NOT_GIVEN,
244
- ranking_model: Optional[str] | NotGiven = NOT_GIVEN,
245
- reasoning_effort: Optional[Literal["minimal", "low", "medium", "high"]] | NotGiven = NOT_GIVEN,
246
- response_format: Optional[completion_create_params.ResponseFormat] | NotGiven = NOT_GIVEN,
247
- response_metadata: Optional[Dict[str, object]] | NotGiven = NOT_GIVEN,
248
- return_images: Optional[bool] | NotGiven = NOT_GIVEN,
249
- return_related_questions: Optional[bool] | NotGiven = NOT_GIVEN,
250
- safe_search: Optional[bool] | NotGiven = NOT_GIVEN,
251
- search_after_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
252
- search_before_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
253
- search_domain_filter: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
254
- search_internal_properties: Optional[Dict[str, object]] | NotGiven = NOT_GIVEN,
255
- search_mode: Optional[Literal["web", "academic", "sec"]] | NotGiven = NOT_GIVEN,
256
- search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]] | NotGiven = NOT_GIVEN,
257
- search_tenant: Optional[str] | NotGiven = NOT_GIVEN,
258
- stop: Union[str, SequenceNotStr[str], None] | NotGiven = NOT_GIVEN,
259
- stream: Optional[bool] | NotGiven = NOT_GIVEN,
260
- temperature: Optional[float] | NotGiven = NOT_GIVEN,
261
- tool_choice: Optional[Literal["none", "auto", "required"]] | NotGiven = NOT_GIVEN,
262
- tools: Optional[Iterable[completion_create_params.Tool]] | NotGiven = NOT_GIVEN,
263
- top_k: Optional[int] | NotGiven = NOT_GIVEN,
264
- top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
265
- top_p: Optional[float] | NotGiven = NOT_GIVEN,
266
- updated_after_timestamp: Optional[int] | NotGiven = NOT_GIVEN,
267
- updated_before_timestamp: Optional[int] | NotGiven = NOT_GIVEN,
268
- web_search_options: completion_create_params.WebSearchOptions | NotGiven = NOT_GIVEN,
217
+ _debug_pro_search: bool | Omit = omit,
218
+ _inputs: Optional[Iterable[int]] | Omit = omit,
219
+ _is_browser_agent: Optional[bool] | Omit = omit,
220
+ _prompt_token_length: Optional[int] | Omit = omit,
221
+ best_of: Optional[int] | Omit = omit,
222
+ country: Optional[str] | Omit = omit,
223
+ cum_logprobs: Optional[bool] | Omit = omit,
224
+ debug_params: Optional[completion_create_params.DebugParams] | Omit = omit,
225
+ disable_search: Optional[bool] | Omit = omit,
226
+ diverse_first_token: Optional[bool] | Omit = omit,
227
+ enable_search_classifier: Optional[bool] | Omit = omit,
228
+ file_workspace_id: Optional[str] | Omit = omit,
229
+ frequency_penalty: Optional[float] | Omit = omit,
230
+ has_image_url: bool | Omit = omit,
231
+ image_domain_filter: Optional[SequenceNotStr[str]] | Omit = omit,
232
+ image_format_filter: Optional[SequenceNotStr[str]] | Omit = omit,
233
+ last_updated_after_filter: Optional[str] | Omit = omit,
234
+ last_updated_before_filter: Optional[str] | Omit = omit,
235
+ latitude: Optional[float] | Omit = omit,
236
+ logprobs: Optional[bool] | Omit = omit,
237
+ longitude: Optional[float] | Omit = omit,
238
+ max_tokens: Optional[int] | Omit = omit,
239
+ n: Optional[int] | Omit = omit,
240
+ num_images: int | Omit = omit,
241
+ num_search_results: int | Omit = omit,
242
+ parallel_tool_calls: Optional[bool] | Omit = omit,
243
+ presence_penalty: Optional[float] | Omit = omit,
244
+ ranking_model: Optional[str] | Omit = omit,
245
+ reasoning_effort: Optional[Literal["minimal", "low", "medium", "high"]] | Omit = omit,
246
+ response_format: Optional[completion_create_params.ResponseFormat] | Omit = omit,
247
+ response_metadata: Optional[Dict[str, object]] | Omit = omit,
248
+ return_images: Optional[bool] | Omit = omit,
249
+ return_related_questions: Optional[bool] | Omit = omit,
250
+ safe_search: Optional[bool] | Omit = omit,
251
+ search_after_date_filter: Optional[str] | Omit = omit,
252
+ search_before_date_filter: Optional[str] | Omit = omit,
253
+ search_domain_filter: Optional[SequenceNotStr[str]] | Omit = omit,
254
+ search_internal_properties: Optional[Dict[str, object]] | Omit = omit,
255
+ search_mode: Optional[Literal["web", "academic", "sec"]] | Omit = omit,
256
+ search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]] | Omit = omit,
257
+ search_tenant: Optional[str] | Omit = omit,
258
+ stop: Union[str, SequenceNotStr[str], None] | Omit = omit,
259
+ stream: Optional[bool] | Omit = omit,
260
+ temperature: Optional[float] | Omit = omit,
261
+ tool_choice: Optional[Literal["none", "auto", "required"]] | Omit = omit,
262
+ tools: Optional[Iterable[completion_create_params.Tool]] | Omit = omit,
263
+ top_k: Optional[int] | Omit = omit,
264
+ top_logprobs: Optional[int] | Omit = omit,
265
+ top_p: Optional[float] | Omit = omit,
266
+ updated_after_timestamp: Optional[int] | Omit = omit,
267
+ updated_before_timestamp: Optional[int] | Omit = omit,
268
+ web_search_options: completion_create_params.WebSearchOptions | Omit = omit,
269
269
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
270
270
  # The extra values given here take precedence over values defined on the client or passed to this method.
271
271
  extra_headers: Headers | None = None,
272
272
  extra_query: Query | None = None,
273
273
  extra_body: Body | None = None,
274
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
274
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
275
275
  ) -> CompletionCreateResponse:
276
276
  """
277
277
  FastAPI wrapper around chat completions
@@ -8,7 +8,7 @@ from typing_extensions import Literal
8
8
  import httpx
9
9
 
10
10
  from ..types import search_create_params
11
- from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
11
+ from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
12
12
  from .._utils import maybe_transform, async_maybe_transform
13
13
  from .._compat import cached_property
14
14
  from .._resource import SyncAPIResource, AsyncAPIResource
@@ -31,7 +31,7 @@ class SearchResource(SyncAPIResource):
31
31
  This property can be used as a prefix for any HTTP method call to return
32
32
  the raw response object instead of the parsed content.
33
33
 
34
- For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
34
+ For more information, see https://www.github.com/perplexityai/perplexity-py#accessing-raw-response-data-eg-headers
35
35
  """
36
36
  return SearchResourceWithRawResponse(self)
37
37
 
@@ -40,7 +40,7 @@ class SearchResource(SyncAPIResource):
40
40
  """
41
41
  An alternative to `.with_raw_response` that doesn't eagerly read the response body.
42
42
 
43
- For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
43
+ For more information, see https://www.github.com/perplexityai/perplexity-py#with_streaming_response
44
44
  """
45
45
  return SearchResourceWithStreamingResponse(self)
46
46
 
@@ -48,16 +48,17 @@ class SearchResource(SyncAPIResource):
48
48
  self,
49
49
  *,
50
50
  query: Union[str, SequenceNotStr[str]],
51
- max_results: int | NotGiven = NOT_GIVEN,
52
- max_tokens: int | NotGiven = NOT_GIVEN,
53
- max_tokens_per_page: int | NotGiven = NOT_GIVEN,
54
- search_mode: Optional[Literal["web", "academic", "sec"]] | NotGiven = NOT_GIVEN,
51
+ country: Optional[str] | Omit = omit,
52
+ max_results: int | Omit = omit,
53
+ max_tokens: int | Omit = omit,
54
+ max_tokens_per_page: int | Omit = omit,
55
+ search_mode: Optional[Literal["web", "academic", "sec"]] | Omit = omit,
55
56
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
56
57
  # The extra values given here take precedence over values defined on the client or passed to this method.
57
58
  extra_headers: Headers | None = None,
58
59
  extra_query: Query | None = None,
59
60
  extra_body: Body | None = None,
60
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
61
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
61
62
  ) -> SearchCreateResponse:
62
63
  """
63
64
  Search
@@ -76,6 +77,7 @@ class SearchResource(SyncAPIResource):
76
77
  body=maybe_transform(
77
78
  {
78
79
  "query": query,
80
+ "country": country,
79
81
  "max_results": max_results,
80
82
  "max_tokens": max_tokens,
81
83
  "max_tokens_per_page": max_tokens_per_page,
@@ -97,7 +99,7 @@ class AsyncSearchResource(AsyncAPIResource):
97
99
  This property can be used as a prefix for any HTTP method call to return
98
100
  the raw response object instead of the parsed content.
99
101
 
100
- For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
102
+ For more information, see https://www.github.com/perplexityai/perplexity-py#accessing-raw-response-data-eg-headers
101
103
  """
102
104
  return AsyncSearchResourceWithRawResponse(self)
103
105
 
@@ -106,7 +108,7 @@ class AsyncSearchResource(AsyncAPIResource):
106
108
  """
107
109
  An alternative to `.with_raw_response` that doesn't eagerly read the response body.
108
110
 
109
- For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
111
+ For more information, see https://www.github.com/perplexityai/perplexity-py#with_streaming_response
110
112
  """
111
113
  return AsyncSearchResourceWithStreamingResponse(self)
112
114
 
@@ -114,16 +116,17 @@ class AsyncSearchResource(AsyncAPIResource):
114
116
  self,
115
117
  *,
116
118
  query: Union[str, SequenceNotStr[str]],
117
- max_results: int | NotGiven = NOT_GIVEN,
118
- max_tokens: int | NotGiven = NOT_GIVEN,
119
- max_tokens_per_page: int | NotGiven = NOT_GIVEN,
120
- search_mode: Optional[Literal["web", "academic", "sec"]] | NotGiven = NOT_GIVEN,
119
+ country: Optional[str] | Omit = omit,
120
+ max_results: int | Omit = omit,
121
+ max_tokens: int | Omit = omit,
122
+ max_tokens_per_page: int | Omit = omit,
123
+ search_mode: Optional[Literal["web", "academic", "sec"]] | Omit = omit,
121
124
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
122
125
  # The extra values given here take precedence over values defined on the client or passed to this method.
123
126
  extra_headers: Headers | None = None,
124
127
  extra_query: Query | None = None,
125
128
  extra_body: Body | None = None,
126
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
129
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
127
130
  ) -> SearchCreateResponse:
128
131
  """
129
132
  Search
@@ -142,6 +145,7 @@ class AsyncSearchResource(AsyncAPIResource):
142
145
  body=await async_maybe_transform(
143
146
  {
144
147
  "query": query,
148
+ "country": country,
145
149
  "max_results": max_results,
146
150
  "max_tokens": max_tokens,
147
151
  "max_tokens_per_page": max_tokens_per_page,
@@ -13,6 +13,8 @@ __all__ = ["SearchCreateParams"]
13
13
  class SearchCreateParams(TypedDict, total=False):
14
14
  query: Required[Union[str, SequenceNotStr[str]]]
15
15
 
16
+ country: Optional[str]
17
+
16
18
  max_results: int
17
19
 
18
20
  max_tokens: int
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: perplexityai
3
- Version: 0.10.0
3
+ Version: 0.12.0
4
4
  Summary: The official Python library for the perplexity API
5
- Project-URL: Homepage, https://github.com/ppl-ai/perplexity-py
6
- Project-URL: Repository, https://github.com/ppl-ai/perplexity-py
5
+ Project-URL: Homepage, https://github.com/perplexityai/perplexity-py
6
+ Project-URL: Repository, https://github.com/perplexityai/perplexity-py
7
7
  Author: Perplexity
8
8
  License: Apache-2.0
9
9
  Classifier: Intended Audience :: Developers
@@ -46,7 +46,7 @@ It is generated with [Stainless](https://www.stainless.com/).
46
46
 
47
47
  ## Documentation
48
48
 
49
- The full API of this library can be found in [api.md](https://github.com/ppl-ai/perplexity-py/tree/main/api.md).
49
+ The full API of this library can be found in [api.md](https://github.com/perplexityai/perplexity-py/tree/main/api.md).
50
50
 
51
51
  ## Installation
52
52
 
@@ -96,7 +96,7 @@ for result in content.results:
96
96
 
97
97
  ## Chat Completions
98
98
 
99
- The full API of this library can be found in [api.md](https://github.com/ppl-ai/perplexity-py/tree/main/api.md).
99
+ The full API of this library can be found in [api.md](https://github.com/perplexityai/perplexity-py/tree/main/api.md).
100
100
 
101
101
  ```python
102
102
  import os
@@ -336,7 +336,7 @@ client.with_options(timeout=5.0).chat.completions.create(
336
336
 
337
337
  On timeout, an `APITimeoutError` is thrown.
338
338
 
339
- Note that requests that time out are [retried twice by default](https://github.com/ppl-ai/perplexity-py/tree/main/#retries).
339
+ Note that requests that time out are [retried twice by default](https://github.com/perplexityai/perplexity-py/tree/main/#retries).
340
340
 
341
341
  ## Advanced
342
342
 
@@ -385,9 +385,9 @@ completion = response.parse() # get the object that `chat.completions.create()`
385
385
  print(completion.id)
386
386
  ```
387
387
 
388
- These methods return an [`APIResponse`](https://github.com/ppl-ai/perplexity-py/tree/main/src/perplexity/_response.py) object.
388
+ These methods return an [`APIResponse`](https://github.com/perplexityai/perplexity-py/tree/main/src/perplexity/_response.py) object.
389
389
 
390
- The async client returns an [`AsyncAPIResponse`](https://github.com/ppl-ai/perplexity-py/tree/main/src/perplexity/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
390
+ The async client returns an [`AsyncAPIResponse`](https://github.com/perplexityai/perplexity-py/tree/main/src/perplexity/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
391
391
 
392
392
  #### `.with_streaming_response`
393
393
 
@@ -499,7 +499,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
499
499
 
500
500
  We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
501
501
 
502
- We are keen for your feedback; please open an [issue](https://www.github.com/ppl-ai/perplexity-py/issues) with questions, bugs, or suggestions.
502
+ We are keen for your feedback; please open an [issue](https://www.github.com/perplexityai/perplexity-py/issues) with questions, bugs, or suggestions.
503
503
 
504
504
  ### Determining the installed version
505
505
 
@@ -518,4 +518,4 @@ Python 3.8 or higher.
518
518
 
519
519
  ## Contributing
520
520
 
521
- See [the contributing documentation](https://github.com/ppl-ai/perplexity-py/tree/main/./CONTRIBUTING.md).
521
+ See [the contributing documentation](https://github.com/perplexityai/perplexity-py/tree/main/./CONTRIBUTING.md).
@@ -1,17 +1,17 @@
1
- perplexity/__init__.py,sha256=5epbvK3UiJEgvsBW9Ds6RFB6zObkUxYkA9fIQlgUaXA,2655
2
- perplexity/_base_client.py,sha256=DSeMteXutziRGJA9HqJaoLpG7ktzpU2GPcaIgQT1oZQ,67051
3
- perplexity/_client.py,sha256=ugPHT0ZV5WX9iHSej604Nj3WEIQkm2z2rUiARPbX_UU,16078
1
+ perplexity/__init__.py,sha256=tK4KC0qHjpk-ym2IM9lG56HeBXAHz36gMzb0rmWEa7Y,2701
2
+ perplexity/_base_client.py,sha256=aOipaCx-xU9FMpoqKMCzs6LHxmeGlLUlGiihUUNLGUc,67051
3
+ perplexity/_client.py,sha256=9YI3kl7PYP8tBT2R_rgi9u5OIBkDqDO0IwY-oDLB-QA,16063
4
4
  perplexity/_compat.py,sha256=DQBVORjFb33zch24jzkhM14msvnzY7mmSmgDLaVFUM8,6562
5
5
  perplexity/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
6
6
  perplexity/_exceptions.py,sha256=v-hOXWSDTEtXcn_By7pPml3HjEmG5HXpbE-RK_A6_0Q,3228
7
7
  perplexity/_files.py,sha256=KnEzGi_O756MvKyJ4fOCW_u3JhOeWPQ4RsmDvqihDQU,3545
8
8
  perplexity/_models.py,sha256=lKnskYPONAWDvWo8tmbbVk7HmG7UOsI0Nve0vSMmkRc,30452
9
- perplexity/_qs.py,sha256=AOkSz4rHtK4YI3ZU_kzea-zpwBUgEY8WniGmTPyEimc,4846
9
+ perplexity/_qs.py,sha256=craIKyvPktJ94cvf9zn8j8ekG9dWJzhWv0ob34lIOv4,4828
10
10
  perplexity/_resource.py,sha256=Pgc8KNBsIc1ltJn94uhDcDl0-3n5RLbe3iC2AiiNRnE,1124
11
11
  perplexity/_response.py,sha256=bpqzmVGq6jnivoMkUgt3OI0Rh6xHd6BMcp5PHgSFPb0,28842
12
12
  perplexity/_streaming.py,sha256=SQ61v42gFmNiO57uMFUZMAuDlGE0n_EulkZcPgJXt4U,10116
13
- perplexity/_types.py,sha256=XZYv2_G7oQGhQkjI28-TFIMP_yZZV590TRuKAoLJ3wM,7300
14
- perplexity/_version.py,sha256=wMd_e_2KT2gFMBL3gf_yIjVRS3s3vm2EgP5KIx529P4,163
13
+ perplexity/_types.py,sha256=BPuUCddonHjZ2AeEModCeb-zAYCRRT5XtxneIQhJxAk,7240
14
+ perplexity/_version.py,sha256=_Qos24ldDIwii05zOluYsLPQqaaUym8lHaQWjOY80Q4,163
15
15
  perplexity/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  perplexity/_utils/__init__.py,sha256=7fch0GT9zpNnErbciSpUNa-SjTxxjY6kxHxKMOM4AGs,2305
17
17
  perplexity/_utils/_compat.py,sha256=D8gtAvjJQrDWt9upS0XaG9Rr5l1QhiAx_I_1utT_tt0,1195
@@ -22,22 +22,22 @@ perplexity/_utils/_reflection.py,sha256=ZmGkIgT_PuwedyNBrrKGbxoWtkpytJNU1uU4QHnm
22
22
  perplexity/_utils/_resources_proxy.py,sha256=iMCHPeYmXwSunawEq3fcKGszOF3kL9w1ob-48Xnl04I,609
23
23
  perplexity/_utils/_streams.py,sha256=SMC90diFFecpEg_zgDRVbdR3hSEIgVVij4taD-noMLM,289
24
24
  perplexity/_utils/_sync.py,sha256=TpGLrrhRNWTJtODNE6Fup3_k7zrWm1j2RlirzBwre-0,2862
25
- perplexity/_utils/_transform.py,sha256=i_U4R82RtQJtKKCriwFqmfcWjtwmmsiiF1AEXKQ_OPo,15957
25
+ perplexity/_utils/_transform.py,sha256=NjCzmnfqYrsAikUHQig6N9QfuTVbKipuP3ur9mcNF-E,15951
26
26
  perplexity/_utils/_typing.py,sha256=N_5PPuFNsaygbtA_npZd98SVN1LQQvFTKL6bkWPBZGU,4786
27
- perplexity/_utils/_utils.py,sha256=D2QE7mVPNEJzaB50u8rvDQAUDS5jx7JoeFD7zdj-TeI,12231
27
+ perplexity/_utils/_utils.py,sha256=0dDqauUbVZEXV0NVl7Bwu904Wwo5eyFCZpQThhFNhyA,12253
28
28
  perplexity/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
29
29
  perplexity/resources/__init__.py,sha256=Tb4UViVZDl2k8DgP1lKfn08Qaqz1uiezsogWRW9YTfQ,1414
30
- perplexity/resources/search.py,sha256=YQzdtA6ZsD9DPI4PXVkxSh1HlampxiI-epd9O7dNrGo,7010
30
+ perplexity/resources/search.py,sha256=M72I8ZPJ_KxGwgn7FDm3kdvvRqeiFgps_Bce-AdGm8E,7146
31
31
  perplexity/resources/async_/__init__.py,sha256=hvcoEKx4nCYPDoBSO_sk-uNVQ7y-fmNhzvAlvX19TIo,964
32
- perplexity/resources/async_/async_.py,sha256=p1-C_8m2cdS0NR3oa7FfdM8gxHH13LQWX6c9lh1gnFo,3510
32
+ perplexity/resources/async_/async_.py,sha256=XzvC3AMbXXQ9mqe9TI10ZSmEuXaWPRwNC4E7AjvNdg0,3534
33
33
  perplexity/resources/async_/chat/__init__.py,sha256=BVAfz9TM3DT5W9f_mt0P9YRxL_MsUxKCWAH6u1iogmA,1041
34
- perplexity/resources/async_/chat/chat.py,sha256=wOHHfLclvjAVv-btASi6EcdY5gJZQdwAdbR9Q9H4BKw,3658
35
- perplexity/resources/async_/chat/completions.py,sha256=VGYNp5B-WSLgGRHlNJ1V4qkH-6s_pTZbw0ENGtFK9W0,14097
34
+ perplexity/resources/async_/chat/chat.py,sha256=M3hN3sfZKAt1C8FhOaWtxFPJAmPyE-GXkiU_LSN9EiA,3682
35
+ perplexity/resources/async_/chat/completions.py,sha256=xAhxfRXduWZy3JdCSLX7eTStd_rG55qsGqmsDqFI3gM,14007
36
36
  perplexity/resources/chat/__init__.py,sha256=BVAfz9TM3DT5W9f_mt0P9YRxL_MsUxKCWAH6u1iogmA,1041
37
- perplexity/resources/chat/chat.py,sha256=P143HQo1m9MknnYtSq4JzmDofDtGHlXHzTaLEyr1a7k,3656
38
- perplexity/resources/chat/completions.py,sha256=tHOAzaktVNOaQBZCMgdz3sgdyguy2l7UOGENLj3k7iQ,19675
37
+ perplexity/resources/chat/chat.py,sha256=yvQmxxpr7k9-A8UwUukL5QIXHahfsdFjHQqRFWWbkzE,3680
38
+ perplexity/resources/chat/completions.py,sha256=d70koq7kxMMMOsL4d7qNLz-meR35l4d2i-DIqKZl3no,18775
39
39
  perplexity/types/__init__.py,sha256=ZONTqk9Xtih2BkldS3hQyCK5fO6dsUpMct8WUDCvBq0,491
40
- perplexity/types/search_create_params.py,sha256=TENCoRI6XQhag-593m5qIsT_vHZYhuX4LLtCZnFgjE0,528
40
+ perplexity/types/search_create_params.py,sha256=5cc01O0upHO7-dZrIHEi3KKhFYlCANUlhRSty4jQpHc,556
41
41
  perplexity/types/search_create_response.py,sha256=lOteaJs4qpULkx5GLtEs6HhetqIBhM0I1AC1moWTeI8,426
42
42
  perplexity/types/async_/__init__.py,sha256=OKfJYcKb4NObdiRObqJV_dOyDQ8feXekDUge2o_4pXQ,122
43
43
  perplexity/types/async_/chat/__init__.py,sha256=xo2Cya_CfjEBRos2yvW_Wrq39PZiXFBT7ukZZBNvIUM,552
@@ -58,7 +58,7 @@ perplexity/types/shared/usage_info.py,sha256=_jE7Nal9cMxtEpJjT4t2SAs6z3MufrjwPug
58
58
  perplexity/types/shared_params/__init__.py,sha256=v5gr6-wq7IWgrQ8un401oApylzh3KnsIF_ilz-roX0s,241
59
59
  perplexity/types/shared_params/api_public_search_result.py,sha256=n4VUQnGOFGGWUdwYd8P5o-vEqZKhRuI5R0dBs_ZsHtE,418
60
60
  perplexity/types/shared_params/chat_message_input.py,sha256=BsNwhjwOFydvUo2OfrF9AHx--a1uPidSxdDyBGrK-sc,6690
61
- perplexityai-0.10.0.dist-info/METADATA,sha256=0YEPDZyoJVPUqJ1FRpzED5J6Is7lAIDQY3eckvSUx38,15981
62
- perplexityai-0.10.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
63
- perplexityai-0.10.0.dist-info/licenses/LICENSE,sha256=hkCriG3MT4vBhhc0roAOsrCE7IEDr1ywVEMonVHGmAQ,11340
64
- perplexityai-0.10.0.dist-info/RECORD,,
61
+ perplexityai-0.12.0.dist-info/METADATA,sha256=5UT7w2B6X6dI1nJpLnPCdVknnhXEF35M02YN64iJMi4,16035
62
+ perplexityai-0.12.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
63
+ perplexityai-0.12.0.dist-info/licenses/LICENSE,sha256=hkCriG3MT4vBhhc0roAOsrCE7IEDr1ywVEMonVHGmAQ,11340
64
+ perplexityai-0.12.0.dist-info/RECORD,,