nimble_python 0.18.0__py3-none-any.whl → 0.20.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.
- nimble_python/_client.py +103 -5
- nimble_python/_models.py +80 -0
- nimble_python/_version.py +1 -1
- nimble_python/resources/__init__.py +28 -0
- nimble_python/resources/agent.py +8 -103
- nimble_python/resources/jobs/__init__.py +33 -0
- nimble_python/resources/jobs/jobs.py +691 -0
- nimble_python/resources/jobs/runs/__init__.py +33 -0
- nimble_python/resources/jobs/runs/artifacts.py +427 -0
- nimble_python/resources/jobs/runs/runs.py +389 -0
- nimble_python/resources/serp.py +20 -0
- nimble_python/resources/task_agent/__init__.py +47 -0
- nimble_python/resources/task_agent/runs.py +551 -0
- nimble_python/resources/task_agent/task_agent.py +762 -0
- nimble_python/resources/task_agent/templates.py +272 -0
- nimble_python/types/__init__.py +17 -2
- nimble_python/types/agent_generate_params.py +3 -3
- nimble_python/types/agent_generate_response.py +11 -7
- nimble_python/types/agent_get_generation_response.py +11 -7
- nimble_python/types/agent_get_response.py +2 -2
- nimble_python/types/agent_run_batch_response.py +1 -1
- nimble_python/types/batch_get_response.py +1 -1
- nimble_python/types/client_extract_async_params.py +4 -1
- nimble_python/types/client_extract_batch_params.py +16 -4
- nimble_python/types/client_extract_params.py +4 -1
- nimble_python/types/client_search_params.py +4 -1
- nimble_python/types/crawl_run_params.py +4 -1
- nimble_python/types/extract_async_response.py +1 -1
- nimble_python/types/extract_batch_response.py +1 -1
- nimble_python/types/job_create_params.py +46 -0
- nimble_python/types/job_create_response.py +59 -0
- nimble_python/types/job_get_response.py +59 -0
- nimble_python/types/job_list_params.py +20 -0
- nimble_python/types/job_list_response.py +69 -0
- nimble_python/types/job_run_response.py +29 -0
- nimble_python/types/job_update_params.py +42 -0
- nimble_python/types/job_update_response.py +59 -0
- nimble_python/types/jobs/__init__.py +8 -0
- nimble_python/types/jobs/run_cancel_response.py +13 -0
- nimble_python/types/jobs/run_get_response.py +65 -0
- nimble_python/types/jobs/run_list_params.py +17 -0
- nimble_python/types/jobs/run_list_response.py +39 -0
- nimble_python/types/jobs/runs/__init__.py +8 -0
- nimble_python/types/jobs/runs/artifact_download_url_response.py +13 -0
- nimble_python/types/jobs/runs/artifact_get_response.py +17 -0
- nimble_python/types/jobs/runs/artifact_list_response.py +22 -0
- nimble_python/types/jobs/runs/artifact_preview_response.py +15 -0
- nimble_python/types/media_run_async_params.py +1 -1
- nimble_python/types/media_run_async_response.py +1 -1
- nimble_python/types/media_run_params.py +1 -1
- nimble_python/types/serp_run_async_params.py +6 -0
- nimble_python/types/serp_run_async_response.py +1 -1
- nimble_python/types/serp_run_batch_params.py +12 -0
- nimble_python/types/serp_run_batch_response.py +1 -1
- nimble_python/types/serp_run_params.py +6 -0
- nimble_python/types/task_agent/__init__.py +11 -0
- nimble_python/types/task_agent/run_get_response.py +47 -0
- nimble_python/types/task_agent/run_get_result_response.py +188 -0
- nimble_python/types/task_agent/run_list_params.py +13 -0
- nimble_python/types/task_agent/run_list_response.py +50 -0
- nimble_python/types/task_agent/template_get_response.py +65 -0
- nimble_python/types/task_agent/template_list_params.py +18 -0
- nimble_python/types/task_agent/template_list_response.py +74 -0
- nimble_python/types/task_agent_create_params.py +70 -0
- nimble_python/types/task_agent_create_response.py +91 -0
- nimble_python/types/task_agent_get_response.py +91 -0
- nimble_python/types/task_agent_list_params.py +18 -0
- nimble_python/types/task_agent_list_response.py +102 -0
- nimble_python/types/task_agent_run_params.py +46 -0
- nimble_python/types/task_agent_run_response.py +47 -0
- nimble_python/types/task_agent_update_params.py +20 -0
- nimble_python/types/task_agent_update_response.py +91 -0
- nimble_python/types/task_get_response.py +1 -1
- nimble_python/types/task_list_response.py +1 -1
- {nimble_python-0.18.0.dist-info → nimble_python-0.20.0.dist-info}/METADATA +1 -1
- {nimble_python-0.18.0.dist-info → nimble_python-0.20.0.dist-info}/RECORD +78 -36
- nimble_python/types/agent_publish_params.py +0 -11
- nimble_python/types/agent_publish_response.py +0 -11
- {nimble_python-0.18.0.dist-info → nimble_python-0.20.0.dist-info}/WHEEL +0 -0
- {nimble_python-0.18.0.dist-info → nimble_python-0.20.0.dist-info}/licenses/LICENSE +0 -0
nimble_python/_client.py
CHANGED
|
@@ -61,14 +61,16 @@ from .types.extract_async_response import ExtractAsyncResponse
|
|
|
61
61
|
from .types.extract_batch_response import ExtractBatchResponse
|
|
62
62
|
|
|
63
63
|
if TYPE_CHECKING:
|
|
64
|
-
from .resources import serp, agent, crawl, media, tasks, batches, domain_knowledge
|
|
64
|
+
from .resources import jobs, serp, agent, crawl, media, tasks, batches, task_agent, domain_knowledge
|
|
65
65
|
from .resources.serp import SerpResource, AsyncSerpResource
|
|
66
66
|
from .resources.agent import AgentResource, AsyncAgentResource
|
|
67
67
|
from .resources.crawl import CrawlResource, AsyncCrawlResource
|
|
68
68
|
from .resources.media import MediaResource, AsyncMediaResource
|
|
69
69
|
from .resources.tasks import TasksResource, AsyncTasksResource
|
|
70
70
|
from .resources.batches import BatchesResource, AsyncBatchesResource
|
|
71
|
+
from .resources.jobs.jobs import JobsResource, AsyncJobsResource
|
|
71
72
|
from .resources.domain_knowledge import DomainKnowledgeResource, AsyncDomainKnowledgeResource
|
|
73
|
+
from .resources.task_agent.task_agent import TaskAgentResource, AsyncTaskAgentResource
|
|
72
74
|
|
|
73
75
|
__all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Nimble", "AsyncNimble", "Client", "AsyncClient"]
|
|
74
76
|
|
|
@@ -183,6 +185,18 @@ class Nimble(SyncAPIClient):
|
|
|
183
185
|
|
|
184
186
|
return SerpResource(self)
|
|
185
187
|
|
|
188
|
+
@cached_property
|
|
189
|
+
def task_agent(self) -> TaskAgentResource:
|
|
190
|
+
from .resources.task_agent import TaskAgentResource
|
|
191
|
+
|
|
192
|
+
return TaskAgentResource(self)
|
|
193
|
+
|
|
194
|
+
@cached_property
|
|
195
|
+
def jobs(self) -> JobsResource:
|
|
196
|
+
from .resources.jobs import JobsResource
|
|
197
|
+
|
|
198
|
+
return JobsResource(self)
|
|
199
|
+
|
|
186
200
|
@cached_property
|
|
187
201
|
def with_raw_response(self) -> NimbleWithRawResponse:
|
|
188
202
|
return NimbleWithRawResponse(self)
|
|
@@ -280,6 +294,7 @@ class Nimble(SyncAPIClient):
|
|
|
280
294
|
self,
|
|
281
295
|
*,
|
|
282
296
|
url: str,
|
|
297
|
+
body: object | Omit = omit,
|
|
283
298
|
browser: client_extract_params.Browser | Omit = omit,
|
|
284
299
|
browser_actions: Iterable[client_extract_params.BrowserAction] | Omit = omit,
|
|
285
300
|
city: str | Omit = omit,
|
|
@@ -1092,7 +1107,7 @@ class Nimble(SyncAPIClient):
|
|
|
1092
1107
|
"random", "no-referer", "same-origin", "google", "bing", "facebook", "twitter", "instagram"
|
|
1093
1108
|
]
|
|
1094
1109
|
| Omit = omit,
|
|
1095
|
-
render: bool | Omit = omit,
|
|
1110
|
+
render: Union[bool, Literal["auto"]] | Omit = omit,
|
|
1096
1111
|
request_timeout: float | Omit = omit,
|
|
1097
1112
|
session: client_extract_params.Session | Omit = omit,
|
|
1098
1113
|
skill: Union[str, SequenceNotStr[str]] | Omit = omit,
|
|
@@ -1169,6 +1184,8 @@ class Nimble(SyncAPIClient):
|
|
|
1169
1184
|
Args:
|
|
1170
1185
|
url: Target URL to scrape
|
|
1171
1186
|
|
|
1187
|
+
body: Request body for POST, PUT, PATCH methods
|
|
1188
|
+
|
|
1172
1189
|
browser: Browser type to emulate
|
|
1173
1190
|
|
|
1174
1191
|
browser_actions: Array of browser automation actions to execute sequentially
|
|
@@ -1236,6 +1253,7 @@ class Nimble(SyncAPIClient):
|
|
|
1236
1253
|
body=maybe_transform(
|
|
1237
1254
|
{
|
|
1238
1255
|
"url": url,
|
|
1256
|
+
"body": body,
|
|
1239
1257
|
"browser": browser,
|
|
1240
1258
|
"browser_actions": browser_actions,
|
|
1241
1259
|
"city": city,
|
|
@@ -1276,6 +1294,7 @@ class Nimble(SyncAPIClient):
|
|
|
1276
1294
|
self,
|
|
1277
1295
|
*,
|
|
1278
1296
|
url: str,
|
|
1297
|
+
body: object | Omit = omit,
|
|
1279
1298
|
browser: client_extract_async_params.Browser | Omit = omit,
|
|
1280
1299
|
browser_actions: Iterable[client_extract_async_params.BrowserAction] | Omit = omit,
|
|
1281
1300
|
callback_url: str | Omit = omit,
|
|
@@ -2089,7 +2108,7 @@ class Nimble(SyncAPIClient):
|
|
|
2089
2108
|
"random", "no-referer", "same-origin", "google", "bing", "facebook", "twitter", "instagram"
|
|
2090
2109
|
]
|
|
2091
2110
|
| Omit = omit,
|
|
2092
|
-
render: bool | Omit = omit,
|
|
2111
|
+
render: Union[bool, Literal["auto"]] | Omit = omit,
|
|
2093
2112
|
request_timeout: float | Omit = omit,
|
|
2094
2113
|
session: client_extract_async_params.Session | Omit = omit,
|
|
2095
2114
|
skill: Union[str, SequenceNotStr[str]] | Omit = omit,
|
|
@@ -2170,6 +2189,8 @@ class Nimble(SyncAPIClient):
|
|
|
2170
2189
|
Args:
|
|
2171
2190
|
url: Target URL to scrape
|
|
2172
2191
|
|
|
2192
|
+
body: Request body for POST, PUT, PATCH methods
|
|
2193
|
+
|
|
2173
2194
|
browser: Browser type to emulate
|
|
2174
2195
|
|
|
2175
2196
|
browser_actions: Array of browser automation actions to execute sequentially
|
|
@@ -2247,6 +2268,7 @@ class Nimble(SyncAPIClient):
|
|
|
2247
2268
|
body=maybe_transform(
|
|
2248
2269
|
{
|
|
2249
2270
|
"url": url,
|
|
2271
|
+
"body": body,
|
|
2250
2272
|
"browser": browser,
|
|
2251
2273
|
"browser_actions": browser_actions,
|
|
2252
2274
|
"callback_url": callback_url,
|
|
@@ -3186,6 +3208,7 @@ class Nimble(SyncAPIClient):
|
|
|
3186
3208
|
query: str,
|
|
3187
3209
|
content_type: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
3188
3210
|
country: str | Omit = omit,
|
|
3211
|
+
debug_params: Optional[Dict[str, object]] | Omit = omit,
|
|
3189
3212
|
deep_search: Optional[bool] | Omit = omit,
|
|
3190
3213
|
end_date: Optional[str] | Omit = omit,
|
|
3191
3214
|
exclude_domains: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
@@ -3218,6 +3241,8 @@ class Nimble(SyncAPIClient):
|
|
|
3218
3241
|
|
|
3219
3242
|
country: Country code for geo-targeted results (e.g., 'US', 'GB', 'IL')
|
|
3220
3243
|
|
|
3244
|
+
debug_params: Internal-only. Gated to allowlisted accounts; ignored otherwise.
|
|
3245
|
+
|
|
3221
3246
|
deep_search: Deprecated. Use search_depth instead. true maps to 'deep', false maps to 'lite'.
|
|
3222
3247
|
|
|
3223
3248
|
end_date: Filter results before this date (format: YYYY-MM-DD or YYYY)
|
|
@@ -3267,6 +3292,7 @@ class Nimble(SyncAPIClient):
|
|
|
3267
3292
|
"query": query,
|
|
3268
3293
|
"content_type": content_type,
|
|
3269
3294
|
"country": country,
|
|
3295
|
+
"debug_params": debug_params,
|
|
3270
3296
|
"deep_search": deep_search,
|
|
3271
3297
|
"end_date": end_date,
|
|
3272
3298
|
"exclude_domains": exclude_domains,
|
|
@@ -3433,6 +3459,18 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
3433
3459
|
|
|
3434
3460
|
return AsyncSerpResource(self)
|
|
3435
3461
|
|
|
3462
|
+
@cached_property
|
|
3463
|
+
def task_agent(self) -> AsyncTaskAgentResource:
|
|
3464
|
+
from .resources.task_agent import AsyncTaskAgentResource
|
|
3465
|
+
|
|
3466
|
+
return AsyncTaskAgentResource(self)
|
|
3467
|
+
|
|
3468
|
+
@cached_property
|
|
3469
|
+
def jobs(self) -> AsyncJobsResource:
|
|
3470
|
+
from .resources.jobs import AsyncJobsResource
|
|
3471
|
+
|
|
3472
|
+
return AsyncJobsResource(self)
|
|
3473
|
+
|
|
3436
3474
|
@cached_property
|
|
3437
3475
|
def with_raw_response(self) -> AsyncNimbleWithRawResponse:
|
|
3438
3476
|
return AsyncNimbleWithRawResponse(self)
|
|
@@ -3530,6 +3568,7 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
3530
3568
|
self,
|
|
3531
3569
|
*,
|
|
3532
3570
|
url: str,
|
|
3571
|
+
body: object | Omit = omit,
|
|
3533
3572
|
browser: client_extract_params.Browser | Omit = omit,
|
|
3534
3573
|
browser_actions: Iterable[client_extract_params.BrowserAction] | Omit = omit,
|
|
3535
3574
|
city: str | Omit = omit,
|
|
@@ -4342,7 +4381,7 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
4342
4381
|
"random", "no-referer", "same-origin", "google", "bing", "facebook", "twitter", "instagram"
|
|
4343
4382
|
]
|
|
4344
4383
|
| Omit = omit,
|
|
4345
|
-
render: bool | Omit = omit,
|
|
4384
|
+
render: Union[bool, Literal["auto"]] | Omit = omit,
|
|
4346
4385
|
request_timeout: float | Omit = omit,
|
|
4347
4386
|
session: client_extract_params.Session | Omit = omit,
|
|
4348
4387
|
skill: Union[str, SequenceNotStr[str]] | Omit = omit,
|
|
@@ -4419,6 +4458,8 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
4419
4458
|
Args:
|
|
4420
4459
|
url: Target URL to scrape
|
|
4421
4460
|
|
|
4461
|
+
body: Request body for POST, PUT, PATCH methods
|
|
4462
|
+
|
|
4422
4463
|
browser: Browser type to emulate
|
|
4423
4464
|
|
|
4424
4465
|
browser_actions: Array of browser automation actions to execute sequentially
|
|
@@ -4486,6 +4527,7 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
4486
4527
|
body=await async_maybe_transform(
|
|
4487
4528
|
{
|
|
4488
4529
|
"url": url,
|
|
4530
|
+
"body": body,
|
|
4489
4531
|
"browser": browser,
|
|
4490
4532
|
"browser_actions": browser_actions,
|
|
4491
4533
|
"city": city,
|
|
@@ -4526,6 +4568,7 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
4526
4568
|
self,
|
|
4527
4569
|
*,
|
|
4528
4570
|
url: str,
|
|
4571
|
+
body: object | Omit = omit,
|
|
4529
4572
|
browser: client_extract_async_params.Browser | Omit = omit,
|
|
4530
4573
|
browser_actions: Iterable[client_extract_async_params.BrowserAction] | Omit = omit,
|
|
4531
4574
|
callback_url: str | Omit = omit,
|
|
@@ -5339,7 +5382,7 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
5339
5382
|
"random", "no-referer", "same-origin", "google", "bing", "facebook", "twitter", "instagram"
|
|
5340
5383
|
]
|
|
5341
5384
|
| Omit = omit,
|
|
5342
|
-
render: bool | Omit = omit,
|
|
5385
|
+
render: Union[bool, Literal["auto"]] | Omit = omit,
|
|
5343
5386
|
request_timeout: float | Omit = omit,
|
|
5344
5387
|
session: client_extract_async_params.Session | Omit = omit,
|
|
5345
5388
|
skill: Union[str, SequenceNotStr[str]] | Omit = omit,
|
|
@@ -5420,6 +5463,8 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
5420
5463
|
Args:
|
|
5421
5464
|
url: Target URL to scrape
|
|
5422
5465
|
|
|
5466
|
+
body: Request body for POST, PUT, PATCH methods
|
|
5467
|
+
|
|
5423
5468
|
browser: Browser type to emulate
|
|
5424
5469
|
|
|
5425
5470
|
browser_actions: Array of browser automation actions to execute sequentially
|
|
@@ -5497,6 +5542,7 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
5497
5542
|
body=await async_maybe_transform(
|
|
5498
5543
|
{
|
|
5499
5544
|
"url": url,
|
|
5545
|
+
"body": body,
|
|
5500
5546
|
"browser": browser,
|
|
5501
5547
|
"browser_actions": browser_actions,
|
|
5502
5548
|
"callback_url": callback_url,
|
|
@@ -6436,6 +6482,7 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
6436
6482
|
query: str,
|
|
6437
6483
|
content_type: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
6438
6484
|
country: str | Omit = omit,
|
|
6485
|
+
debug_params: Optional[Dict[str, object]] | Omit = omit,
|
|
6439
6486
|
deep_search: Optional[bool] | Omit = omit,
|
|
6440
6487
|
end_date: Optional[str] | Omit = omit,
|
|
6441
6488
|
exclude_domains: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
@@ -6468,6 +6515,8 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
6468
6515
|
|
|
6469
6516
|
country: Country code for geo-targeted results (e.g., 'US', 'GB', 'IL')
|
|
6470
6517
|
|
|
6518
|
+
debug_params: Internal-only. Gated to allowlisted accounts; ignored otherwise.
|
|
6519
|
+
|
|
6471
6520
|
deep_search: Deprecated. Use search_depth instead. true maps to 'deep', false maps to 'lite'.
|
|
6472
6521
|
|
|
6473
6522
|
end_date: Filter results before this date (format: YYYY-MM-DD or YYYY)
|
|
@@ -6517,6 +6566,7 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
6517
6566
|
"query": query,
|
|
6518
6567
|
"content_type": content_type,
|
|
6519
6568
|
"country": country,
|
|
6569
|
+
"debug_params": debug_params,
|
|
6520
6570
|
"deep_search": deep_search,
|
|
6521
6571
|
"end_date": end_date,
|
|
6522
6572
|
"exclude_domains": exclude_domains,
|
|
@@ -6637,6 +6687,18 @@ class NimbleWithRawResponse:
|
|
|
6637
6687
|
|
|
6638
6688
|
return SerpResourceWithRawResponse(self._client.serp)
|
|
6639
6689
|
|
|
6690
|
+
@cached_property
|
|
6691
|
+
def task_agent(self) -> task_agent.TaskAgentResourceWithRawResponse:
|
|
6692
|
+
from .resources.task_agent import TaskAgentResourceWithRawResponse
|
|
6693
|
+
|
|
6694
|
+
return TaskAgentResourceWithRawResponse(self._client.task_agent)
|
|
6695
|
+
|
|
6696
|
+
@cached_property
|
|
6697
|
+
def jobs(self) -> jobs.JobsResourceWithRawResponse:
|
|
6698
|
+
from .resources.jobs import JobsResourceWithRawResponse
|
|
6699
|
+
|
|
6700
|
+
return JobsResourceWithRawResponse(self._client.jobs)
|
|
6701
|
+
|
|
6640
6702
|
|
|
6641
6703
|
class AsyncNimbleWithRawResponse:
|
|
6642
6704
|
_client: AsyncNimble
|
|
@@ -6702,6 +6764,18 @@ class AsyncNimbleWithRawResponse:
|
|
|
6702
6764
|
|
|
6703
6765
|
return AsyncSerpResourceWithRawResponse(self._client.serp)
|
|
6704
6766
|
|
|
6767
|
+
@cached_property
|
|
6768
|
+
def task_agent(self) -> task_agent.AsyncTaskAgentResourceWithRawResponse:
|
|
6769
|
+
from .resources.task_agent import AsyncTaskAgentResourceWithRawResponse
|
|
6770
|
+
|
|
6771
|
+
return AsyncTaskAgentResourceWithRawResponse(self._client.task_agent)
|
|
6772
|
+
|
|
6773
|
+
@cached_property
|
|
6774
|
+
def jobs(self) -> jobs.AsyncJobsResourceWithRawResponse:
|
|
6775
|
+
from .resources.jobs import AsyncJobsResourceWithRawResponse
|
|
6776
|
+
|
|
6777
|
+
return AsyncJobsResourceWithRawResponse(self._client.jobs)
|
|
6778
|
+
|
|
6705
6779
|
|
|
6706
6780
|
class NimbleWithStreamedResponse:
|
|
6707
6781
|
_client: Nimble
|
|
@@ -6767,6 +6841,18 @@ class NimbleWithStreamedResponse:
|
|
|
6767
6841
|
|
|
6768
6842
|
return SerpResourceWithStreamingResponse(self._client.serp)
|
|
6769
6843
|
|
|
6844
|
+
@cached_property
|
|
6845
|
+
def task_agent(self) -> task_agent.TaskAgentResourceWithStreamingResponse:
|
|
6846
|
+
from .resources.task_agent import TaskAgentResourceWithStreamingResponse
|
|
6847
|
+
|
|
6848
|
+
return TaskAgentResourceWithStreamingResponse(self._client.task_agent)
|
|
6849
|
+
|
|
6850
|
+
@cached_property
|
|
6851
|
+
def jobs(self) -> jobs.JobsResourceWithStreamingResponse:
|
|
6852
|
+
from .resources.jobs import JobsResourceWithStreamingResponse
|
|
6853
|
+
|
|
6854
|
+
return JobsResourceWithStreamingResponse(self._client.jobs)
|
|
6855
|
+
|
|
6770
6856
|
|
|
6771
6857
|
class AsyncNimbleWithStreamedResponse:
|
|
6772
6858
|
_client: AsyncNimble
|
|
@@ -6832,6 +6918,18 @@ class AsyncNimbleWithStreamedResponse:
|
|
|
6832
6918
|
|
|
6833
6919
|
return AsyncSerpResourceWithStreamingResponse(self._client.serp)
|
|
6834
6920
|
|
|
6921
|
+
@cached_property
|
|
6922
|
+
def task_agent(self) -> task_agent.AsyncTaskAgentResourceWithStreamingResponse:
|
|
6923
|
+
from .resources.task_agent import AsyncTaskAgentResourceWithStreamingResponse
|
|
6924
|
+
|
|
6925
|
+
return AsyncTaskAgentResourceWithStreamingResponse(self._client.task_agent)
|
|
6926
|
+
|
|
6927
|
+
@cached_property
|
|
6928
|
+
def jobs(self) -> jobs.AsyncJobsResourceWithStreamingResponse:
|
|
6929
|
+
from .resources.jobs import AsyncJobsResourceWithStreamingResponse
|
|
6930
|
+
|
|
6931
|
+
return AsyncJobsResourceWithStreamingResponse(self._client.jobs)
|
|
6932
|
+
|
|
6835
6933
|
|
|
6836
6934
|
Client = Nimble
|
|
6837
6935
|
|
nimble_python/_models.py
CHANGED
|
@@ -25,7 +25,9 @@ from typing_extensions import (
|
|
|
25
25
|
ClassVar,
|
|
26
26
|
Protocol,
|
|
27
27
|
Required,
|
|
28
|
+
Annotated,
|
|
28
29
|
ParamSpec,
|
|
30
|
+
TypeAlias,
|
|
29
31
|
TypedDict,
|
|
30
32
|
TypeGuard,
|
|
31
33
|
final,
|
|
@@ -79,7 +81,15 @@ from ._compat import (
|
|
|
79
81
|
from ._constants import RAW_RESPONSE_HEADER
|
|
80
82
|
|
|
81
83
|
if TYPE_CHECKING:
|
|
84
|
+
from pydantic import GetCoreSchemaHandler, ValidatorFunctionWrapHandler
|
|
85
|
+
from pydantic_core import CoreSchema, core_schema
|
|
82
86
|
from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema
|
|
87
|
+
else:
|
|
88
|
+
try:
|
|
89
|
+
from pydantic_core import CoreSchema, core_schema
|
|
90
|
+
except ImportError:
|
|
91
|
+
CoreSchema = None
|
|
92
|
+
core_schema = None
|
|
83
93
|
|
|
84
94
|
__all__ = ["BaseModel", "GenericModel"]
|
|
85
95
|
|
|
@@ -396,6 +406,76 @@ class BaseModel(pydantic.BaseModel):
|
|
|
396
406
|
)
|
|
397
407
|
|
|
398
408
|
|
|
409
|
+
class _EagerIterable(list[_T], Generic[_T]):
|
|
410
|
+
"""
|
|
411
|
+
Accepts any Iterable[T] input (including generators), consumes it
|
|
412
|
+
eagerly, and validates all items upfront.
|
|
413
|
+
|
|
414
|
+
Validation preserves the original container type where possible
|
|
415
|
+
(e.g. a set[T] stays a set[T]). Serialization (model_dump / JSON)
|
|
416
|
+
always emits a list — round-tripping through model_dump() will not
|
|
417
|
+
restore the original container type.
|
|
418
|
+
"""
|
|
419
|
+
|
|
420
|
+
@classmethod
|
|
421
|
+
def __get_pydantic_core_schema__(
|
|
422
|
+
cls,
|
|
423
|
+
source_type: Any,
|
|
424
|
+
handler: GetCoreSchemaHandler,
|
|
425
|
+
) -> CoreSchema:
|
|
426
|
+
(item_type,) = get_args(source_type) or (Any,)
|
|
427
|
+
item_schema: CoreSchema = handler.generate_schema(item_type)
|
|
428
|
+
list_of_items_schema: CoreSchema = core_schema.list_schema(item_schema)
|
|
429
|
+
|
|
430
|
+
return core_schema.no_info_wrap_validator_function(
|
|
431
|
+
cls._validate,
|
|
432
|
+
list_of_items_schema,
|
|
433
|
+
serialization=core_schema.plain_serializer_function_ser_schema(
|
|
434
|
+
cls._serialize,
|
|
435
|
+
info_arg=False,
|
|
436
|
+
),
|
|
437
|
+
)
|
|
438
|
+
|
|
439
|
+
@staticmethod
|
|
440
|
+
def _validate(v: Iterable[_T], handler: "ValidatorFunctionWrapHandler") -> Any:
|
|
441
|
+
original_type: type[Any] = type(v)
|
|
442
|
+
|
|
443
|
+
# Normalize to list so list_schema can validate each item
|
|
444
|
+
if isinstance(v, list):
|
|
445
|
+
items: list[_T] = v
|
|
446
|
+
else:
|
|
447
|
+
try:
|
|
448
|
+
items = list(v)
|
|
449
|
+
except TypeError as e:
|
|
450
|
+
raise TypeError("Value is not iterable") from e
|
|
451
|
+
|
|
452
|
+
# Validate items against the inner schema
|
|
453
|
+
validated: list[_T] = handler(items)
|
|
454
|
+
|
|
455
|
+
# Reconstruct original container type
|
|
456
|
+
if original_type is list:
|
|
457
|
+
return validated
|
|
458
|
+
# str(list) produces the list's repr, not a string built from items,
|
|
459
|
+
# so skip reconstruction for str and its subclasses.
|
|
460
|
+
if issubclass(original_type, str):
|
|
461
|
+
return validated
|
|
462
|
+
try:
|
|
463
|
+
return original_type(validated)
|
|
464
|
+
except (TypeError, ValueError):
|
|
465
|
+
# If the type cannot be reconstructed, just return the validated list
|
|
466
|
+
return validated
|
|
467
|
+
|
|
468
|
+
@staticmethod
|
|
469
|
+
def _serialize(v: Iterable[_T]) -> list[_T]:
|
|
470
|
+
"""Always serialize as a list so Pydantic's JSON encoder is happy."""
|
|
471
|
+
if isinstance(v, list):
|
|
472
|
+
return v
|
|
473
|
+
return list(v)
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
EagerIterable: TypeAlias = Annotated[Iterable[_T], _EagerIterable]
|
|
477
|
+
|
|
478
|
+
|
|
399
479
|
def _construct_field(value: object, field: FieldInfo, key: str) -> object:
|
|
400
480
|
if value is None:
|
|
401
481
|
return field_get_default(field)
|
nimble_python/_version.py
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
+
from .jobs import (
|
|
4
|
+
JobsResource,
|
|
5
|
+
AsyncJobsResource,
|
|
6
|
+
JobsResourceWithRawResponse,
|
|
7
|
+
AsyncJobsResourceWithRawResponse,
|
|
8
|
+
JobsResourceWithStreamingResponse,
|
|
9
|
+
AsyncJobsResourceWithStreamingResponse,
|
|
10
|
+
)
|
|
3
11
|
from .serp import (
|
|
4
12
|
SerpResource,
|
|
5
13
|
AsyncSerpResource,
|
|
@@ -48,6 +56,14 @@ from .batches import (
|
|
|
48
56
|
BatchesResourceWithStreamingResponse,
|
|
49
57
|
AsyncBatchesResourceWithStreamingResponse,
|
|
50
58
|
)
|
|
59
|
+
from .task_agent import (
|
|
60
|
+
TaskAgentResource,
|
|
61
|
+
AsyncTaskAgentResource,
|
|
62
|
+
TaskAgentResourceWithRawResponse,
|
|
63
|
+
AsyncTaskAgentResourceWithRawResponse,
|
|
64
|
+
TaskAgentResourceWithStreamingResponse,
|
|
65
|
+
AsyncTaskAgentResourceWithStreamingResponse,
|
|
66
|
+
)
|
|
51
67
|
from .domain_knowledge import (
|
|
52
68
|
DomainKnowledgeResource,
|
|
53
69
|
AsyncDomainKnowledgeResource,
|
|
@@ -100,4 +116,16 @@ __all__ = [
|
|
|
100
116
|
"AsyncSerpResourceWithRawResponse",
|
|
101
117
|
"SerpResourceWithStreamingResponse",
|
|
102
118
|
"AsyncSerpResourceWithStreamingResponse",
|
|
119
|
+
"TaskAgentResource",
|
|
120
|
+
"AsyncTaskAgentResource",
|
|
121
|
+
"TaskAgentResourceWithRawResponse",
|
|
122
|
+
"AsyncTaskAgentResourceWithRawResponse",
|
|
123
|
+
"TaskAgentResourceWithStreamingResponse",
|
|
124
|
+
"AsyncTaskAgentResourceWithStreamingResponse",
|
|
125
|
+
"JobsResource",
|
|
126
|
+
"AsyncJobsResource",
|
|
127
|
+
"JobsResourceWithRawResponse",
|
|
128
|
+
"AsyncJobsResourceWithRawResponse",
|
|
129
|
+
"JobsResourceWithStreamingResponse",
|
|
130
|
+
"AsyncJobsResourceWithStreamingResponse",
|
|
103
131
|
]
|
nimble_python/resources/agent.py
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
import typing_extensions
|
|
6
5
|
from typing import Dict, List, Iterable, Optional
|
|
7
6
|
from typing_extensions import Literal, overload
|
|
8
7
|
|
|
@@ -11,7 +10,6 @@ import httpx
|
|
|
11
10
|
from ..types import (
|
|
12
11
|
agent_run_params,
|
|
13
12
|
agent_list_params,
|
|
14
|
-
agent_publish_params,
|
|
15
13
|
agent_generate_params,
|
|
16
14
|
agent_run_async_params,
|
|
17
15
|
agent_run_batch_params,
|
|
@@ -30,7 +28,6 @@ from .._base_client import make_request_options
|
|
|
30
28
|
from ..types.agent_get_response import AgentGetResponse
|
|
31
29
|
from ..types.agent_run_response import AgentRunResponse
|
|
32
30
|
from ..types.agent_list_response import AgentListResponse
|
|
33
|
-
from ..types.agent_publish_response import AgentPublishResponse
|
|
34
31
|
from ..types.agent_generate_response import AgentGenerateResponse
|
|
35
32
|
from ..types.agent_run_async_response import AgentRunAsyncResponse
|
|
36
33
|
from ..types.agent_run_batch_response import AgentRunBatchResponse
|
|
@@ -124,9 +121,9 @@ class AgentResource(SyncAPIResource):
|
|
|
124
121
|
prompt: str,
|
|
125
122
|
url: str,
|
|
126
123
|
agent_name: Optional[str] | Omit = omit,
|
|
127
|
-
input_schema: object | Omit = omit,
|
|
124
|
+
input_schema: Dict[str, object] | Omit = omit,
|
|
128
125
|
metadata: Optional[agent_generate_params.CreateAgentGenerationRequestMetadata] | Omit = omit,
|
|
129
|
-
output_schema: object | Omit = omit,
|
|
126
|
+
output_schema: Dict[str, object] | Omit = omit,
|
|
130
127
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
131
128
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
132
129
|
extra_headers: Headers | None = None,
|
|
@@ -182,9 +179,9 @@ class AgentResource(SyncAPIResource):
|
|
|
182
179
|
prompt: str,
|
|
183
180
|
url: str | Omit = omit,
|
|
184
181
|
agent_name: Optional[str] | Omit = omit,
|
|
185
|
-
input_schema: object | Omit = omit,
|
|
182
|
+
input_schema: Dict[str, object] | Omit = omit,
|
|
186
183
|
metadata: Optional[agent_generate_params.CreateAgentGenerationRequestMetadata] | Omit = omit,
|
|
187
|
-
output_schema: object | Omit = omit,
|
|
184
|
+
output_schema: Dict[str, object] | Omit = omit,
|
|
188
185
|
from_agent: str | Omit = omit,
|
|
189
186
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
190
187
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -279,42 +276,6 @@ class AgentResource(SyncAPIResource):
|
|
|
279
276
|
cast_to=AgentGetGenerationResponse,
|
|
280
277
|
)
|
|
281
278
|
|
|
282
|
-
@typing_extensions.deprecated("deprecated")
|
|
283
|
-
def publish(
|
|
284
|
-
self,
|
|
285
|
-
agent_name: str,
|
|
286
|
-
*,
|
|
287
|
-
version_id: str,
|
|
288
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
289
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
290
|
-
extra_headers: Headers | None = None,
|
|
291
|
-
extra_query: Query | None = None,
|
|
292
|
-
extra_body: Body | None = None,
|
|
293
|
-
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
294
|
-
) -> AgentPublishResponse:
|
|
295
|
-
"""
|
|
296
|
-
Publish Agent Version
|
|
297
|
-
|
|
298
|
-
Args:
|
|
299
|
-
extra_headers: Send extra headers
|
|
300
|
-
|
|
301
|
-
extra_query: Add additional query parameters to the request
|
|
302
|
-
|
|
303
|
-
extra_body: Add additional JSON properties to the request
|
|
304
|
-
|
|
305
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
306
|
-
"""
|
|
307
|
-
if not agent_name:
|
|
308
|
-
raise ValueError(f"Expected a non-empty value for `agent_name` but received {agent_name!r}")
|
|
309
|
-
return self._post(
|
|
310
|
-
path_template("/v1/agents/{agent_name}/publish", agent_name=agent_name),
|
|
311
|
-
body=maybe_transform({"version_id": version_id}, agent_publish_params.AgentPublishParams),
|
|
312
|
-
options=make_request_options(
|
|
313
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
314
|
-
),
|
|
315
|
-
cast_to=AgentPublishResponse,
|
|
316
|
-
)
|
|
317
|
-
|
|
318
279
|
def run(
|
|
319
280
|
self,
|
|
320
281
|
*,
|
|
@@ -551,9 +512,9 @@ class AsyncAgentResource(AsyncAPIResource):
|
|
|
551
512
|
prompt: str,
|
|
552
513
|
url: str,
|
|
553
514
|
agent_name: Optional[str] | Omit = omit,
|
|
554
|
-
input_schema: object | Omit = omit,
|
|
515
|
+
input_schema: Dict[str, object] | Omit = omit,
|
|
555
516
|
metadata: Optional[agent_generate_params.CreateAgentGenerationRequestMetadata] | Omit = omit,
|
|
556
|
-
output_schema: object | Omit = omit,
|
|
517
|
+
output_schema: Dict[str, object] | Omit = omit,
|
|
557
518
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
558
519
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
559
520
|
extra_headers: Headers | None = None,
|
|
@@ -609,9 +570,9 @@ class AsyncAgentResource(AsyncAPIResource):
|
|
|
609
570
|
prompt: str,
|
|
610
571
|
url: str | Omit = omit,
|
|
611
572
|
agent_name: Optional[str] | Omit = omit,
|
|
612
|
-
input_schema: object | Omit = omit,
|
|
573
|
+
input_schema: Dict[str, object] | Omit = omit,
|
|
613
574
|
metadata: Optional[agent_generate_params.CreateAgentGenerationRequestMetadata] | Omit = omit,
|
|
614
|
-
output_schema: object | Omit = omit,
|
|
575
|
+
output_schema: Dict[str, object] | Omit = omit,
|
|
615
576
|
from_agent: str | Omit = omit,
|
|
616
577
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
617
578
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -706,42 +667,6 @@ class AsyncAgentResource(AsyncAPIResource):
|
|
|
706
667
|
cast_to=AgentGetGenerationResponse,
|
|
707
668
|
)
|
|
708
669
|
|
|
709
|
-
@typing_extensions.deprecated("deprecated")
|
|
710
|
-
async def publish(
|
|
711
|
-
self,
|
|
712
|
-
agent_name: str,
|
|
713
|
-
*,
|
|
714
|
-
version_id: str,
|
|
715
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
716
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
717
|
-
extra_headers: Headers | None = None,
|
|
718
|
-
extra_query: Query | None = None,
|
|
719
|
-
extra_body: Body | None = None,
|
|
720
|
-
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
721
|
-
) -> AgentPublishResponse:
|
|
722
|
-
"""
|
|
723
|
-
Publish Agent Version
|
|
724
|
-
|
|
725
|
-
Args:
|
|
726
|
-
extra_headers: Send extra headers
|
|
727
|
-
|
|
728
|
-
extra_query: Add additional query parameters to the request
|
|
729
|
-
|
|
730
|
-
extra_body: Add additional JSON properties to the request
|
|
731
|
-
|
|
732
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
733
|
-
"""
|
|
734
|
-
if not agent_name:
|
|
735
|
-
raise ValueError(f"Expected a non-empty value for `agent_name` but received {agent_name!r}")
|
|
736
|
-
return await self._post(
|
|
737
|
-
path_template("/v1/agents/{agent_name}/publish", agent_name=agent_name),
|
|
738
|
-
body=await async_maybe_transform({"version_id": version_id}, agent_publish_params.AgentPublishParams),
|
|
739
|
-
options=make_request_options(
|
|
740
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
741
|
-
),
|
|
742
|
-
cast_to=AgentPublishResponse,
|
|
743
|
-
)
|
|
744
|
-
|
|
745
670
|
async def run(
|
|
746
671
|
self,
|
|
747
672
|
*,
|
|
@@ -909,11 +834,6 @@ class AgentResourceWithRawResponse:
|
|
|
909
834
|
self.get_generation = to_raw_response_wrapper(
|
|
910
835
|
agent.get_generation,
|
|
911
836
|
)
|
|
912
|
-
self.publish = ( # pyright: ignore[reportDeprecated]
|
|
913
|
-
to_raw_response_wrapper(
|
|
914
|
-
agent.publish, # pyright: ignore[reportDeprecated],
|
|
915
|
-
)
|
|
916
|
-
)
|
|
917
837
|
self.run = to_raw_response_wrapper(
|
|
918
838
|
agent.run,
|
|
919
839
|
)
|
|
@@ -941,11 +861,6 @@ class AsyncAgentResourceWithRawResponse:
|
|
|
941
861
|
self.get_generation = async_to_raw_response_wrapper(
|
|
942
862
|
agent.get_generation,
|
|
943
863
|
)
|
|
944
|
-
self.publish = ( # pyright: ignore[reportDeprecated]
|
|
945
|
-
async_to_raw_response_wrapper(
|
|
946
|
-
agent.publish, # pyright: ignore[reportDeprecated],
|
|
947
|
-
)
|
|
948
|
-
)
|
|
949
864
|
self.run = async_to_raw_response_wrapper(
|
|
950
865
|
agent.run,
|
|
951
866
|
)
|
|
@@ -973,11 +888,6 @@ class AgentResourceWithStreamingResponse:
|
|
|
973
888
|
self.get_generation = to_streamed_response_wrapper(
|
|
974
889
|
agent.get_generation,
|
|
975
890
|
)
|
|
976
|
-
self.publish = ( # pyright: ignore[reportDeprecated]
|
|
977
|
-
to_streamed_response_wrapper(
|
|
978
|
-
agent.publish, # pyright: ignore[reportDeprecated],
|
|
979
|
-
)
|
|
980
|
-
)
|
|
981
891
|
self.run = to_streamed_response_wrapper(
|
|
982
892
|
agent.run,
|
|
983
893
|
)
|
|
@@ -1005,11 +915,6 @@ class AsyncAgentResourceWithStreamingResponse:
|
|
|
1005
915
|
self.get_generation = async_to_streamed_response_wrapper(
|
|
1006
916
|
agent.get_generation,
|
|
1007
917
|
)
|
|
1008
|
-
self.publish = ( # pyright: ignore[reportDeprecated]
|
|
1009
|
-
async_to_streamed_response_wrapper(
|
|
1010
|
-
agent.publish, # pyright: ignore[reportDeprecated],
|
|
1011
|
-
)
|
|
1012
|
-
)
|
|
1013
918
|
self.run = async_to_streamed_response_wrapper(
|
|
1014
919
|
agent.run,
|
|
1015
920
|
)
|