perplexityai 0.12.1__py3-none-any.whl → 0.14.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/_client.py +4 -0
- perplexity/_streaming.py +40 -2
- perplexity/_version.py +1 -1
- perplexity/resources/async_/chat/completions.py +10 -12
- perplexity/resources/chat/completions.py +514 -13
- perplexity/resources/search.py +6 -6
- perplexity/types/__init__.py +1 -0
- perplexity/types/async_/chat/completion_create_params.py +9 -1
- perplexity/types/async_/chat/completion_create_response.py +4 -28
- perplexity/types/async_/chat/completion_get_params.py +2 -0
- perplexity/types/async_/chat/completion_get_response.py +4 -28
- perplexity/types/chat/__init__.py +0 -1
- perplexity/types/chat/completion_create_params.py +23 -4
- perplexity/types/search_create_params.py +1 -1
- perplexity/types/search_create_response.py +2 -0
- perplexity/types/shared/api_public_search_result.py +3 -0
- perplexity/types/shared_params/api_public_search_result.py +3 -1
- perplexity/types/{chat/completion_create_response.py → stream_chunk.py} +8 -8
- {perplexityai-0.12.1.dist-info → perplexityai-0.14.0.dist-info}/METADATA +53 -9
- {perplexityai-0.12.1.dist-info → perplexityai-0.14.0.dist-info}/RECORD +22 -22
- {perplexityai-0.12.1.dist-info → perplexityai-0.14.0.dist-info}/WHEEL +0 -0
- {perplexityai-0.12.1.dist-info → perplexityai-0.14.0.dist-info}/licenses/LICENSE +0 -0
perplexity/resources/search.py
CHANGED
|
@@ -48,7 +48,7 @@ class SearchResource(SyncAPIResource):
|
|
|
48
48
|
self,
|
|
49
49
|
*,
|
|
50
50
|
query: Union[str, SequenceNotStr[str]],
|
|
51
|
-
|
|
51
|
+
display_server_time: bool | Omit = omit,
|
|
52
52
|
max_results: int | Omit = omit,
|
|
53
53
|
max_tokens: int | Omit = omit,
|
|
54
54
|
max_tokens_per_page: int | Omit = omit,
|
|
@@ -61,7 +61,7 @@ class SearchResource(SyncAPIResource):
|
|
|
61
61
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
62
62
|
) -> SearchCreateResponse:
|
|
63
63
|
"""
|
|
64
|
-
Search
|
|
64
|
+
Search the web and retrieve relevant web page contents.
|
|
65
65
|
|
|
66
66
|
Args:
|
|
67
67
|
extra_headers: Send extra headers
|
|
@@ -77,7 +77,7 @@ class SearchResource(SyncAPIResource):
|
|
|
77
77
|
body=maybe_transform(
|
|
78
78
|
{
|
|
79
79
|
"query": query,
|
|
80
|
-
"
|
|
80
|
+
"display_server_time": display_server_time,
|
|
81
81
|
"max_results": max_results,
|
|
82
82
|
"max_tokens": max_tokens,
|
|
83
83
|
"max_tokens_per_page": max_tokens_per_page,
|
|
@@ -116,7 +116,7 @@ class AsyncSearchResource(AsyncAPIResource):
|
|
|
116
116
|
self,
|
|
117
117
|
*,
|
|
118
118
|
query: Union[str, SequenceNotStr[str]],
|
|
119
|
-
|
|
119
|
+
display_server_time: bool | Omit = omit,
|
|
120
120
|
max_results: int | Omit = omit,
|
|
121
121
|
max_tokens: int | Omit = omit,
|
|
122
122
|
max_tokens_per_page: int | Omit = omit,
|
|
@@ -129,7 +129,7 @@ class AsyncSearchResource(AsyncAPIResource):
|
|
|
129
129
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
130
130
|
) -> SearchCreateResponse:
|
|
131
131
|
"""
|
|
132
|
-
Search
|
|
132
|
+
Search the web and retrieve relevant web page contents.
|
|
133
133
|
|
|
134
134
|
Args:
|
|
135
135
|
extra_headers: Send extra headers
|
|
@@ -145,7 +145,7 @@ class AsyncSearchResource(AsyncAPIResource):
|
|
|
145
145
|
body=await async_maybe_transform(
|
|
146
146
|
{
|
|
147
147
|
"query": query,
|
|
148
|
-
"
|
|
148
|
+
"display_server_time": display_server_time,
|
|
149
149
|
"max_results": max_results,
|
|
150
150
|
"max_tokens": max_tokens,
|
|
151
151
|
"max_tokens_per_page": max_tokens_per_page,
|
perplexity/types/__init__.py
CHANGED
|
@@ -9,5 +9,6 @@ from .shared import (
|
|
|
9
9
|
ChatMessageOutput as ChatMessageOutput,
|
|
10
10
|
APIPublicSearchResult as APIPublicSearchResult,
|
|
11
11
|
)
|
|
12
|
+
from .stream_chunk import StreamChunk as StreamChunk
|
|
12
13
|
from .search_create_params import SearchCreateParams as SearchCreateParams
|
|
13
14
|
from .search_create_response import SearchCreateResponse as SearchCreateResponse
|
|
@@ -124,7 +124,7 @@ class RequestWebSearchOptions(TypedDict, total=False):
|
|
|
124
124
|
|
|
125
125
|
search_context_size: Literal["low", "medium", "high"]
|
|
126
126
|
|
|
127
|
-
search_type: Literal["fast", "pro", "auto"]
|
|
127
|
+
search_type: Optional[Literal["fast", "pro", "auto"]]
|
|
128
128
|
|
|
129
129
|
user_location: Optional[RequestWebSearchOptionsUserLocation]
|
|
130
130
|
|
|
@@ -166,6 +166,8 @@ class Request(TypedDict, total=False):
|
|
|
166
166
|
|
|
167
167
|
image_format_filter: Optional[SequenceNotStr[str]]
|
|
168
168
|
|
|
169
|
+
language_preference: Optional[str]
|
|
170
|
+
|
|
169
171
|
last_updated_after_filter: Optional[str]
|
|
170
172
|
|
|
171
173
|
last_updated_before_filter: Optional[str]
|
|
@@ -220,8 +222,12 @@ class Request(TypedDict, total=False):
|
|
|
220
222
|
|
|
221
223
|
stream: Optional[bool]
|
|
222
224
|
|
|
225
|
+
stream_mode: Literal["full", "concise"]
|
|
226
|
+
|
|
223
227
|
temperature: Optional[float]
|
|
224
228
|
|
|
229
|
+
thread_id: Optional[str]
|
|
230
|
+
|
|
225
231
|
tool_choice: Optional[Literal["none", "auto", "required"]]
|
|
226
232
|
|
|
227
233
|
tools: Optional[Iterable[RequestTool]]
|
|
@@ -236,4 +242,6 @@ class Request(TypedDict, total=False):
|
|
|
236
242
|
|
|
237
243
|
updated_before_timestamp: Optional[int]
|
|
238
244
|
|
|
245
|
+
use_threads: Optional[bool]
|
|
246
|
+
|
|
239
247
|
web_search_options: RequestWebSearchOptions
|
|
@@ -1,36 +1,12 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
from typing import
|
|
3
|
+
from typing import Optional
|
|
4
4
|
from typing_extensions import Literal
|
|
5
5
|
|
|
6
6
|
from ...._models import BaseModel
|
|
7
|
-
from ...
|
|
8
|
-
from ...shared.usage_info import UsageInfo
|
|
9
|
-
from ...shared.api_public_search_result import APIPublicSearchResult
|
|
7
|
+
from ...stream_chunk import StreamChunk
|
|
10
8
|
|
|
11
|
-
__all__ = ["CompletionCreateResponse"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class Response(BaseModel):
|
|
15
|
-
id: str
|
|
16
|
-
|
|
17
|
-
choices: List[Choice]
|
|
18
|
-
|
|
19
|
-
created: int
|
|
20
|
-
|
|
21
|
-
model: str
|
|
22
|
-
|
|
23
|
-
usage: UsageInfo
|
|
24
|
-
|
|
25
|
-
citations: Optional[List[str]] = None
|
|
26
|
-
|
|
27
|
-
object: Optional[str] = None
|
|
28
|
-
|
|
29
|
-
search_results: Optional[List[APIPublicSearchResult]] = None
|
|
30
|
-
|
|
31
|
-
status: Optional[Literal["PENDING", "COMPLETED"]] = None
|
|
32
|
-
|
|
33
|
-
type: Optional[Literal["message", "info", "end_of_stream"]] = None
|
|
9
|
+
__all__ = ["CompletionCreateResponse"]
|
|
34
10
|
|
|
35
11
|
|
|
36
12
|
class CompletionCreateResponse(BaseModel):
|
|
@@ -49,6 +25,6 @@ class CompletionCreateResponse(BaseModel):
|
|
|
49
25
|
|
|
50
26
|
failed_at: Optional[int] = None
|
|
51
27
|
|
|
52
|
-
response: Optional[
|
|
28
|
+
response: Optional[StreamChunk] = None
|
|
53
29
|
|
|
54
30
|
started_at: Optional[int] = None
|
|
@@ -16,6 +16,8 @@ class CompletionGetParams(TypedDict, total=False):
|
|
|
16
16
|
|
|
17
17
|
x_client_name: Annotated[str, PropertyInfo(alias="x-client-name")]
|
|
18
18
|
|
|
19
|
+
x_created_at_epoch_seconds: Annotated[str, PropertyInfo(alias="x-created-at-epoch-seconds")]
|
|
20
|
+
|
|
19
21
|
x_request_time: Annotated[str, PropertyInfo(alias="x-request-time")]
|
|
20
22
|
|
|
21
23
|
x_usage_tier: Annotated[str, PropertyInfo(alias="x-usage-tier")]
|
|
@@ -1,36 +1,12 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
from typing import
|
|
3
|
+
from typing import Optional
|
|
4
4
|
from typing_extensions import Literal
|
|
5
5
|
|
|
6
6
|
from ...._models import BaseModel
|
|
7
|
-
from ...
|
|
8
|
-
from ...shared.usage_info import UsageInfo
|
|
9
|
-
from ...shared.api_public_search_result import APIPublicSearchResult
|
|
7
|
+
from ...stream_chunk import StreamChunk
|
|
10
8
|
|
|
11
|
-
__all__ = ["CompletionGetResponse"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class Response(BaseModel):
|
|
15
|
-
id: str
|
|
16
|
-
|
|
17
|
-
choices: List[Choice]
|
|
18
|
-
|
|
19
|
-
created: int
|
|
20
|
-
|
|
21
|
-
model: str
|
|
22
|
-
|
|
23
|
-
usage: UsageInfo
|
|
24
|
-
|
|
25
|
-
citations: Optional[List[str]] = None
|
|
26
|
-
|
|
27
|
-
object: Optional[str] = None
|
|
28
|
-
|
|
29
|
-
search_results: Optional[List[APIPublicSearchResult]] = None
|
|
30
|
-
|
|
31
|
-
status: Optional[Literal["PENDING", "COMPLETED"]] = None
|
|
32
|
-
|
|
33
|
-
type: Optional[Literal["message", "info", "end_of_stream"]] = None
|
|
9
|
+
__all__ = ["CompletionGetResponse"]
|
|
34
10
|
|
|
35
11
|
|
|
36
12
|
class CompletionGetResponse(BaseModel):
|
|
@@ -49,6 +25,6 @@ class CompletionGetResponse(BaseModel):
|
|
|
49
25
|
|
|
50
26
|
failed_at: Optional[int] = None
|
|
51
27
|
|
|
52
|
-
response: Optional[
|
|
28
|
+
response: Optional[StreamChunk] = None
|
|
53
29
|
|
|
54
30
|
started_at: Optional[int] = None
|
|
@@ -9,7 +9,7 @@ from ..._types import SequenceNotStr
|
|
|
9
9
|
from ..shared_params.chat_message_input import ChatMessageInput
|
|
10
10
|
|
|
11
11
|
__all__ = [
|
|
12
|
-
"
|
|
12
|
+
"CompletionCreateParamsBase",
|
|
13
13
|
"DebugParams",
|
|
14
14
|
"ResponseFormat",
|
|
15
15
|
"ResponseFormatResponseFormatText",
|
|
@@ -22,10 +22,12 @@ __all__ = [
|
|
|
22
22
|
"ToolFunctionParameters",
|
|
23
23
|
"WebSearchOptions",
|
|
24
24
|
"WebSearchOptionsUserLocation",
|
|
25
|
+
"CompletionCreateParamsNonStreaming",
|
|
26
|
+
"CompletionCreateParamsStreaming",
|
|
25
27
|
]
|
|
26
28
|
|
|
27
29
|
|
|
28
|
-
class
|
|
30
|
+
class CompletionCreateParamsBase(TypedDict, total=False):
|
|
29
31
|
messages: Required[Iterable[ChatMessageInput]]
|
|
30
32
|
|
|
31
33
|
model: Required[str]
|
|
@@ -62,6 +64,8 @@ class CompletionCreateParams(TypedDict, total=False):
|
|
|
62
64
|
|
|
63
65
|
image_format_filter: Optional[SequenceNotStr[str]]
|
|
64
66
|
|
|
67
|
+
language_preference: Optional[str]
|
|
68
|
+
|
|
65
69
|
last_updated_after_filter: Optional[str]
|
|
66
70
|
|
|
67
71
|
last_updated_before_filter: Optional[str]
|
|
@@ -114,10 +118,12 @@ class CompletionCreateParams(TypedDict, total=False):
|
|
|
114
118
|
|
|
115
119
|
stop: Union[str, SequenceNotStr[str], None]
|
|
116
120
|
|
|
117
|
-
|
|
121
|
+
stream_mode: Literal["full", "concise"]
|
|
118
122
|
|
|
119
123
|
temperature: Optional[float]
|
|
120
124
|
|
|
125
|
+
thread_id: Optional[str]
|
|
126
|
+
|
|
121
127
|
tool_choice: Optional[Literal["none", "auto", "required"]]
|
|
122
128
|
|
|
123
129
|
tools: Optional[Iterable[Tool]]
|
|
@@ -132,6 +138,8 @@ class CompletionCreateParams(TypedDict, total=False):
|
|
|
132
138
|
|
|
133
139
|
updated_before_timestamp: Optional[int]
|
|
134
140
|
|
|
141
|
+
use_threads: Optional[bool]
|
|
142
|
+
|
|
135
143
|
web_search_options: WebSearchOptions
|
|
136
144
|
|
|
137
145
|
|
|
@@ -225,6 +233,17 @@ class WebSearchOptions(TypedDict, total=False):
|
|
|
225
233
|
|
|
226
234
|
search_context_size: Literal["low", "medium", "high"]
|
|
227
235
|
|
|
228
|
-
search_type: Literal["fast", "pro", "auto"]
|
|
236
|
+
search_type: Optional[Literal["fast", "pro", "auto"]]
|
|
229
237
|
|
|
230
238
|
user_location: Optional[WebSearchOptionsUserLocation]
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
class CompletionCreateParamsNonStreaming(CompletionCreateParamsBase, total=False):
|
|
242
|
+
stream: Optional[Literal[False]]
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
class CompletionCreateParamsStreaming(CompletionCreateParamsBase):
|
|
246
|
+
stream: Required[Literal[True]]
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
CompletionCreateParams = Union[CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
from typing import Optional
|
|
4
|
+
from typing_extensions import Literal
|
|
4
5
|
|
|
5
6
|
from ..._models import BaseModel
|
|
6
7
|
|
|
@@ -17,3 +18,5 @@ class APIPublicSearchResult(BaseModel):
|
|
|
17
18
|
last_updated: Optional[str] = None
|
|
18
19
|
|
|
19
20
|
snippet: Optional[str] = None
|
|
21
|
+
|
|
22
|
+
source: Optional[Literal["web", "attachment"]] = None
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from typing import Optional
|
|
6
|
-
from typing_extensions import Required, TypedDict
|
|
6
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
7
7
|
|
|
8
8
|
__all__ = ["APIPublicSearchResult"]
|
|
9
9
|
|
|
@@ -18,3 +18,5 @@ class APIPublicSearchResult(TypedDict, total=False):
|
|
|
18
18
|
last_updated: Optional[str]
|
|
19
19
|
|
|
20
20
|
snippet: str
|
|
21
|
+
|
|
22
|
+
source: Literal["web", "attachment"]
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
from typing import List, Optional
|
|
4
4
|
from typing_extensions import Literal
|
|
5
5
|
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
6
|
+
from .._models import BaseModel
|
|
7
|
+
from .shared.choice import Choice
|
|
8
|
+
from .shared.usage_info import UsageInfo
|
|
9
|
+
from .shared.api_public_search_result import APIPublicSearchResult
|
|
10
10
|
|
|
11
|
-
__all__ = ["
|
|
11
|
+
__all__ = ["StreamChunk"]
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
class
|
|
14
|
+
class StreamChunk(BaseModel):
|
|
15
15
|
id: str
|
|
16
16
|
|
|
17
17
|
choices: List[Choice]
|
|
@@ -20,8 +20,6 @@ class CompletionCreateResponse(BaseModel):
|
|
|
20
20
|
|
|
21
21
|
model: str
|
|
22
22
|
|
|
23
|
-
usage: UsageInfo
|
|
24
|
-
|
|
25
23
|
citations: Optional[List[str]] = None
|
|
26
24
|
|
|
27
25
|
object: Optional[str] = None
|
|
@@ -31,3 +29,5 @@ class CompletionCreateResponse(BaseModel):
|
|
|
31
29
|
status: Optional[Literal["PENDING", "COMPLETED"]] = None
|
|
32
30
|
|
|
33
31
|
type: Optional[Literal["message", "info", "end_of_stream"]] = None
|
|
32
|
+
|
|
33
|
+
usage: Optional[UsageInfo] = None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: perplexityai
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.14.0
|
|
4
4
|
Summary: The official Python library for the perplexity API
|
|
5
5
|
Project-URL: Homepage, https://github.com/perplexityai/perplexity-py
|
|
6
6
|
Project-URL: Repository, https://github.com/perplexityai/perplexity-py
|
|
@@ -88,7 +88,7 @@ client = Perplexity(
|
|
|
88
88
|
api_key=os.environ.get("PERPLEXITY_API_KEY"), # This is the default and can be omitted
|
|
89
89
|
)
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
stream_chunk = client.chat.completions.create(
|
|
92
92
|
messages=[
|
|
93
93
|
{
|
|
94
94
|
"role": "user",
|
|
@@ -97,7 +97,7 @@ completion = client.chat.completions.create(
|
|
|
97
97
|
],
|
|
98
98
|
model="sonar",
|
|
99
99
|
)
|
|
100
|
-
print(
|
|
100
|
+
print(stream_chunk.id)
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
While you can provide an `api_key` keyword argument,
|
|
@@ -120,7 +120,7 @@ client = AsyncPerplexity(
|
|
|
120
120
|
|
|
121
121
|
|
|
122
122
|
async def main() -> None:
|
|
123
|
-
|
|
123
|
+
stream_chunk = await client.chat.completions.create(
|
|
124
124
|
messages=[
|
|
125
125
|
{
|
|
126
126
|
"role": "user",
|
|
@@ -129,7 +129,7 @@ async def main() -> None:
|
|
|
129
129
|
],
|
|
130
130
|
model="sonar",
|
|
131
131
|
)
|
|
132
|
-
print(
|
|
132
|
+
print(stream_chunk.id)
|
|
133
133
|
|
|
134
134
|
|
|
135
135
|
asyncio.run(main())
|
|
@@ -161,7 +161,7 @@ async def main() -> None:
|
|
|
161
161
|
api_key="My API Key",
|
|
162
162
|
http_client=DefaultAioHttpClient(),
|
|
163
163
|
) as client:
|
|
164
|
-
|
|
164
|
+
stream_chunk = await client.chat.completions.create(
|
|
165
165
|
messages=[
|
|
166
166
|
{
|
|
167
167
|
"role": "user",
|
|
@@ -170,12 +170,56 @@ async def main() -> None:
|
|
|
170
170
|
],
|
|
171
171
|
model="sonar",
|
|
172
172
|
)
|
|
173
|
-
print(
|
|
173
|
+
print(stream_chunk.id)
|
|
174
174
|
|
|
175
175
|
|
|
176
176
|
asyncio.run(main())
|
|
177
177
|
```
|
|
178
178
|
|
|
179
|
+
## Streaming responses
|
|
180
|
+
|
|
181
|
+
We provide support for streaming responses using Server Side Events (SSE).
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
from perplexity import Perplexity
|
|
185
|
+
|
|
186
|
+
client = Perplexity()
|
|
187
|
+
|
|
188
|
+
stream = client.chat.completions.create(
|
|
189
|
+
messages=[
|
|
190
|
+
{
|
|
191
|
+
"role": "user",
|
|
192
|
+
"content": "What is the capital of France?",
|
|
193
|
+
}
|
|
194
|
+
],
|
|
195
|
+
model="sonar",
|
|
196
|
+
stream=True,
|
|
197
|
+
)
|
|
198
|
+
for stream_chunk in stream:
|
|
199
|
+
print(stream_chunk.id)
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
The async client uses the exact same interface.
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
from perplexity import AsyncPerplexity
|
|
206
|
+
|
|
207
|
+
client = AsyncPerplexity()
|
|
208
|
+
|
|
209
|
+
stream = await client.chat.completions.create(
|
|
210
|
+
messages=[
|
|
211
|
+
{
|
|
212
|
+
"role": "user",
|
|
213
|
+
"content": "What is the capital of France?",
|
|
214
|
+
}
|
|
215
|
+
],
|
|
216
|
+
model="sonar",
|
|
217
|
+
stream=True,
|
|
218
|
+
)
|
|
219
|
+
async for stream_chunk in stream:
|
|
220
|
+
print(stream_chunk.id)
|
|
221
|
+
```
|
|
222
|
+
|
|
179
223
|
## Using types
|
|
180
224
|
|
|
181
225
|
Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
|
|
@@ -194,7 +238,7 @@ from perplexity import Perplexity
|
|
|
194
238
|
|
|
195
239
|
client = Perplexity()
|
|
196
240
|
|
|
197
|
-
|
|
241
|
+
stream_chunk = client.chat.completions.create(
|
|
198
242
|
messages=[
|
|
199
243
|
{
|
|
200
244
|
"content": "string",
|
|
@@ -204,7 +248,7 @@ completion = client.chat.completions.create(
|
|
|
204
248
|
model="model",
|
|
205
249
|
debug_params={},
|
|
206
250
|
)
|
|
207
|
-
print(
|
|
251
|
+
print(stream_chunk.debug_params)
|
|
208
252
|
```
|
|
209
253
|
|
|
210
254
|
## Handling errors
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
perplexity/__init__.py,sha256=tK4KC0qHjpk-ym2IM9lG56HeBXAHz36gMzb0rmWEa7Y,2701
|
|
2
2
|
perplexity/_base_client.py,sha256=aOipaCx-xU9FMpoqKMCzs6LHxmeGlLUlGiihUUNLGUc,67051
|
|
3
|
-
perplexity/_client.py,sha256=
|
|
3
|
+
perplexity/_client.py,sha256=Zpp0EdtkpVduOGvdXcMINzb102FZ4cDi2bQ7i2XULEA,16154
|
|
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
|
|
@@ -9,9 +9,9 @@ perplexity/_models.py,sha256=lKnskYPONAWDvWo8tmbbVk7HmG7UOsI0Nve0vSMmkRc,30452
|
|
|
9
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
|
-
perplexity/_streaming.py,sha256=
|
|
12
|
+
perplexity/_streaming.py,sha256=0IcQb2A1XAarVUZD3Wgll7S8D4ps1qVXSu5-HEI7-vw,11254
|
|
13
13
|
perplexity/_types.py,sha256=BPuUCddonHjZ2AeEModCeb-zAYCRRT5XtxneIQhJxAk,7240
|
|
14
|
-
perplexity/_version.py,sha256=
|
|
14
|
+
perplexity/_version.py,sha256=fJGOwcjY6lFfX7I7tUtfxwSpPhIlddGJz58x9orVjn8,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
|
|
@@ -27,38 +27,38 @@ perplexity/_utils/_typing.py,sha256=N_5PPuFNsaygbtA_npZd98SVN1LQQvFTKL6bkWPBZGU,
|
|
|
27
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=
|
|
30
|
+
perplexity/resources/search.py,sha256=WEYqHwqIJcjnCa_omOVgzKuZwQtqK8pirR2OieLSabA,7298
|
|
31
31
|
perplexity/resources/async_/__init__.py,sha256=hvcoEKx4nCYPDoBSO_sk-uNVQ7y-fmNhzvAlvX19TIo,964
|
|
32
32
|
perplexity/resources/async_/async_.py,sha256=XzvC3AMbXXQ9mqe9TI10ZSmEuXaWPRwNC4E7AjvNdg0,3534
|
|
33
33
|
perplexity/resources/async_/chat/__init__.py,sha256=BVAfz9TM3DT5W9f_mt0P9YRxL_MsUxKCWAH6u1iogmA,1041
|
|
34
34
|
perplexity/resources/async_/chat/chat.py,sha256=M3hN3sfZKAt1C8FhOaWtxFPJAmPyE-GXkiU_LSN9EiA,3682
|
|
35
|
-
perplexity/resources/async_/chat/completions.py,sha256=
|
|
35
|
+
perplexity/resources/async_/chat/completions.py,sha256=6SuFVsjkXld0iASJKVKcjPKeFivLzLToZQqqA8nqLr8,14075
|
|
36
36
|
perplexity/resources/chat/__init__.py,sha256=BVAfz9TM3DT5W9f_mt0P9YRxL_MsUxKCWAH6u1iogmA,1041
|
|
37
37
|
perplexity/resources/chat/chat.py,sha256=yvQmxxpr7k9-A8UwUukL5QIXHahfsdFjHQqRFWWbkzE,3680
|
|
38
|
-
perplexity/resources/chat/completions.py,sha256=
|
|
39
|
-
perplexity/types/__init__.py,sha256=
|
|
40
|
-
perplexity/types/search_create_params.py,sha256=
|
|
41
|
-
perplexity/types/search_create_response.py,sha256=
|
|
38
|
+
perplexity/resources/chat/completions.py,sha256=fmQv0dEC1YWQr7H8Wv5sWTtxazZ2ZEf_pryu_luCVt0,45754
|
|
39
|
+
perplexity/types/__init__.py,sha256=LpZgQmlRWsFC0_xIzJhxSd2VY-vxDdAplR0Oqmtnu4M,544
|
|
40
|
+
perplexity/types/search_create_params.py,sha256=8K_Px2vrQ06GnyAHi89wDPV-6-iLkXaOAZ8HWkYPG1g,559
|
|
41
|
+
perplexity/types/search_create_response.py,sha256=u4biwHjn5krPDOTRuolb1DyCPBRNATsuFs_Hynqxgro,465
|
|
42
|
+
perplexity/types/stream_chunk.py,sha256=GxPn4KENvDhhJ8sLc297_fd3XrhZeEansYbTtjl21kA,782
|
|
42
43
|
perplexity/types/async_/__init__.py,sha256=OKfJYcKb4NObdiRObqJV_dOyDQ8feXekDUge2o_4pXQ,122
|
|
43
44
|
perplexity/types/async_/chat/__init__.py,sha256=xo2Cya_CfjEBRos2yvW_Wrq39PZiXFBT7ukZZBNvIUM,552
|
|
44
|
-
perplexity/types/async_/chat/completion_create_params.py,sha256=
|
|
45
|
-
perplexity/types/async_/chat/completion_create_response.py,sha256=
|
|
46
|
-
perplexity/types/async_/chat/completion_get_params.py,sha256=
|
|
47
|
-
perplexity/types/async_/chat/completion_get_response.py,sha256=
|
|
45
|
+
perplexity/types/async_/chat/completion_create_params.py,sha256=3XC001rMxst9ZM2unL1gpVPAWYB7tr758brQCGvZOkA,5699
|
|
46
|
+
perplexity/types/async_/chat/completion_create_response.py,sha256=XXYz7p2TVGn5iu5TklCm7nNpMjufuUO3YHNGPTpAmWU,676
|
|
47
|
+
perplexity/types/async_/chat/completion_get_params.py,sha256=1z3T0rG-xkDubzUtuBzXkI1M-pb4jcfpWpbF-Qoco7g,768
|
|
48
|
+
perplexity/types/async_/chat/completion_get_response.py,sha256=YTbspM1VcWRpUa5Wxmg6P7oA3S8yLLcY2mPuBXZqECI,670
|
|
48
49
|
perplexity/types/async_/chat/completion_list_response.py,sha256=63QSRV-2YA6gMZhyrmiZuzxasjjwT-kM3MyFuadTnZs,658
|
|
49
|
-
perplexity/types/chat/__init__.py,sha256=
|
|
50
|
-
perplexity/types/chat/completion_create_params.py,sha256=
|
|
51
|
-
perplexity/types/chat/completion_create_response.py,sha256=u4zFkOce7ER_H0j76a67B6RZlErUUI3xBed81iYklF0,795
|
|
50
|
+
perplexity/types/chat/__init__.py,sha256=9VtUhUp2vFpm5fgy2tMc-XF9NfkBXdFZvSzLmNprkqk,210
|
|
51
|
+
perplexity/types/chat/completion_create_params.py,sha256=N03I713Ck__mE9Tn5IiqOy90OGrDnQP8_hvBFOz5uDQ,5703
|
|
52
52
|
perplexity/types/shared/__init__.py,sha256=-RlflcttJZ_q_lP6YD0mVWbKhU33j91tUVuMO5OqMAM,397
|
|
53
|
-
perplexity/types/shared/api_public_search_result.py,sha256=
|
|
53
|
+
perplexity/types/shared/api_public_search_result.py,sha256=Udw-8Or0dr_24LAhDQp-9OTkli2hw3WWp2BNEWuEeTI,461
|
|
54
54
|
perplexity/types/shared/chat_message_input.py,sha256=wgqL1qb6hHU-sZgybgjL3VdAJFHdY0HjjNecey6CHLU,6118
|
|
55
55
|
perplexity/types/shared/chat_message_output.py,sha256=ejnHnPuYphBCo44u5d9RKIc5tQJ98SHcbGLYR7St-CQ,6120
|
|
56
56
|
perplexity/types/shared/choice.py,sha256=enGVvSlz6W4fC6scq9j_E1zxvMnSG_IxU0plF9jYiJE,427
|
|
57
57
|
perplexity/types/shared/usage_info.py,sha256=_jE7Nal9cMxtEpJjT4t2SAs6z3MufrjwPugsRomqc9c,782
|
|
58
58
|
perplexity/types/shared_params/__init__.py,sha256=v5gr6-wq7IWgrQ8un401oApylzh3KnsIF_ilz-roX0s,241
|
|
59
|
-
perplexity/types/shared_params/api_public_search_result.py,sha256=
|
|
59
|
+
perplexity/types/shared_params/api_public_search_result.py,sha256=JPT8jm4IALOc51HgTQGUiMbSgTt10oeh4zti4KjcnkU,469
|
|
60
60
|
perplexity/types/shared_params/chat_message_input.py,sha256=BsNwhjwOFydvUo2OfrF9AHx--a1uPidSxdDyBGrK-sc,6690
|
|
61
|
-
perplexityai-0.
|
|
62
|
-
perplexityai-0.
|
|
63
|
-
perplexityai-0.
|
|
64
|
-
perplexityai-0.
|
|
61
|
+
perplexityai-0.14.0.dist-info/METADATA,sha256=-mdezuTZlUrTFtSswPM6pHth7XvsSYjTv2qx9vBHy_U,16552
|
|
62
|
+
perplexityai-0.14.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
63
|
+
perplexityai-0.14.0.dist-info/licenses/LICENSE,sha256=hkCriG3MT4vBhhc0roAOsrCE7IEDr1ywVEMonVHGmAQ,11340
|
|
64
|
+
perplexityai-0.14.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|