perplexityai 0.7.2__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.2.dist-info → perplexityai-0.8.0.dist-info}/METADATA +4 -4
- {perplexityai-0.7.2.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.2.dist-info → perplexityai-0.8.0.dist-info}/WHEEL +0 -0
- {perplexityai-0.7.2.dist-info → perplexityai-0.8.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -2,89 +2,231 @@
|
|
|
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
|
+
"DebugParams",
|
|
14
|
+
"ResponseFormat",
|
|
15
|
+
"ResponseFormatResponseFormatText",
|
|
16
|
+
"ResponseFormatResponseFormatJsonSchema",
|
|
17
|
+
"ResponseFormatResponseFormatJsonSchemaJsonSchema",
|
|
18
|
+
"ResponseFormatResponseFormatRegex",
|
|
19
|
+
"ResponseFormatResponseFormatRegexRegex",
|
|
20
|
+
"Tool",
|
|
21
|
+
"ToolFunction",
|
|
22
|
+
"ToolFunctionParameters",
|
|
23
|
+
"WebSearchOptions",
|
|
24
|
+
"WebSearchOptionsUserLocation",
|
|
25
|
+
]
|
|
12
26
|
|
|
13
27
|
|
|
14
28
|
class CompletionCreateParams(TypedDict, total=False):
|
|
15
|
-
messages: Required[Iterable[
|
|
16
|
-
|
|
29
|
+
messages: Required[Iterable[ChatMessageInput]]
|
|
30
|
+
|
|
31
|
+
model: Required[str]
|
|
32
|
+
|
|
33
|
+
_debug_pro_search: bool
|
|
34
|
+
|
|
35
|
+
_inputs: Optional[Iterable[int]]
|
|
36
|
+
|
|
37
|
+
_is_browser_agent: Optional[bool]
|
|
38
|
+
|
|
39
|
+
_prompt_token_length: Optional[int]
|
|
40
|
+
|
|
41
|
+
best_of: Optional[int]
|
|
42
|
+
|
|
43
|
+
country: Optional[str]
|
|
44
|
+
|
|
45
|
+
cum_logprobs: Optional[bool]
|
|
17
46
|
|
|
18
|
-
|
|
19
|
-
"""The name of the model that will complete your prompt"""
|
|
47
|
+
debug_params: Optional[DebugParams]
|
|
20
48
|
|
|
21
|
-
disable_search: bool
|
|
22
|
-
"""Disables web search completely - model uses only training data"""
|
|
49
|
+
disable_search: Optional[bool]
|
|
23
50
|
|
|
24
|
-
|
|
25
|
-
|
|
51
|
+
diverse_first_token: Optional[bool]
|
|
52
|
+
|
|
53
|
+
enable_search_classifier: Optional[bool]
|
|
54
|
+
|
|
55
|
+
file_workspace_id: Optional[str]
|
|
56
|
+
|
|
57
|
+
frequency_penalty: Optional[float]
|
|
58
|
+
|
|
59
|
+
has_image_url: bool
|
|
60
|
+
|
|
61
|
+
image_domain_filter: Optional[SequenceNotStr[str]]
|
|
62
|
+
|
|
63
|
+
image_format_filter: Optional[SequenceNotStr[str]]
|
|
26
64
|
|
|
27
65
|
last_updated_after_filter: Optional[str]
|
|
28
|
-
"""Only include content last updated after this date (YYYY-MM-DD)"""
|
|
29
66
|
|
|
30
67
|
last_updated_before_filter: Optional[str]
|
|
31
|
-
"""Only include content last updated before this date (YYYY-MM-DD)"""
|
|
32
68
|
|
|
33
|
-
|
|
34
|
-
|
|
69
|
+
latitude: Optional[float]
|
|
70
|
+
|
|
71
|
+
logprobs: Optional[bool]
|
|
72
|
+
|
|
73
|
+
longitude: Optional[float]
|
|
74
|
+
|
|
75
|
+
max_tokens: Optional[int]
|
|
76
|
+
|
|
77
|
+
n: Optional[int]
|
|
78
|
+
|
|
79
|
+
num_images: int
|
|
80
|
+
|
|
81
|
+
num_search_results: int
|
|
82
|
+
|
|
83
|
+
parallel_tool_calls: Optional[bool]
|
|
84
|
+
|
|
85
|
+
presence_penalty: Optional[float]
|
|
86
|
+
|
|
87
|
+
ranking_model: Optional[str]
|
|
88
|
+
|
|
89
|
+
reasoning_effort: Optional[Literal["minimal", "low", "medium", "high"]]
|
|
90
|
+
|
|
91
|
+
response_format: Optional[ResponseFormat]
|
|
92
|
+
|
|
93
|
+
response_metadata: Optional[Dict[str, object]]
|
|
35
94
|
|
|
36
|
-
|
|
37
|
-
"""
|
|
95
|
+
return_images: Optional[bool]
|
|
38
96
|
|
|
39
|
-
|
|
40
|
-
"""Whether to include images in search results"""
|
|
97
|
+
return_related_questions: Optional[bool]
|
|
41
98
|
|
|
42
|
-
|
|
43
|
-
|
|
99
|
+
return_videos: Optional[bool]
|
|
100
|
+
|
|
101
|
+
safe_search: Optional[bool]
|
|
44
102
|
|
|
45
103
|
search_after_date_filter: Optional[str]
|
|
46
|
-
"""Only include content published after this date (YYYY-MM-DD)"""
|
|
47
104
|
|
|
48
105
|
search_before_date_filter: Optional[str]
|
|
49
|
-
"""Only include content published before this date (YYYY-MM-DD)"""
|
|
50
106
|
|
|
51
107
|
search_domain_filter: Optional[SequenceNotStr[str]]
|
|
52
|
-
|
|
108
|
+
|
|
109
|
+
search_internal_properties: Optional[Dict[str, object]]
|
|
53
110
|
|
|
54
111
|
search_mode: Optional[Literal["web", "academic", "sec"]]
|
|
55
|
-
"""
|
|
56
|
-
Type of search: 'web' for general, 'academic' for scholarly, 'sec' for SEC
|
|
57
|
-
filings
|
|
58
|
-
"""
|
|
59
112
|
|
|
60
113
|
search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]]
|
|
61
|
-
|
|
114
|
+
|
|
115
|
+
search_tenant: Optional[str]
|
|
116
|
+
|
|
117
|
+
stop: Union[str, SequenceNotStr[str], None]
|
|
118
|
+
|
|
119
|
+
stream: Optional[bool]
|
|
120
|
+
|
|
121
|
+
temperature: Optional[float]
|
|
122
|
+
|
|
123
|
+
tool_choice: Optional[Literal["none", "auto", "required"]]
|
|
124
|
+
|
|
125
|
+
tools: Optional[Iterable[Tool]]
|
|
126
|
+
|
|
127
|
+
top_k: Optional[int]
|
|
128
|
+
|
|
129
|
+
top_logprobs: Optional[int]
|
|
130
|
+
|
|
131
|
+
top_p: Optional[float]
|
|
132
|
+
|
|
133
|
+
updated_after_timestamp: Optional[int]
|
|
134
|
+
|
|
135
|
+
updated_before_timestamp: Optional[int]
|
|
62
136
|
|
|
63
137
|
web_search_options: WebSearchOptions
|
|
64
138
|
|
|
65
139
|
|
|
140
|
+
class DebugParams(TypedDict, total=False):
|
|
141
|
+
summarizer_model_override: Optional[str]
|
|
142
|
+
|
|
143
|
+
summarizer_prompt_override: Optional[str]
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
class ResponseFormatResponseFormatText(TypedDict, total=False):
|
|
147
|
+
type: Required[Literal["text"]]
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
class ResponseFormatResponseFormatJsonSchemaJsonSchema(TypedDict, total=False):
|
|
151
|
+
schema: Required[Dict[str, object]]
|
|
152
|
+
|
|
153
|
+
description: Optional[str]
|
|
154
|
+
|
|
155
|
+
name: Optional[str]
|
|
156
|
+
|
|
157
|
+
strict: Optional[bool]
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class ResponseFormatResponseFormatJsonSchema(TypedDict, total=False):
|
|
161
|
+
json_schema: Required[ResponseFormatResponseFormatJsonSchemaJsonSchema]
|
|
162
|
+
|
|
163
|
+
type: Required[Literal["json_schema"]]
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
class ResponseFormatResponseFormatRegexRegex(TypedDict, total=False):
|
|
167
|
+
regex: Required[str]
|
|
168
|
+
|
|
169
|
+
description: Optional[str]
|
|
170
|
+
|
|
171
|
+
name: Optional[str]
|
|
172
|
+
|
|
173
|
+
strict: Optional[bool]
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
class ResponseFormatResponseFormatRegex(TypedDict, total=False):
|
|
177
|
+
regex: Required[ResponseFormatResponseFormatRegexRegex]
|
|
178
|
+
|
|
179
|
+
type: Required[Literal["regex"]]
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
ResponseFormat: TypeAlias = Union[
|
|
183
|
+
ResponseFormatResponseFormatText, ResponseFormatResponseFormatJsonSchema, ResponseFormatResponseFormatRegex
|
|
184
|
+
]
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
class ToolFunctionParameters(TypedDict, total=False):
|
|
188
|
+
properties: Required[Dict[str, object]]
|
|
189
|
+
|
|
190
|
+
type: Required[str]
|
|
191
|
+
|
|
192
|
+
additional_properties: Optional[bool]
|
|
193
|
+
|
|
194
|
+
required: Optional[SequenceNotStr[str]]
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
class ToolFunction(TypedDict, total=False):
|
|
198
|
+
description: Required[str]
|
|
199
|
+
|
|
200
|
+
name: Required[str]
|
|
201
|
+
|
|
202
|
+
parameters: Required[ToolFunctionParameters]
|
|
203
|
+
|
|
204
|
+
strict: Optional[bool]
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
class Tool(TypedDict, total=False):
|
|
208
|
+
function: Required[ToolFunction]
|
|
209
|
+
|
|
210
|
+
type: Required[Literal["function"]]
|
|
211
|
+
|
|
212
|
+
|
|
66
213
|
class WebSearchOptionsUserLocation(TypedDict, total=False):
|
|
67
214
|
city: Optional[str]
|
|
68
215
|
|
|
69
216
|
country: Optional[str]
|
|
70
|
-
"""Two-letter ISO country code"""
|
|
71
217
|
|
|
72
218
|
latitude: Optional[float]
|
|
73
219
|
|
|
74
220
|
longitude: Optional[float]
|
|
75
221
|
|
|
76
222
|
region: Optional[str]
|
|
77
|
-
"""State/province name"""
|
|
78
223
|
|
|
79
224
|
|
|
80
225
|
class WebSearchOptions(TypedDict, total=False):
|
|
81
|
-
|
|
82
|
-
"""Improves relevance of image search results"""
|
|
226
|
+
image_results_enhanced_relevance: bool
|
|
83
227
|
|
|
84
228
|
search_context_size: Literal["low", "medium", "high"]
|
|
85
|
-
"""
|
|
86
|
-
Amount of search context retrieved: low (cost-saving), medium (balanced), high
|
|
87
|
-
(comprehensive)
|
|
88
|
-
"""
|
|
89
229
|
|
|
90
|
-
|
|
230
|
+
search_type: Literal["fast", "pro", "auto"]
|
|
231
|
+
|
|
232
|
+
user_location: Optional[WebSearchOptionsUserLocation]
|
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
from typing import List, Optional
|
|
4
|
+
from typing_extensions import Literal
|
|
4
5
|
|
|
5
6
|
from ..._models import BaseModel
|
|
7
|
+
from ..shared.choice import Choice
|
|
6
8
|
from ..shared.usage_info import UsageInfo
|
|
7
|
-
from ..shared.
|
|
8
|
-
from ..shared.search_result import SearchResult
|
|
9
|
+
from ..shared.api_public_search_result import APIPublicSearchResult
|
|
9
10
|
|
|
10
11
|
__all__ = ["CompletionCreateResponse"]
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
class CompletionCreateResponse(BaseModel):
|
|
14
15
|
id: str
|
|
15
|
-
"""Unique identifier for the chat completion"""
|
|
16
16
|
|
|
17
|
-
choices: List[
|
|
17
|
+
choices: List[Choice]
|
|
18
18
|
|
|
19
19
|
created: int
|
|
20
|
-
"""Unix timestamp of creation"""
|
|
21
20
|
|
|
22
21
|
model: str
|
|
23
|
-
"""The model used"""
|
|
24
|
-
|
|
25
|
-
object: str
|
|
26
22
|
|
|
27
23
|
usage: UsageInfo
|
|
28
24
|
|
|
29
|
-
|
|
30
|
-
|
|
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,21 +9,15 @@ __all__ = ["ContentCreateResponse", "Result"]
|
|
|
9
9
|
|
|
10
10
|
class Result(BaseModel):
|
|
11
11
|
content: str
|
|
12
|
-
"""The full text content of the web page or document"""
|
|
13
12
|
|
|
14
13
|
title: str
|
|
15
|
-
"""The title of the web page or document"""
|
|
16
14
|
|
|
17
15
|
url: str
|
|
18
|
-
"""The URL of the web page or document"""
|
|
19
16
|
|
|
20
17
|
date: Optional[str] = None
|
|
21
|
-
"""The publication date of the content (if available)"""
|
|
22
18
|
|
|
23
19
|
|
|
24
20
|
class ContentCreateResponse(BaseModel):
|
|
25
21
|
id: str
|
|
26
|
-
"""Unique identifier for this content retrieval request"""
|
|
27
22
|
|
|
28
23
|
results: List[Result]
|
|
29
|
-
"""Array of content objects retrieved from the requested URLs"""
|
|
@@ -12,51 +12,27 @@ __all__ = ["SearchCreateParams"]
|
|
|
12
12
|
|
|
13
13
|
class SearchCreateParams(TypedDict, total=False):
|
|
14
14
|
query: Required[Union[str, SequenceNotStr[str]]]
|
|
15
|
-
"""Search query string or array of query strings to search for"""
|
|
16
15
|
|
|
17
16
|
country: Optional[str]
|
|
18
|
-
"""Country code to bias search results towards (e.g., 'US', 'GB', 'CA')"""
|
|
19
17
|
|
|
20
18
|
last_updated_after_filter: Optional[str]
|
|
21
|
-
"""Only include results last updated after this date (ISO 8601 format: YYYY-MM-DD)"""
|
|
22
19
|
|
|
23
20
|
last_updated_before_filter: Optional[str]
|
|
24
|
-
"""
|
|
25
|
-
Only include results last updated before this date (ISO 8601 format: YYYY-MM-DD)
|
|
26
|
-
"""
|
|
27
21
|
|
|
28
22
|
max_results: int
|
|
29
|
-
"""Maximum number of search results to return"""
|
|
30
23
|
|
|
31
24
|
max_tokens: int
|
|
32
|
-
"""Maximum number of tokens to return across all results"""
|
|
33
25
|
|
|
34
26
|
max_tokens_per_page: int
|
|
35
|
-
"""Maximum number of tokens to return per individual search result"""
|
|
36
27
|
|
|
37
28
|
safe_search: Optional[bool]
|
|
38
|
-
"""Enable safe search filtering to exclude adult content"""
|
|
39
29
|
|
|
40
30
|
search_after_date_filter: Optional[str]
|
|
41
|
-
"""Only include results published after this date (ISO 8601 format: YYYY-MM-DD)"""
|
|
42
31
|
|
|
43
32
|
search_before_date_filter: Optional[str]
|
|
44
|
-
"""Only include results published before this date (ISO 8601 format: YYYY-MM-DD)"""
|
|
45
33
|
|
|
46
34
|
search_domain_filter: Optional[SequenceNotStr[str]]
|
|
47
|
-
"""
|
|
48
|
-
List of domains to restrict search results to (e.g., ['example.com',
|
|
49
|
-
'another.com'])
|
|
50
|
-
"""
|
|
51
35
|
|
|
52
36
|
search_mode: Optional[Literal["web", "academic", "sec"]]
|
|
53
|
-
"""
|
|
54
|
-
Type of search to perform: 'web' for general web search, 'academic' for
|
|
55
|
-
scholarly articles, 'sec' for SEC filings
|
|
56
|
-
"""
|
|
57
37
|
|
|
58
38
|
search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]]
|
|
59
|
-
"""
|
|
60
|
-
Filter results by how recently they were published (hour, day, week, month, or
|
|
61
|
-
year)
|
|
62
|
-
"""
|
|
@@ -9,24 +9,17 @@ __all__ = ["SearchCreateResponse", "Result"]
|
|
|
9
9
|
|
|
10
10
|
class Result(BaseModel):
|
|
11
11
|
snippet: str
|
|
12
|
-
"""A brief excerpt or summary of the page content"""
|
|
13
12
|
|
|
14
13
|
title: str
|
|
15
|
-
"""The title of the search result page"""
|
|
16
14
|
|
|
17
15
|
url: str
|
|
18
|
-
"""The URL of the search result page"""
|
|
19
16
|
|
|
20
17
|
date: Optional[str] = None
|
|
21
|
-
"""The publication date of the content (if available)"""
|
|
22
18
|
|
|
23
19
|
last_updated: Optional[str] = None
|
|
24
|
-
"""When the content was last updated (if available)"""
|
|
25
20
|
|
|
26
21
|
|
|
27
22
|
class SearchCreateResponse(BaseModel):
|
|
28
23
|
id: str
|
|
29
|
-
"""Unique identifier for this search request"""
|
|
30
24
|
|
|
31
25
|
results: List[Result]
|
|
32
|
-
"""Array of search result pages matching the query"""
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
+
from .choice import Choice as Choice
|
|
3
4
|
from .usage_info import UsageInfo as UsageInfo
|
|
4
|
-
from .
|
|
5
|
-
from .
|
|
6
|
-
from .
|
|
5
|
+
from .chat_message_input import ChatMessageInput as ChatMessageInput
|
|
6
|
+
from .chat_message_output import ChatMessageOutput as ChatMessageOutput
|
|
7
|
+
from .api_public_search_result import APIPublicSearchResult as APIPublicSearchResult
|
|
@@ -4,12 +4,16 @@ from typing import Optional
|
|
|
4
4
|
|
|
5
5
|
from ..._models import BaseModel
|
|
6
6
|
|
|
7
|
-
__all__ = ["
|
|
7
|
+
__all__ = ["APIPublicSearchResult"]
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
class
|
|
10
|
+
class APIPublicSearchResult(BaseModel):
|
|
11
11
|
title: str
|
|
12
12
|
|
|
13
13
|
url: str
|
|
14
14
|
|
|
15
15
|
date: Optional[str] = None
|
|
16
|
+
|
|
17
|
+
last_updated: Optional[str] = None
|
|
18
|
+
|
|
19
|
+
snippet: Optional[str] = None
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Dict, List, Union, Optional
|
|
4
|
+
from typing_extensions import Literal, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..._models import BaseModel
|
|
7
|
+
from .api_public_search_result import APIPublicSearchResult
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"ChatMessageInput",
|
|
11
|
+
"ContentStructuredContent",
|
|
12
|
+
"ContentStructuredContentChatMessageContentTextChunk",
|
|
13
|
+
"ContentStructuredContentChatMessageContentImageChunk",
|
|
14
|
+
"ContentStructuredContentChatMessageContentImageChunkImageURL",
|
|
15
|
+
"ContentStructuredContentChatMessageContentImageChunkImageURLURL",
|
|
16
|
+
"ContentStructuredContentChatMessageContentFileChunk",
|
|
17
|
+
"ContentStructuredContentChatMessageContentFileChunkFileURL",
|
|
18
|
+
"ContentStructuredContentChatMessageContentFileChunkFileURLURL",
|
|
19
|
+
"ContentStructuredContentChatMessageContentPdfChunk",
|
|
20
|
+
"ContentStructuredContentChatMessageContentPdfChunkPdfURL",
|
|
21
|
+
"ContentStructuredContentChatMessageContentPdfChunkPdfURLURL",
|
|
22
|
+
"ContentStructuredContentChatMessageContentVideoChunk",
|
|
23
|
+
"ContentStructuredContentChatMessageContentVideoChunkVideoURL",
|
|
24
|
+
"ContentStructuredContentChatMessageContentVideoChunkVideoURLVideoURL",
|
|
25
|
+
"ReasoningStep",
|
|
26
|
+
"ReasoningStepAgentProgress",
|
|
27
|
+
"ReasoningStepBrowserAgent",
|
|
28
|
+
"ReasoningStepBrowserToolExecution",
|
|
29
|
+
"ReasoningStepExecutePython",
|
|
30
|
+
"ReasoningStepFetchURLContent",
|
|
31
|
+
"ReasoningStepFileAttachmentSearch",
|
|
32
|
+
"ReasoningStepWebSearch",
|
|
33
|
+
"ToolCall",
|
|
34
|
+
"ToolCallFunction",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class ContentStructuredContentChatMessageContentTextChunk(BaseModel):
|
|
39
|
+
text: str
|
|
40
|
+
|
|
41
|
+
type: Literal["text"]
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class ContentStructuredContentChatMessageContentImageChunkImageURLURL(BaseModel):
|
|
45
|
+
url: str
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
ContentStructuredContentChatMessageContentImageChunkImageURL: TypeAlias = Union[
|
|
49
|
+
ContentStructuredContentChatMessageContentImageChunkImageURLURL, str
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class ContentStructuredContentChatMessageContentImageChunk(BaseModel):
|
|
54
|
+
image_url: ContentStructuredContentChatMessageContentImageChunkImageURL
|
|
55
|
+
|
|
56
|
+
type: Literal["image_url"]
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class ContentStructuredContentChatMessageContentFileChunkFileURLURL(BaseModel):
|
|
60
|
+
url: str
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
ContentStructuredContentChatMessageContentFileChunkFileURL: TypeAlias = Union[
|
|
64
|
+
ContentStructuredContentChatMessageContentFileChunkFileURLURL, str
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class ContentStructuredContentChatMessageContentFileChunk(BaseModel):
|
|
69
|
+
file_url: ContentStructuredContentChatMessageContentFileChunkFileURL
|
|
70
|
+
|
|
71
|
+
type: Literal["file_url"]
|
|
72
|
+
|
|
73
|
+
file_name: Optional[str] = None
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class ContentStructuredContentChatMessageContentPdfChunkPdfURLURL(BaseModel):
|
|
77
|
+
url: str
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
ContentStructuredContentChatMessageContentPdfChunkPdfURL: TypeAlias = Union[
|
|
81
|
+
ContentStructuredContentChatMessageContentPdfChunkPdfURLURL, str
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class ContentStructuredContentChatMessageContentPdfChunk(BaseModel):
|
|
86
|
+
pdf_url: ContentStructuredContentChatMessageContentPdfChunkPdfURL
|
|
87
|
+
|
|
88
|
+
type: Literal["pdf_url"]
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class ContentStructuredContentChatMessageContentVideoChunkVideoURLVideoURL(BaseModel):
|
|
92
|
+
url: str
|
|
93
|
+
|
|
94
|
+
frame_interval: Union[str, int, None] = None
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
ContentStructuredContentChatMessageContentVideoChunkVideoURL: TypeAlias = Union[
|
|
98
|
+
ContentStructuredContentChatMessageContentVideoChunkVideoURLVideoURL, str
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class ContentStructuredContentChatMessageContentVideoChunk(BaseModel):
|
|
103
|
+
type: Literal["video_url"]
|
|
104
|
+
|
|
105
|
+
video_url: ContentStructuredContentChatMessageContentVideoChunkVideoURL
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
ContentStructuredContent: TypeAlias = Union[
|
|
109
|
+
ContentStructuredContentChatMessageContentTextChunk,
|
|
110
|
+
ContentStructuredContentChatMessageContentImageChunk,
|
|
111
|
+
ContentStructuredContentChatMessageContentFileChunk,
|
|
112
|
+
ContentStructuredContentChatMessageContentPdfChunk,
|
|
113
|
+
ContentStructuredContentChatMessageContentVideoChunk,
|
|
114
|
+
]
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
class ReasoningStepAgentProgress(BaseModel):
|
|
118
|
+
action: Optional[str] = None
|
|
119
|
+
|
|
120
|
+
screenshot: Optional[str] = None
|
|
121
|
+
|
|
122
|
+
url: Optional[str] = None
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class ReasoningStepBrowserAgent(BaseModel):
|
|
126
|
+
result: str
|
|
127
|
+
|
|
128
|
+
url: str
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
class ReasoningStepBrowserToolExecution(BaseModel):
|
|
132
|
+
tool: Dict[str, object]
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class ReasoningStepExecutePython(BaseModel):
|
|
136
|
+
code: str
|
|
137
|
+
|
|
138
|
+
result: str
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
class ReasoningStepFetchURLContent(BaseModel):
|
|
142
|
+
contents: List[APIPublicSearchResult]
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
class ReasoningStepFileAttachmentSearch(BaseModel):
|
|
146
|
+
attachment_urls: List[str]
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
class ReasoningStepWebSearch(BaseModel):
|
|
150
|
+
search_keywords: List[str]
|
|
151
|
+
|
|
152
|
+
search_results: List[APIPublicSearchResult]
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
class ReasoningStep(BaseModel):
|
|
156
|
+
thought: str
|
|
157
|
+
|
|
158
|
+
type: Literal[
|
|
159
|
+
"web_search",
|
|
160
|
+
"fetch_url_content",
|
|
161
|
+
"execute_python",
|
|
162
|
+
"agent_progress",
|
|
163
|
+
"browser_agent",
|
|
164
|
+
"browser_tool_execution",
|
|
165
|
+
"file_attachment_search",
|
|
166
|
+
]
|
|
167
|
+
|
|
168
|
+
agent_progress: Optional[ReasoningStepAgentProgress] = None
|
|
169
|
+
"""Agent progress class for live-browsing updates"""
|
|
170
|
+
|
|
171
|
+
browser_agent: Optional[ReasoningStepBrowserAgent] = None
|
|
172
|
+
"""Browser agent step summary class"""
|
|
173
|
+
|
|
174
|
+
browser_tool_execution: Optional[ReasoningStepBrowserToolExecution] = None
|
|
175
|
+
"""Tool input for kicking off browser tool automation"""
|
|
176
|
+
|
|
177
|
+
execute_python: Optional[ReasoningStepExecutePython] = None
|
|
178
|
+
"""Code generation step details wrapper class"""
|
|
179
|
+
|
|
180
|
+
fetch_url_content: Optional[ReasoningStepFetchURLContent] = None
|
|
181
|
+
"""Fetch url content step details wrapper class"""
|
|
182
|
+
|
|
183
|
+
file_attachment_search: Optional[ReasoningStepFileAttachmentSearch] = None
|
|
184
|
+
"""File attachment search step details wrapper class"""
|
|
185
|
+
|
|
186
|
+
web_search: Optional[ReasoningStepWebSearch] = None
|
|
187
|
+
"""Web search step details wrapper class"""
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
class ToolCallFunction(BaseModel):
|
|
191
|
+
arguments: Optional[str] = None
|
|
192
|
+
|
|
193
|
+
name: Optional[str] = None
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
class ToolCall(BaseModel):
|
|
197
|
+
id: Optional[str] = None
|
|
198
|
+
|
|
199
|
+
function: Optional[ToolCallFunction] = None
|
|
200
|
+
|
|
201
|
+
type: Optional[Literal["function"]] = None
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
class ChatMessageInput(BaseModel):
|
|
205
|
+
content: Union[str, List[ContentStructuredContent]]
|
|
206
|
+
|
|
207
|
+
role: Literal["system", "user", "assistant", "tool"]
|
|
208
|
+
"""Chat roles enum"""
|
|
209
|
+
|
|
210
|
+
reasoning_steps: Optional[List[ReasoningStep]] = None
|
|
211
|
+
|
|
212
|
+
tool_calls: Optional[List[ToolCall]] = None
|