-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtask.py
More file actions
426 lines (284 loc) · 13.6 KB
/
task.py
File metadata and controls
426 lines (284 loc) · 13.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from __future__ import annotations
from typing import TYPE_CHECKING, Dict, List, Union, Optional
from datetime import datetime
from typing_extensions import Literal, TypeAlias
from pydantic import Field as FieldInfo
from .._models import BaseModel
from .get_step import GetStep
from .log_step import LogStep
from .set_step import SetStep
from .sleep_step import SleepStep
from .yield_step import YieldStep
from .return_step import ReturnStep
from .evaluate_step import EvaluateStep
from .tool_call_step import ToolCallStep
from .shared.secret_ref import SecretRef
from .shared.system_def import SystemDef
from .prompt_step_output import PromptStepOutput
from .switch_step_output import SwitchStepOutput
from .error_workflow_step import ErrorWorkflowStep
from .foreach_step_output import ForeachStepOutput
from .shared.function_def import FunctionDef
from .wait_for_input_step import WaitForInputStep
from .parallel_step_output import ParallelStepOutput
from .shared.bash20241022_def import Bash20241022Def
from .shared.computer20241022_def import Computer20241022Def
from .shared.arxiv_integration_def import ArxivIntegrationDef
from .shared.brave_integration_def import BraveIntegrationDef
from .shared.dummy_integration_def import DummyIntegrationDef
from .shared.email_integration_def import EmailIntegrationDef
from .shared.ffmpeg_integration_def import FfmpegIntegrationDef
from .shared.spider_integration_def import SpiderIntegrationDef
from .shared.algolia_integration_def import AlgoliaIntegrationDef
from .shared.mailgun_integration_def import MailgunIntegrationDef
from .shared.text_editor20241022_def import TextEditor20241022Def
from .shared.weather_integration_def import WeatherIntegrationDef
from .shared.wikipedia_integration_def import WikipediaIntegrationDef
from .shared.llama_parse_integration_def import LlamaParseIntegrationDef
from .shared.unstructured_integration_def import UnstructuredIntegrationDef
from .shared.remote_browser_integration_def import RemoteBrowserIntegrationDef
from .shared.cloudinary_edit_integration_def import CloudinaryEditIntegrationDef
from .shared.cloudinary_upload_integration_def import CloudinaryUploadIntegrationDef
from .shared.browserbase_context_integration_def import BrowserbaseContextIntegrationDef
from .shared.browserbase_extension_integration_def import BrowserbaseExtensionIntegrationDef
from .shared.browserbase_get_session_integration_def import BrowserbaseGetSessionIntegrationDef
from .shared.browserbase_list_sessions_integration_def import BrowserbaseListSessionsIntegrationDef
from .shared.browserbase_create_session_integration_def import BrowserbaseCreateSessionIntegrationDef
from .shared.browserbase_complete_session_integration_def import BrowserbaseCompleteSessionIntegrationDef
from .shared.browserbase_get_session_live_urls_integration_def import BrowserbaseGetSessionLiveURLsIntegrationDef
__all__ = [
"Task",
"Main",
"MainMainOutput",
"MainMainOutputMap",
"Tool",
"ToolAPICall",
"ToolAPICallParamsSchema",
"ToolAPICallParamsSchemaProperties",
"ToolIntegration",
"ToolIntegrationMcpIntegrationDef",
"ToolIntegrationMcpIntegrationDefArguments",
"ToolIntegrationMcpIntegrationDefArgumentsMcpCallToolArguments",
"ToolIntegrationMcpIntegrationDefArgumentsMcpListToolsArguments",
"ToolIntegrationMcpIntegrationDefSetup",
"ToolIntegrationGoogleSheetsIntegrationDefOutput",
"ToolIntegrationGoogleSheetsIntegrationDefOutputArguments",
"ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsReadArguments",
"ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsWriteArguments",
"ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsAppendArguments",
"ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsClearArguments",
"ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsBatchReadArguments",
"ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsBatchWriteArguments",
"ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsBatchWriteArgumentsData",
"ToolIntegrationGoogleSheetsIntegrationDefOutputSetup",
]
MainMainOutputMap: TypeAlias = Union[EvaluateStep, ToolCallStep, PromptStepOutput, GetStep, SetStep, LogStep, YieldStep]
class MainMainOutput(BaseModel):
map: MainMainOutputMap
over: str
initial: Optional[object] = None
kind: Optional[Literal["map_reduce"]] = FieldInfo(alias="kind_", default=None)
label: Optional[str] = None
parallelism: Optional[int] = None
reduce: Optional[str] = None
Main: TypeAlias = Union[
EvaluateStep,
ToolCallStep,
PromptStepOutput,
GetStep,
SetStep,
LogStep,
YieldStep,
ReturnStep,
SleepStep,
ErrorWorkflowStep,
WaitForInputStep,
"IfElseStepOutput",
SwitchStepOutput,
ForeachStepOutput,
ParallelStepOutput,
MainMainOutput,
]
class ToolAPICallParamsSchemaProperties(BaseModel):
type: str
description: Optional[str] = None
enum: Optional[List[str]] = None
items: Optional[object] = None
class ToolAPICallParamsSchema(BaseModel):
properties: Dict[str, ToolAPICallParamsSchemaProperties]
additional_properties: Optional[bool] = FieldInfo(alias="additionalProperties", default=None)
required: Optional[List[str]] = None
type: Optional[str] = None
class ToolAPICall(BaseModel):
method: Literal["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"]
url: str
content: Optional[str] = None
cookies: Optional[Dict[str, str]] = None
data: Optional[object] = None
files: Optional[object] = None
follow_redirects: Optional[bool] = None
headers: Optional[Dict[str, str]] = None
include_response_content: Optional[bool] = None
json_: Optional[object] = FieldInfo(alias="json", default=None)
params: Union[str, object, None] = None
params_schema: Optional[ToolAPICallParamsSchema] = None
"""JSON Schema for API call parameters"""
schema_: Optional[object] = FieldInfo(alias="schema", default=None)
secrets: Optional[Dict[str, SecretRef]] = None
timeout: Optional[int] = None
class ToolIntegrationMcpIntegrationDefArgumentsMcpCallToolArguments(BaseModel):
tool_name: str
arguments: Optional[object] = None
timeout_seconds: Optional[int] = None
class ToolIntegrationMcpIntegrationDefArgumentsMcpListToolsArguments(BaseModel):
dummy: Optional[str] = None
ToolIntegrationMcpIntegrationDefArguments: TypeAlias = Union[
ToolIntegrationMcpIntegrationDefArgumentsMcpCallToolArguments,
ToolIntegrationMcpIntegrationDefArgumentsMcpListToolsArguments,
None,
]
class ToolIntegrationMcpIntegrationDefSetup(BaseModel):
transport: Literal["sse", "http"]
args: Optional[List[str]] = None
command: Optional[str] = None
cwd: Optional[str] = None
env: Optional[Dict[str, str]] = None
http_headers: Optional[Dict[str, str]] = None
http_url: Optional[str] = None
class ToolIntegrationMcpIntegrationDef(BaseModel):
arguments: Optional[ToolIntegrationMcpIntegrationDefArguments] = None
"""Arguments to call a named tool on the MCP server"""
method: Optional[str] = None
provider: Optional[Literal["mcp"]] = None
setup: Optional[ToolIntegrationMcpIntegrationDefSetup] = None
"""Setup parameters for MCP integration"""
class ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsReadArguments(BaseModel):
range: str
spreadsheet_id: str
date_time_render_option: Optional[Literal["SERIAL_NUMBER", "FORMATTED_STRING"]] = None
major_dimension: Optional[Literal["ROWS", "COLUMNS"]] = None
value_render_option: Optional[Literal["FORMATTED_VALUE", "UNFORMATTED_VALUE", "FORMULA"]] = None
class ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsWriteArguments(BaseModel):
range: str
spreadsheet_id: str
values: List[List[object]]
include_values_in_response: Optional[bool] = None
insert_data_option: Optional[Literal["OVERWRITE", "INSERT_ROWS"]] = None
value_input_option: Optional[Literal["RAW", "USER_ENTERED"]] = None
class ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsAppendArguments(BaseModel):
range: str
spreadsheet_id: str
values: List[List[object]]
include_values_in_response: Optional[bool] = None
insert_data_option: Optional[Literal["OVERWRITE", "INSERT_ROWS"]] = None
value_input_option: Optional[Literal["RAW", "USER_ENTERED"]] = None
class ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsClearArguments(BaseModel):
range: str
spreadsheet_id: str
class ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsBatchReadArguments(BaseModel):
ranges: List[str]
spreadsheet_id: str
date_time_render_option: Optional[Literal["SERIAL_NUMBER", "FORMATTED_STRING"]] = None
major_dimension: Optional[Literal["ROWS", "COLUMNS"]] = None
value_render_option: Optional[Literal["FORMATTED_VALUE", "UNFORMATTED_VALUE", "FORMULA"]] = None
class ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsBatchWriteArgumentsData(BaseModel):
range: str
values: List[List[object]]
major_dimension: Optional[Literal["ROWS", "COLUMNS"]] = None
class ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsBatchWriteArguments(BaseModel):
data: List[ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsBatchWriteArgumentsData]
spreadsheet_id: str
include_values_in_response: Optional[bool] = None
value_input_option: Optional[Literal["RAW", "USER_ENTERED"]] = None
ToolIntegrationGoogleSheetsIntegrationDefOutputArguments: TypeAlias = Union[
ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsReadArguments,
ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsWriteArguments,
ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsAppendArguments,
ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsClearArguments,
ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsBatchReadArguments,
ToolIntegrationGoogleSheetsIntegrationDefOutputArgumentsGoogleSheetsBatchWriteArguments,
None,
]
class ToolIntegrationGoogleSheetsIntegrationDefOutputSetup(BaseModel):
use_julep_service: bool
default_retry_count: Optional[int] = None
service_account_json: Optional[str] = None
class ToolIntegrationGoogleSheetsIntegrationDefOutput(BaseModel):
arguments: Optional[ToolIntegrationGoogleSheetsIntegrationDefOutputArguments] = None
"""Arguments for reading values from a spreadsheet"""
method: Optional[
Literal["read_values", "write_values", "append_values", "clear_values", "batch_read", "batch_write"]
] = None
provider: Optional[Literal["google_sheets"]] = None
setup: Optional[ToolIntegrationGoogleSheetsIntegrationDefOutputSetup] = None
"""Setup parameters for Google Sheets integration"""
ToolIntegration: TypeAlias = Union[
DummyIntegrationDef,
BraveIntegrationDef,
EmailIntegrationDef,
SpiderIntegrationDef,
WikipediaIntegrationDef,
WeatherIntegrationDef,
MailgunIntegrationDef,
BrowserbaseContextIntegrationDef,
BrowserbaseExtensionIntegrationDef,
BrowserbaseListSessionsIntegrationDef,
BrowserbaseCreateSessionIntegrationDef,
BrowserbaseGetSessionIntegrationDef,
BrowserbaseCompleteSessionIntegrationDef,
BrowserbaseGetSessionLiveURLsIntegrationDef,
RemoteBrowserIntegrationDef,
LlamaParseIntegrationDef,
FfmpegIntegrationDef,
CloudinaryUploadIntegrationDef,
CloudinaryEditIntegrationDef,
ArxivIntegrationDef,
UnstructuredIntegrationDef,
AlgoliaIntegrationDef,
ToolIntegrationMcpIntegrationDef,
ToolIntegrationGoogleSheetsIntegrationDefOutput,
None,
]
class Tool(BaseModel):
name: str
type: Literal[
"function", "integration", "system", "api_call", "computer_20241022", "text_editor_20241022", "bash_20241022"
]
api_call: Optional[ToolAPICall] = None
"""API call definition"""
bash_20241022: Optional[Bash20241022Def] = None
computer_20241022: Optional[Computer20241022Def] = None
"""Anthropic new tools"""
description: Optional[str] = None
function: Optional[FunctionDef] = None
"""Function definition"""
inherited: Optional[bool] = None
integration: Optional[ToolIntegration] = None
"""Brave integration definition"""
system: Optional[SystemDef] = None
"""System definition"""
text_editor_20241022: Optional[TextEditor20241022Def] = None
class Task(BaseModel):
id: str
created_at: datetime
main: List[Main]
name: str
updated_at: datetime
canonical_name: Optional[str] = None
description: Optional[str] = None
inherit_tools: Optional[bool] = None
input_schema: Optional[object] = None
metadata: Optional[object] = None
tools: Optional[List[Tool]] = None
if TYPE_CHECKING:
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
# value to this field, so for compatibility we avoid doing it at runtime.
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
# Stub to indicate that arbitrary properties are accepted.
# To access properties that are not valid identifiers you can use `getattr`, e.g.
# `getattr(obj, '$type')`
def __getattr__(self, attr: str) -> object: ...
else:
__pydantic_extra__: Dict[str, object]
from .shared.if_else_step_output import IfElseStepOutput