perplexityai 0.7.1__py3-none-any.whl → 0.8.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/_version.py +1 -1
- perplexity/resources/async_/chat/completions.py +90 -76
- perplexity/resources/chat/completions.py +178 -80
- perplexity/resources/content.py +2 -6
- perplexity/resources/search.py +2 -60
- perplexity/types/__init__.py +4 -3
- perplexity/types/async_/chat/__init__.py +1 -1
- perplexity/types/async_/chat/completion_create_params.py +187 -40
- perplexity/types/async_/chat/completion_create_response.py +13 -13
- perplexity/types/async_/chat/completion_get_params.py +23 -0
- perplexity/types/async_/chat/completion_get_response.py +13 -13
- perplexity/types/async_/chat/completion_list_response.py +1 -1
- perplexity/types/chat/completion_create_params.py +182 -40
- perplexity/types/chat/completion_create_response.py +13 -10
- perplexity/types/content_create_params.py +0 -1
- perplexity/types/content_create_response.py +0 -6
- perplexity/types/search_create_params.py +0 -24
- perplexity/types/search_create_response.py +0 -7
- perplexity/types/shared/__init__.py +4 -3
- perplexity/types/shared/{search_result.py → api_public_search_result.py} +6 -2
- perplexity/types/shared/chat_message_input.py +212 -0
- perplexity/types/shared/chat_message_output.py +212 -0
- perplexity/types/shared/{chat_choice.py → choice.py} +6 -4
- perplexity/types/shared/usage_info.py +19 -1
- perplexity/types/shared_params/__init__.py +2 -1
- perplexity/types/shared_params/api_public_search_result.py +20 -0
- perplexity/types/shared_params/chat_message_input.py +216 -0
- {perplexityai-0.7.1.dist-info → perplexityai-0.8.0.dist-info}/METADATA +44 -5
- {perplexityai-0.7.1.dist-info → perplexityai-0.8.0.dist-info}/RECORD +31 -29
- perplexity/types/async_/chat/completion_list_params.py +0 -15
- perplexity/types/shared/chat_message.py +0 -31
- perplexity/types/shared_params/chat_message.py +0 -31
- {perplexityai-0.7.1.dist-info → perplexityai-0.8.0.dist-info}/WHEEL +0 -0
- {perplexityai-0.7.1.dist-info → perplexityai-0.8.0.dist-info}/licenses/LICENSE +0 -0
perplexity/resources/content.py
CHANGED
|
@@ -53,11 +53,9 @@ class ContentResource(SyncAPIResource):
|
|
|
53
53
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
54
54
|
) -> ContentCreateResponse:
|
|
55
55
|
"""
|
|
56
|
-
|
|
56
|
+
Get Urls Content
|
|
57
57
|
|
|
58
58
|
Args:
|
|
59
|
-
urls: List of URLs to retrieve content from
|
|
60
|
-
|
|
61
59
|
extra_headers: Send extra headers
|
|
62
60
|
|
|
63
61
|
extra_query: Add additional query parameters to the request
|
|
@@ -108,11 +106,9 @@ class AsyncContentResource(AsyncAPIResource):
|
|
|
108
106
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
109
107
|
) -> ContentCreateResponse:
|
|
110
108
|
"""
|
|
111
|
-
|
|
109
|
+
Get Urls Content
|
|
112
110
|
|
|
113
111
|
Args:
|
|
114
|
-
urls: List of URLs to retrieve content from
|
|
115
|
-
|
|
116
112
|
extra_headers: Send extra headers
|
|
117
113
|
|
|
118
114
|
extra_query: Add additional query parameters to the request
|
perplexity/resources/search.py
CHANGED
|
@@ -68,38 +68,9 @@ class SearchResource(SyncAPIResource):
|
|
|
68
68
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
69
69
|
) -> SearchCreateResponse:
|
|
70
70
|
"""
|
|
71
|
-
|
|
71
|
+
Search
|
|
72
72
|
|
|
73
73
|
Args:
|
|
74
|
-
query: Search query string or array of query strings to search for
|
|
75
|
-
|
|
76
|
-
country: Country code to bias search results towards (e.g., 'US', 'GB', 'CA')
|
|
77
|
-
|
|
78
|
-
last_updated_after_filter: Only include results last updated after this date (ISO 8601 format: YYYY-MM-DD)
|
|
79
|
-
|
|
80
|
-
last_updated_before_filter: Only include results last updated before this date (ISO 8601 format: YYYY-MM-DD)
|
|
81
|
-
|
|
82
|
-
max_results: Maximum number of search results to return
|
|
83
|
-
|
|
84
|
-
max_tokens: Maximum number of tokens to return across all results
|
|
85
|
-
|
|
86
|
-
max_tokens_per_page: Maximum number of tokens to return per individual search result
|
|
87
|
-
|
|
88
|
-
safe_search: Enable safe search filtering to exclude adult content
|
|
89
|
-
|
|
90
|
-
search_after_date_filter: Only include results published after this date (ISO 8601 format: YYYY-MM-DD)
|
|
91
|
-
|
|
92
|
-
search_before_date_filter: Only include results published before this date (ISO 8601 format: YYYY-MM-DD)
|
|
93
|
-
|
|
94
|
-
search_domain_filter: List of domains to restrict search results to (e.g., ['example.com',
|
|
95
|
-
'another.com'])
|
|
96
|
-
|
|
97
|
-
search_mode: Type of search to perform: 'web' for general web search, 'academic' for
|
|
98
|
-
scholarly articles, 'sec' for SEC filings
|
|
99
|
-
|
|
100
|
-
search_recency_filter: Filter results by how recently they were published (hour, day, week, month, or
|
|
101
|
-
year)
|
|
102
|
-
|
|
103
74
|
extra_headers: Send extra headers
|
|
104
75
|
|
|
105
76
|
extra_query: Add additional query parameters to the request
|
|
@@ -179,38 +150,9 @@ class AsyncSearchResource(AsyncAPIResource):
|
|
|
179
150
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
180
151
|
) -> SearchCreateResponse:
|
|
181
152
|
"""
|
|
182
|
-
|
|
153
|
+
Search
|
|
183
154
|
|
|
184
155
|
Args:
|
|
185
|
-
query: Search query string or array of query strings to search for
|
|
186
|
-
|
|
187
|
-
country: Country code to bias search results towards (e.g., 'US', 'GB', 'CA')
|
|
188
|
-
|
|
189
|
-
last_updated_after_filter: Only include results last updated after this date (ISO 8601 format: YYYY-MM-DD)
|
|
190
|
-
|
|
191
|
-
last_updated_before_filter: Only include results last updated before this date (ISO 8601 format: YYYY-MM-DD)
|
|
192
|
-
|
|
193
|
-
max_results: Maximum number of search results to return
|
|
194
|
-
|
|
195
|
-
max_tokens: Maximum number of tokens to return across all results
|
|
196
|
-
|
|
197
|
-
max_tokens_per_page: Maximum number of tokens to return per individual search result
|
|
198
|
-
|
|
199
|
-
safe_search: Enable safe search filtering to exclude adult content
|
|
200
|
-
|
|
201
|
-
search_after_date_filter: Only include results published after this date (ISO 8601 format: YYYY-MM-DD)
|
|
202
|
-
|
|
203
|
-
search_before_date_filter: Only include results published before this date (ISO 8601 format: YYYY-MM-DD)
|
|
204
|
-
|
|
205
|
-
search_domain_filter: List of domains to restrict search results to (e.g., ['example.com',
|
|
206
|
-
'another.com'])
|
|
207
|
-
|
|
208
|
-
search_mode: Type of search to perform: 'web' for general web search, 'academic' for
|
|
209
|
-
scholarly articles, 'sec' for SEC filings
|
|
210
|
-
|
|
211
|
-
search_recency_filter: Filter results by how recently they were published (hour, day, week, month, or
|
|
212
|
-
year)
|
|
213
|
-
|
|
214
156
|
extra_headers: Send extra headers
|
|
215
157
|
|
|
216
158
|
extra_query: Add additional query parameters to the request
|
perplexity/types/__init__.py
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from .shared import (
|
|
6
|
+
Choice as Choice,
|
|
6
7
|
UsageInfo as UsageInfo,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
ChatMessageInput as ChatMessageInput,
|
|
9
|
+
ChatMessageOutput as ChatMessageOutput,
|
|
10
|
+
APIPublicSearchResult as APIPublicSearchResult,
|
|
10
11
|
)
|
|
11
12
|
from .search_create_params import SearchCreateParams as SearchCreateParams
|
|
12
13
|
from .content_create_params import ContentCreateParams as ContentCreateParams
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from .
|
|
5
|
+
from .completion_get_params import CompletionGetParams as CompletionGetParams
|
|
6
6
|
from .completion_get_response import CompletionGetResponse as CompletionGetResponse
|
|
7
7
|
from .completion_create_params import CompletionCreateParams as CompletionCreateParams
|
|
8
8
|
from .completion_list_response import CompletionListResponse as CompletionListResponse
|
|
@@ -2,93 +2,240 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Iterable, Optional
|
|
6
|
-
from typing_extensions import Literal, Required, TypedDict
|
|
5
|
+
from typing import Dict, Union, Iterable, Optional
|
|
6
|
+
from typing_extensions import Literal, Required, TypeAlias, TypedDict
|
|
7
7
|
|
|
8
8
|
from ...._types import SequenceNotStr
|
|
9
|
-
from ...shared_params.
|
|
10
|
-
|
|
11
|
-
__all__ = [
|
|
9
|
+
from ...shared_params.chat_message_input import ChatMessageInput
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"CompletionCreateParams",
|
|
13
|
+
"Request",
|
|
14
|
+
"RequestDebugParams",
|
|
15
|
+
"RequestResponseFormat",
|
|
16
|
+
"RequestResponseFormatResponseFormatText",
|
|
17
|
+
"RequestResponseFormatResponseFormatJsonSchema",
|
|
18
|
+
"RequestResponseFormatResponseFormatJsonSchemaJsonSchema",
|
|
19
|
+
"RequestResponseFormatResponseFormatRegex",
|
|
20
|
+
"RequestResponseFormatResponseFormatRegexRegex",
|
|
21
|
+
"RequestTool",
|
|
22
|
+
"RequestToolFunction",
|
|
23
|
+
"RequestToolFunctionParameters",
|
|
24
|
+
"RequestWebSearchOptions",
|
|
25
|
+
"RequestWebSearchOptionsUserLocation",
|
|
26
|
+
]
|
|
12
27
|
|
|
13
28
|
|
|
14
29
|
class CompletionCreateParams(TypedDict, total=False):
|
|
15
30
|
request: Required[Request]
|
|
16
31
|
|
|
32
|
+
idempotency_key: Optional[str]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class RequestDebugParams(TypedDict, total=False):
|
|
36
|
+
summarizer_model_override: Optional[str]
|
|
37
|
+
|
|
38
|
+
summarizer_prompt_override: Optional[str]
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class RequestResponseFormatResponseFormatText(TypedDict, total=False):
|
|
42
|
+
type: Required[Literal["text"]]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class RequestResponseFormatResponseFormatJsonSchemaJsonSchema(TypedDict, total=False):
|
|
46
|
+
schema: Required[Dict[str, object]]
|
|
47
|
+
|
|
48
|
+
description: Optional[str]
|
|
49
|
+
|
|
50
|
+
name: Optional[str]
|
|
51
|
+
|
|
52
|
+
strict: Optional[bool]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class RequestResponseFormatResponseFormatJsonSchema(TypedDict, total=False):
|
|
56
|
+
json_schema: Required[RequestResponseFormatResponseFormatJsonSchemaJsonSchema]
|
|
57
|
+
|
|
58
|
+
type: Required[Literal["json_schema"]]
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class RequestResponseFormatResponseFormatRegexRegex(TypedDict, total=False):
|
|
62
|
+
regex: Required[str]
|
|
63
|
+
|
|
64
|
+
description: Optional[str]
|
|
65
|
+
|
|
66
|
+
name: Optional[str]
|
|
67
|
+
|
|
68
|
+
strict: Optional[bool]
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class RequestResponseFormatResponseFormatRegex(TypedDict, total=False):
|
|
72
|
+
regex: Required[RequestResponseFormatResponseFormatRegexRegex]
|
|
73
|
+
|
|
74
|
+
type: Required[Literal["regex"]]
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
RequestResponseFormat: TypeAlias = Union[
|
|
78
|
+
RequestResponseFormatResponseFormatText,
|
|
79
|
+
RequestResponseFormatResponseFormatJsonSchema,
|
|
80
|
+
RequestResponseFormatResponseFormatRegex,
|
|
81
|
+
]
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class RequestToolFunctionParameters(TypedDict, total=False):
|
|
85
|
+
properties: Required[Dict[str, object]]
|
|
86
|
+
|
|
87
|
+
type: Required[str]
|
|
88
|
+
|
|
89
|
+
additional_properties: Optional[bool]
|
|
90
|
+
|
|
91
|
+
required: Optional[SequenceNotStr[str]]
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class RequestToolFunction(TypedDict, total=False):
|
|
95
|
+
description: Required[str]
|
|
96
|
+
|
|
97
|
+
name: Required[str]
|
|
98
|
+
|
|
99
|
+
parameters: Required[RequestToolFunctionParameters]
|
|
100
|
+
|
|
101
|
+
strict: Optional[bool]
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class RequestTool(TypedDict, total=False):
|
|
105
|
+
function: Required[RequestToolFunction]
|
|
106
|
+
|
|
107
|
+
type: Required[Literal["function"]]
|
|
108
|
+
|
|
17
109
|
|
|
18
110
|
class RequestWebSearchOptionsUserLocation(TypedDict, total=False):
|
|
19
111
|
city: Optional[str]
|
|
20
112
|
|
|
21
113
|
country: Optional[str]
|
|
22
|
-
"""Two-letter ISO country code"""
|
|
23
114
|
|
|
24
115
|
latitude: Optional[float]
|
|
25
116
|
|
|
26
117
|
longitude: Optional[float]
|
|
27
118
|
|
|
28
119
|
region: Optional[str]
|
|
29
|
-
"""State/province name"""
|
|
30
120
|
|
|
31
121
|
|
|
32
122
|
class RequestWebSearchOptions(TypedDict, total=False):
|
|
33
|
-
|
|
34
|
-
"""Improves relevance of image search results"""
|
|
123
|
+
image_results_enhanced_relevance: bool
|
|
35
124
|
|
|
36
125
|
search_context_size: Literal["low", "medium", "high"]
|
|
37
|
-
"""
|
|
38
|
-
Amount of search context retrieved: low (cost-saving), medium (balanced), high
|
|
39
|
-
(comprehensive)
|
|
40
|
-
"""
|
|
41
126
|
|
|
42
|
-
|
|
127
|
+
search_type: Literal["fast", "pro", "auto"]
|
|
128
|
+
|
|
129
|
+
user_location: Optional[RequestWebSearchOptionsUserLocation]
|
|
43
130
|
|
|
44
131
|
|
|
45
132
|
class Request(TypedDict, total=False):
|
|
46
|
-
messages: Required[Iterable[
|
|
47
|
-
|
|
133
|
+
messages: Required[Iterable[ChatMessageInput]]
|
|
134
|
+
|
|
135
|
+
model: Required[str]
|
|
136
|
+
|
|
137
|
+
_debug_pro_search: bool
|
|
48
138
|
|
|
49
|
-
|
|
50
|
-
"""The name of the model that will complete your prompt"""
|
|
139
|
+
_inputs: Optional[Iterable[int]]
|
|
51
140
|
|
|
52
|
-
|
|
53
|
-
"""Disables web search completely - model uses only training data"""
|
|
141
|
+
_is_browser_agent: Optional[bool]
|
|
54
142
|
|
|
55
|
-
|
|
56
|
-
|
|
143
|
+
_prompt_token_length: Optional[int]
|
|
144
|
+
|
|
145
|
+
best_of: Optional[int]
|
|
146
|
+
|
|
147
|
+
country: Optional[str]
|
|
148
|
+
|
|
149
|
+
cum_logprobs: Optional[bool]
|
|
150
|
+
|
|
151
|
+
debug_params: Optional[RequestDebugParams]
|
|
152
|
+
|
|
153
|
+
disable_search: Optional[bool]
|
|
154
|
+
|
|
155
|
+
diverse_first_token: Optional[bool]
|
|
156
|
+
|
|
157
|
+
enable_search_classifier: Optional[bool]
|
|
158
|
+
|
|
159
|
+
file_workspace_id: Optional[str]
|
|
160
|
+
|
|
161
|
+
frequency_penalty: Optional[float]
|
|
162
|
+
|
|
163
|
+
has_image_url: bool
|
|
164
|
+
|
|
165
|
+
image_domain_filter: Optional[SequenceNotStr[str]]
|
|
166
|
+
|
|
167
|
+
image_format_filter: Optional[SequenceNotStr[str]]
|
|
57
168
|
|
|
58
169
|
last_updated_after_filter: Optional[str]
|
|
59
|
-
"""Only include content last updated after this date (YYYY-MM-DD)"""
|
|
60
170
|
|
|
61
171
|
last_updated_before_filter: Optional[str]
|
|
62
|
-
"""Only include content last updated before this date (YYYY-MM-DD)"""
|
|
63
172
|
|
|
64
|
-
|
|
65
|
-
|
|
173
|
+
latitude: Optional[float]
|
|
174
|
+
|
|
175
|
+
logprobs: Optional[bool]
|
|
176
|
+
|
|
177
|
+
longitude: Optional[float]
|
|
178
|
+
|
|
179
|
+
max_tokens: Optional[int]
|
|
180
|
+
|
|
181
|
+
n: Optional[int]
|
|
182
|
+
|
|
183
|
+
num_images: int
|
|
66
184
|
|
|
67
|
-
|
|
68
|
-
"""
|
|
185
|
+
num_search_results: int
|
|
69
186
|
|
|
70
|
-
|
|
71
|
-
"""Whether to include images in search results"""
|
|
187
|
+
parallel_tool_calls: Optional[bool]
|
|
72
188
|
|
|
73
|
-
|
|
74
|
-
|
|
189
|
+
presence_penalty: Optional[float]
|
|
190
|
+
|
|
191
|
+
ranking_model: Optional[str]
|
|
192
|
+
|
|
193
|
+
reasoning_effort: Optional[Literal["minimal", "low", "medium", "high"]]
|
|
194
|
+
|
|
195
|
+
response_format: Optional[RequestResponseFormat]
|
|
196
|
+
|
|
197
|
+
response_metadata: Optional[Dict[str, object]]
|
|
198
|
+
|
|
199
|
+
return_images: Optional[bool]
|
|
200
|
+
|
|
201
|
+
return_related_questions: Optional[bool]
|
|
202
|
+
|
|
203
|
+
return_videos: Optional[bool]
|
|
204
|
+
|
|
205
|
+
safe_search: Optional[bool]
|
|
75
206
|
|
|
76
207
|
search_after_date_filter: Optional[str]
|
|
77
|
-
"""Only include content published after this date (YYYY-MM-DD)"""
|
|
78
208
|
|
|
79
209
|
search_before_date_filter: Optional[str]
|
|
80
|
-
"""Only include content published before this date (YYYY-MM-DD)"""
|
|
81
210
|
|
|
82
211
|
search_domain_filter: Optional[SequenceNotStr[str]]
|
|
83
|
-
|
|
212
|
+
|
|
213
|
+
search_internal_properties: Optional[Dict[str, object]]
|
|
84
214
|
|
|
85
215
|
search_mode: Optional[Literal["web", "academic", "sec"]]
|
|
86
|
-
"""
|
|
87
|
-
Type of search: 'web' for general, 'academic' for scholarly, 'sec' for SEC
|
|
88
|
-
filings
|
|
89
|
-
"""
|
|
90
216
|
|
|
91
217
|
search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]]
|
|
92
|
-
|
|
218
|
+
|
|
219
|
+
search_tenant: Optional[str]
|
|
220
|
+
|
|
221
|
+
stop: Union[str, SequenceNotStr[str], None]
|
|
222
|
+
|
|
223
|
+
stream: Optional[bool]
|
|
224
|
+
|
|
225
|
+
temperature: Optional[float]
|
|
226
|
+
|
|
227
|
+
tool_choice: Optional[Literal["none", "auto", "required"]]
|
|
228
|
+
|
|
229
|
+
tools: Optional[Iterable[RequestTool]]
|
|
230
|
+
|
|
231
|
+
top_k: Optional[int]
|
|
232
|
+
|
|
233
|
+
top_logprobs: Optional[int]
|
|
234
|
+
|
|
235
|
+
top_p: Optional[float]
|
|
236
|
+
|
|
237
|
+
updated_after_timestamp: Optional[int]
|
|
238
|
+
|
|
239
|
+
updated_before_timestamp: Optional[int]
|
|
93
240
|
|
|
94
241
|
web_search_options: RequestWebSearchOptions
|
|
@@ -4,43 +4,44 @@ from typing import List, Optional
|
|
|
4
4
|
from typing_extensions import Literal
|
|
5
5
|
|
|
6
6
|
from ...._models import BaseModel
|
|
7
|
+
from ...shared.choice import Choice
|
|
7
8
|
from ...shared.usage_info import UsageInfo
|
|
8
|
-
from ...shared.
|
|
9
|
-
from ...shared.search_result import SearchResult
|
|
9
|
+
from ...shared.api_public_search_result import APIPublicSearchResult
|
|
10
10
|
|
|
11
11
|
__all__ = ["CompletionCreateResponse", "Response"]
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class Response(BaseModel):
|
|
15
15
|
id: str
|
|
16
|
-
"""Unique identifier for the chat completion"""
|
|
17
16
|
|
|
18
|
-
choices: List[
|
|
17
|
+
choices: List[Choice]
|
|
19
18
|
|
|
20
19
|
created: int
|
|
21
|
-
"""Unix timestamp of creation"""
|
|
22
20
|
|
|
23
21
|
model: str
|
|
24
|
-
"""The model used"""
|
|
25
|
-
|
|
26
|
-
object: str
|
|
27
22
|
|
|
28
23
|
usage: UsageInfo
|
|
29
24
|
|
|
30
|
-
|
|
31
|
-
|
|
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
|
|
32
34
|
|
|
33
35
|
|
|
34
36
|
class CompletionCreateResponse(BaseModel):
|
|
35
37
|
id: str
|
|
36
|
-
"""Unique identifier for the async job"""
|
|
37
38
|
|
|
38
39
|
created_at: int
|
|
39
|
-
"""Unix timestamp of creation"""
|
|
40
40
|
|
|
41
41
|
model: str
|
|
42
42
|
|
|
43
43
|
status: Literal["CREATED", "IN_PROGRESS", "COMPLETED", "FAILED"]
|
|
44
|
+
"""Status enum for async processing."""
|
|
44
45
|
|
|
45
46
|
completed_at: Optional[int] = None
|
|
46
47
|
|
|
@@ -49,6 +50,5 @@ class CompletionCreateResponse(BaseModel):
|
|
|
49
50
|
failed_at: Optional[int] = None
|
|
50
51
|
|
|
51
52
|
response: Optional[Response] = None
|
|
52
|
-
"""The completion response when status is COMPLETED"""
|
|
53
53
|
|
|
54
54
|
started_at: Optional[int] = None
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Annotated, TypedDict
|
|
6
|
+
|
|
7
|
+
from ...._utils import PropertyInfo
|
|
8
|
+
|
|
9
|
+
__all__ = ["CompletionGetParams"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class CompletionGetParams(TypedDict, total=False):
|
|
13
|
+
local_mode: bool
|
|
14
|
+
|
|
15
|
+
x_client_env: Annotated[str, PropertyInfo(alias="x-client-env")]
|
|
16
|
+
|
|
17
|
+
x_client_name: Annotated[str, PropertyInfo(alias="x-client-name")]
|
|
18
|
+
|
|
19
|
+
x_request_time: Annotated[str, PropertyInfo(alias="x-request-time")]
|
|
20
|
+
|
|
21
|
+
x_usage_tier: Annotated[str, PropertyInfo(alias="x-usage-tier")]
|
|
22
|
+
|
|
23
|
+
x_user_id: Annotated[str, PropertyInfo(alias="x-user-id")]
|
|
@@ -4,43 +4,44 @@ from typing import List, Optional
|
|
|
4
4
|
from typing_extensions import Literal
|
|
5
5
|
|
|
6
6
|
from ...._models import BaseModel
|
|
7
|
+
from ...shared.choice import Choice
|
|
7
8
|
from ...shared.usage_info import UsageInfo
|
|
8
|
-
from ...shared.
|
|
9
|
-
from ...shared.search_result import SearchResult
|
|
9
|
+
from ...shared.api_public_search_result import APIPublicSearchResult
|
|
10
10
|
|
|
11
11
|
__all__ = ["CompletionGetResponse", "Response"]
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class Response(BaseModel):
|
|
15
15
|
id: str
|
|
16
|
-
"""Unique identifier for the chat completion"""
|
|
17
16
|
|
|
18
|
-
choices: List[
|
|
17
|
+
choices: List[Choice]
|
|
19
18
|
|
|
20
19
|
created: int
|
|
21
|
-
"""Unix timestamp of creation"""
|
|
22
20
|
|
|
23
21
|
model: str
|
|
24
|
-
"""The model used"""
|
|
25
|
-
|
|
26
|
-
object: str
|
|
27
22
|
|
|
28
23
|
usage: UsageInfo
|
|
29
24
|
|
|
30
|
-
|
|
31
|
-
|
|
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
|
|
32
34
|
|
|
33
35
|
|
|
34
36
|
class CompletionGetResponse(BaseModel):
|
|
35
37
|
id: str
|
|
36
|
-
"""Unique identifier for the async job"""
|
|
37
38
|
|
|
38
39
|
created_at: int
|
|
39
|
-
"""Unix timestamp of creation"""
|
|
40
40
|
|
|
41
41
|
model: str
|
|
42
42
|
|
|
43
43
|
status: Literal["CREATED", "IN_PROGRESS", "COMPLETED", "FAILED"]
|
|
44
|
+
"""Status enum for async processing."""
|
|
44
45
|
|
|
45
46
|
completed_at: Optional[int] = None
|
|
46
47
|
|
|
@@ -49,6 +50,5 @@ class CompletionGetResponse(BaseModel):
|
|
|
49
50
|
failed_at: Optional[int] = None
|
|
50
51
|
|
|
51
52
|
response: Optional[Response] = None
|
|
52
|
-
"""The completion response when status is COMPLETED"""
|
|
53
53
|
|
|
54
54
|
started_at: Optional[int] = None
|
|
@@ -16,6 +16,7 @@ class Request(BaseModel):
|
|
|
16
16
|
model: str
|
|
17
17
|
|
|
18
18
|
status: Literal["CREATED", "IN_PROGRESS", "COMPLETED", "FAILED"]
|
|
19
|
+
"""Status enum for async processing."""
|
|
19
20
|
|
|
20
21
|
completed_at: Optional[int] = None
|
|
21
22
|
|
|
@@ -28,4 +29,3 @@ class CompletionListResponse(BaseModel):
|
|
|
28
29
|
requests: List[Request]
|
|
29
30
|
|
|
30
31
|
next_token: Optional[str] = None
|
|
31
|
-
"""Token for pagination"""
|