nimble_python 0.18.0__py3-none-any.whl → 0.19.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 +62 -1
- nimble_python/_models.py +80 -0
- nimble_python/_version.py +1 -1
- nimble_python/resources/__init__.py +14 -0
- nimble_python/resources/agent.py +8 -103
- 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 +758 -0
- nimble_python/resources/task_agent/templates.py +272 -0
- nimble_python/types/__init__.py +9 -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 +3 -0
- nimble_python/types/client_extract_batch_params.py +6 -0
- nimble_python/types/client_extract_params.py +3 -0
- nimble_python/types/client_search_params.py +4 -1
- nimble_python/types/crawl_run_params.py +3 -0
- nimble_python/types/extract_async_response.py +1 -1
- nimble_python/types/extract_batch_response.py +1 -1
- 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 +52 -0
- nimble_python/types/task_agent_create_response.py +73 -0
- nimble_python/types/task_agent_get_response.py +73 -0
- nimble_python/types/task_agent_list_params.py +18 -0
- nimble_python/types/task_agent_list_response.py +82 -0
- nimble_python/types/task_agent_run_params.py +16 -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 +73 -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.19.0.dist-info}/METADATA +1 -1
- {nimble_python-0.18.0.dist-info → nimble_python-0.19.0.dist-info}/RECORD +55 -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.19.0.dist-info}/WHEEL +0 -0
- {nimble_python-0.18.0.dist-info → nimble_python-0.19.0.dist-info}/licenses/LICENSE +0 -0
nimble_python/_client.py
CHANGED
|
@@ -61,7 +61,7 @@ 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 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
|
|
@@ -69,6 +69,7 @@ if TYPE_CHECKING:
|
|
|
69
69
|
from .resources.tasks import TasksResource, AsyncTasksResource
|
|
70
70
|
from .resources.batches import BatchesResource, AsyncBatchesResource
|
|
71
71
|
from .resources.domain_knowledge import DomainKnowledgeResource, AsyncDomainKnowledgeResource
|
|
72
|
+
from .resources.task_agent.task_agent import TaskAgentResource, AsyncTaskAgentResource
|
|
72
73
|
|
|
73
74
|
__all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Nimble", "AsyncNimble", "Client", "AsyncClient"]
|
|
74
75
|
|
|
@@ -183,6 +184,12 @@ class Nimble(SyncAPIClient):
|
|
|
183
184
|
|
|
184
185
|
return SerpResource(self)
|
|
185
186
|
|
|
187
|
+
@cached_property
|
|
188
|
+
def task_agent(self) -> TaskAgentResource:
|
|
189
|
+
from .resources.task_agent import TaskAgentResource
|
|
190
|
+
|
|
191
|
+
return TaskAgentResource(self)
|
|
192
|
+
|
|
186
193
|
@cached_property
|
|
187
194
|
def with_raw_response(self) -> NimbleWithRawResponse:
|
|
188
195
|
return NimbleWithRawResponse(self)
|
|
@@ -280,6 +287,7 @@ class Nimble(SyncAPIClient):
|
|
|
280
287
|
self,
|
|
281
288
|
*,
|
|
282
289
|
url: str,
|
|
290
|
+
body: object | Omit = omit,
|
|
283
291
|
browser: client_extract_params.Browser | Omit = omit,
|
|
284
292
|
browser_actions: Iterable[client_extract_params.BrowserAction] | Omit = omit,
|
|
285
293
|
city: str | Omit = omit,
|
|
@@ -1169,6 +1177,8 @@ class Nimble(SyncAPIClient):
|
|
|
1169
1177
|
Args:
|
|
1170
1178
|
url: Target URL to scrape
|
|
1171
1179
|
|
|
1180
|
+
body: Request body for POST, PUT, PATCH methods
|
|
1181
|
+
|
|
1172
1182
|
browser: Browser type to emulate
|
|
1173
1183
|
|
|
1174
1184
|
browser_actions: Array of browser automation actions to execute sequentially
|
|
@@ -1236,6 +1246,7 @@ class Nimble(SyncAPIClient):
|
|
|
1236
1246
|
body=maybe_transform(
|
|
1237
1247
|
{
|
|
1238
1248
|
"url": url,
|
|
1249
|
+
"body": body,
|
|
1239
1250
|
"browser": browser,
|
|
1240
1251
|
"browser_actions": browser_actions,
|
|
1241
1252
|
"city": city,
|
|
@@ -1276,6 +1287,7 @@ class Nimble(SyncAPIClient):
|
|
|
1276
1287
|
self,
|
|
1277
1288
|
*,
|
|
1278
1289
|
url: str,
|
|
1290
|
+
body: object | Omit = omit,
|
|
1279
1291
|
browser: client_extract_async_params.Browser | Omit = omit,
|
|
1280
1292
|
browser_actions: Iterable[client_extract_async_params.BrowserAction] | Omit = omit,
|
|
1281
1293
|
callback_url: str | Omit = omit,
|
|
@@ -2170,6 +2182,8 @@ class Nimble(SyncAPIClient):
|
|
|
2170
2182
|
Args:
|
|
2171
2183
|
url: Target URL to scrape
|
|
2172
2184
|
|
|
2185
|
+
body: Request body for POST, PUT, PATCH methods
|
|
2186
|
+
|
|
2173
2187
|
browser: Browser type to emulate
|
|
2174
2188
|
|
|
2175
2189
|
browser_actions: Array of browser automation actions to execute sequentially
|
|
@@ -2247,6 +2261,7 @@ class Nimble(SyncAPIClient):
|
|
|
2247
2261
|
body=maybe_transform(
|
|
2248
2262
|
{
|
|
2249
2263
|
"url": url,
|
|
2264
|
+
"body": body,
|
|
2250
2265
|
"browser": browser,
|
|
2251
2266
|
"browser_actions": browser_actions,
|
|
2252
2267
|
"callback_url": callback_url,
|
|
@@ -3186,6 +3201,7 @@ class Nimble(SyncAPIClient):
|
|
|
3186
3201
|
query: str,
|
|
3187
3202
|
content_type: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
3188
3203
|
country: str | Omit = omit,
|
|
3204
|
+
debug_params: Optional[Dict[str, object]] | Omit = omit,
|
|
3189
3205
|
deep_search: Optional[bool] | Omit = omit,
|
|
3190
3206
|
end_date: Optional[str] | Omit = omit,
|
|
3191
3207
|
exclude_domains: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
@@ -3218,6 +3234,8 @@ class Nimble(SyncAPIClient):
|
|
|
3218
3234
|
|
|
3219
3235
|
country: Country code for geo-targeted results (e.g., 'US', 'GB', 'IL')
|
|
3220
3236
|
|
|
3237
|
+
debug_params: Internal-only. Gated to allowlisted accounts; ignored otherwise.
|
|
3238
|
+
|
|
3221
3239
|
deep_search: Deprecated. Use search_depth instead. true maps to 'deep', false maps to 'lite'.
|
|
3222
3240
|
|
|
3223
3241
|
end_date: Filter results before this date (format: YYYY-MM-DD or YYYY)
|
|
@@ -3267,6 +3285,7 @@ class Nimble(SyncAPIClient):
|
|
|
3267
3285
|
"query": query,
|
|
3268
3286
|
"content_type": content_type,
|
|
3269
3287
|
"country": country,
|
|
3288
|
+
"debug_params": debug_params,
|
|
3270
3289
|
"deep_search": deep_search,
|
|
3271
3290
|
"end_date": end_date,
|
|
3272
3291
|
"exclude_domains": exclude_domains,
|
|
@@ -3433,6 +3452,12 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
3433
3452
|
|
|
3434
3453
|
return AsyncSerpResource(self)
|
|
3435
3454
|
|
|
3455
|
+
@cached_property
|
|
3456
|
+
def task_agent(self) -> AsyncTaskAgentResource:
|
|
3457
|
+
from .resources.task_agent import AsyncTaskAgentResource
|
|
3458
|
+
|
|
3459
|
+
return AsyncTaskAgentResource(self)
|
|
3460
|
+
|
|
3436
3461
|
@cached_property
|
|
3437
3462
|
def with_raw_response(self) -> AsyncNimbleWithRawResponse:
|
|
3438
3463
|
return AsyncNimbleWithRawResponse(self)
|
|
@@ -3530,6 +3555,7 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
3530
3555
|
self,
|
|
3531
3556
|
*,
|
|
3532
3557
|
url: str,
|
|
3558
|
+
body: object | Omit = omit,
|
|
3533
3559
|
browser: client_extract_params.Browser | Omit = omit,
|
|
3534
3560
|
browser_actions: Iterable[client_extract_params.BrowserAction] | Omit = omit,
|
|
3535
3561
|
city: str | Omit = omit,
|
|
@@ -4419,6 +4445,8 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
4419
4445
|
Args:
|
|
4420
4446
|
url: Target URL to scrape
|
|
4421
4447
|
|
|
4448
|
+
body: Request body for POST, PUT, PATCH methods
|
|
4449
|
+
|
|
4422
4450
|
browser: Browser type to emulate
|
|
4423
4451
|
|
|
4424
4452
|
browser_actions: Array of browser automation actions to execute sequentially
|
|
@@ -4486,6 +4514,7 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
4486
4514
|
body=await async_maybe_transform(
|
|
4487
4515
|
{
|
|
4488
4516
|
"url": url,
|
|
4517
|
+
"body": body,
|
|
4489
4518
|
"browser": browser,
|
|
4490
4519
|
"browser_actions": browser_actions,
|
|
4491
4520
|
"city": city,
|
|
@@ -4526,6 +4555,7 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
4526
4555
|
self,
|
|
4527
4556
|
*,
|
|
4528
4557
|
url: str,
|
|
4558
|
+
body: object | Omit = omit,
|
|
4529
4559
|
browser: client_extract_async_params.Browser | Omit = omit,
|
|
4530
4560
|
browser_actions: Iterable[client_extract_async_params.BrowserAction] | Omit = omit,
|
|
4531
4561
|
callback_url: str | Omit = omit,
|
|
@@ -5420,6 +5450,8 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
5420
5450
|
Args:
|
|
5421
5451
|
url: Target URL to scrape
|
|
5422
5452
|
|
|
5453
|
+
body: Request body for POST, PUT, PATCH methods
|
|
5454
|
+
|
|
5423
5455
|
browser: Browser type to emulate
|
|
5424
5456
|
|
|
5425
5457
|
browser_actions: Array of browser automation actions to execute sequentially
|
|
@@ -5497,6 +5529,7 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
5497
5529
|
body=await async_maybe_transform(
|
|
5498
5530
|
{
|
|
5499
5531
|
"url": url,
|
|
5532
|
+
"body": body,
|
|
5500
5533
|
"browser": browser,
|
|
5501
5534
|
"browser_actions": browser_actions,
|
|
5502
5535
|
"callback_url": callback_url,
|
|
@@ -6436,6 +6469,7 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
6436
6469
|
query: str,
|
|
6437
6470
|
content_type: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
6438
6471
|
country: str | Omit = omit,
|
|
6472
|
+
debug_params: Optional[Dict[str, object]] | Omit = omit,
|
|
6439
6473
|
deep_search: Optional[bool] | Omit = omit,
|
|
6440
6474
|
end_date: Optional[str] | Omit = omit,
|
|
6441
6475
|
exclude_domains: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
@@ -6468,6 +6502,8 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
6468
6502
|
|
|
6469
6503
|
country: Country code for geo-targeted results (e.g., 'US', 'GB', 'IL')
|
|
6470
6504
|
|
|
6505
|
+
debug_params: Internal-only. Gated to allowlisted accounts; ignored otherwise.
|
|
6506
|
+
|
|
6471
6507
|
deep_search: Deprecated. Use search_depth instead. true maps to 'deep', false maps to 'lite'.
|
|
6472
6508
|
|
|
6473
6509
|
end_date: Filter results before this date (format: YYYY-MM-DD or YYYY)
|
|
@@ -6517,6 +6553,7 @@ class AsyncNimble(AsyncAPIClient):
|
|
|
6517
6553
|
"query": query,
|
|
6518
6554
|
"content_type": content_type,
|
|
6519
6555
|
"country": country,
|
|
6556
|
+
"debug_params": debug_params,
|
|
6520
6557
|
"deep_search": deep_search,
|
|
6521
6558
|
"end_date": end_date,
|
|
6522
6559
|
"exclude_domains": exclude_domains,
|
|
@@ -6637,6 +6674,12 @@ class NimbleWithRawResponse:
|
|
|
6637
6674
|
|
|
6638
6675
|
return SerpResourceWithRawResponse(self._client.serp)
|
|
6639
6676
|
|
|
6677
|
+
@cached_property
|
|
6678
|
+
def task_agent(self) -> task_agent.TaskAgentResourceWithRawResponse:
|
|
6679
|
+
from .resources.task_agent import TaskAgentResourceWithRawResponse
|
|
6680
|
+
|
|
6681
|
+
return TaskAgentResourceWithRawResponse(self._client.task_agent)
|
|
6682
|
+
|
|
6640
6683
|
|
|
6641
6684
|
class AsyncNimbleWithRawResponse:
|
|
6642
6685
|
_client: AsyncNimble
|
|
@@ -6702,6 +6745,12 @@ class AsyncNimbleWithRawResponse:
|
|
|
6702
6745
|
|
|
6703
6746
|
return AsyncSerpResourceWithRawResponse(self._client.serp)
|
|
6704
6747
|
|
|
6748
|
+
@cached_property
|
|
6749
|
+
def task_agent(self) -> task_agent.AsyncTaskAgentResourceWithRawResponse:
|
|
6750
|
+
from .resources.task_agent import AsyncTaskAgentResourceWithRawResponse
|
|
6751
|
+
|
|
6752
|
+
return AsyncTaskAgentResourceWithRawResponse(self._client.task_agent)
|
|
6753
|
+
|
|
6705
6754
|
|
|
6706
6755
|
class NimbleWithStreamedResponse:
|
|
6707
6756
|
_client: Nimble
|
|
@@ -6767,6 +6816,12 @@ class NimbleWithStreamedResponse:
|
|
|
6767
6816
|
|
|
6768
6817
|
return SerpResourceWithStreamingResponse(self._client.serp)
|
|
6769
6818
|
|
|
6819
|
+
@cached_property
|
|
6820
|
+
def task_agent(self) -> task_agent.TaskAgentResourceWithStreamingResponse:
|
|
6821
|
+
from .resources.task_agent import TaskAgentResourceWithStreamingResponse
|
|
6822
|
+
|
|
6823
|
+
return TaskAgentResourceWithStreamingResponse(self._client.task_agent)
|
|
6824
|
+
|
|
6770
6825
|
|
|
6771
6826
|
class AsyncNimbleWithStreamedResponse:
|
|
6772
6827
|
_client: AsyncNimble
|
|
@@ -6832,6 +6887,12 @@ class AsyncNimbleWithStreamedResponse:
|
|
|
6832
6887
|
|
|
6833
6888
|
return AsyncSerpResourceWithStreamingResponse(self._client.serp)
|
|
6834
6889
|
|
|
6890
|
+
@cached_property
|
|
6891
|
+
def task_agent(self) -> task_agent.AsyncTaskAgentResourceWithStreamingResponse:
|
|
6892
|
+
from .resources.task_agent import AsyncTaskAgentResourceWithStreamingResponse
|
|
6893
|
+
|
|
6894
|
+
return AsyncTaskAgentResourceWithStreamingResponse(self._client.task_agent)
|
|
6895
|
+
|
|
6835
6896
|
|
|
6836
6897
|
Client = Nimble
|
|
6837
6898
|
|
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
|
@@ -48,6 +48,14 @@ from .batches import (
|
|
|
48
48
|
BatchesResourceWithStreamingResponse,
|
|
49
49
|
AsyncBatchesResourceWithStreamingResponse,
|
|
50
50
|
)
|
|
51
|
+
from .task_agent import (
|
|
52
|
+
TaskAgentResource,
|
|
53
|
+
AsyncTaskAgentResource,
|
|
54
|
+
TaskAgentResourceWithRawResponse,
|
|
55
|
+
AsyncTaskAgentResourceWithRawResponse,
|
|
56
|
+
TaskAgentResourceWithStreamingResponse,
|
|
57
|
+
AsyncTaskAgentResourceWithStreamingResponse,
|
|
58
|
+
)
|
|
51
59
|
from .domain_knowledge import (
|
|
52
60
|
DomainKnowledgeResource,
|
|
53
61
|
AsyncDomainKnowledgeResource,
|
|
@@ -100,4 +108,10 @@ __all__ = [
|
|
|
100
108
|
"AsyncSerpResourceWithRawResponse",
|
|
101
109
|
"SerpResourceWithStreamingResponse",
|
|
102
110
|
"AsyncSerpResourceWithStreamingResponse",
|
|
111
|
+
"TaskAgentResource",
|
|
112
|
+
"AsyncTaskAgentResource",
|
|
113
|
+
"TaskAgentResourceWithRawResponse",
|
|
114
|
+
"AsyncTaskAgentResourceWithRawResponse",
|
|
115
|
+
"TaskAgentResourceWithStreamingResponse",
|
|
116
|
+
"AsyncTaskAgentResourceWithStreamingResponse",
|
|
103
117
|
]
|
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
|
)
|
nimble_python/resources/serp.py
CHANGED
|
@@ -71,6 +71,7 @@ class SerpResource(SyncAPIResource):
|
|
|
71
71
|
parse: bool | Omit = omit,
|
|
72
72
|
query: str | Omit = omit,
|
|
73
73
|
render: bool | Omit = omit,
|
|
74
|
+
show_hidden_results: bool | Omit = omit,
|
|
74
75
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
75
76
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
76
77
|
extra_headers: Headers | None = None,
|
|
@@ -105,6 +106,9 @@ class SerpResource(SyncAPIResource):
|
|
|
105
106
|
|
|
106
107
|
render: Whether to render the page in a browser before extracting.
|
|
107
108
|
|
|
109
|
+
show_hidden_results: When true, disables Google result filtering (filter=0) so omitted/duplicate and
|
|
110
|
+
highly similar pages are also returned. Applies to Google search engines.
|
|
111
|
+
|
|
108
112
|
extra_headers: Send extra headers
|
|
109
113
|
|
|
110
114
|
extra_query: Add additional query parameters to the request
|
|
@@ -128,6 +132,7 @@ class SerpResource(SyncAPIResource):
|
|
|
128
132
|
"parse": parse,
|
|
129
133
|
"query": query,
|
|
130
134
|
"render": render,
|
|
135
|
+
"show_hidden_results": show_hidden_results,
|
|
131
136
|
},
|
|
132
137
|
serp_run_params.SerpRunParams,
|
|
133
138
|
),
|
|
@@ -163,6 +168,7 @@ class SerpResource(SyncAPIResource):
|
|
|
163
168
|
parse: bool | Omit = omit,
|
|
164
169
|
query: str | Omit = omit,
|
|
165
170
|
render: bool | Omit = omit,
|
|
171
|
+
show_hidden_results: bool | Omit = omit,
|
|
166
172
|
storage_compress: bool | Omit = omit,
|
|
167
173
|
storage_object_name: str | Omit = omit,
|
|
168
174
|
storage_type: str | Omit = omit,
|
|
@@ -203,6 +209,9 @@ class SerpResource(SyncAPIResource):
|
|
|
203
209
|
|
|
204
210
|
render: Whether to render the page in a browser before extracting.
|
|
205
211
|
|
|
212
|
+
show_hidden_results: When true, disables Google result filtering (filter=0) so omitted/duplicate and
|
|
213
|
+
highly similar pages are also returned. Applies to Google search engines.
|
|
214
|
+
|
|
206
215
|
storage_compress: Whether to compress stored data
|
|
207
216
|
|
|
208
217
|
storage_object_name: Custom name for the stored object
|
|
@@ -235,6 +244,7 @@ class SerpResource(SyncAPIResource):
|
|
|
235
244
|
"parse": parse,
|
|
236
245
|
"query": query,
|
|
237
246
|
"render": render,
|
|
247
|
+
"show_hidden_results": show_hidden_results,
|
|
238
248
|
"storage_compress": storage_compress,
|
|
239
249
|
"storage_object_name": storage_object_name,
|
|
240
250
|
"storage_type": storage_type,
|
|
@@ -340,6 +350,7 @@ class AsyncSerpResource(AsyncAPIResource):
|
|
|
340
350
|
parse: bool | Omit = omit,
|
|
341
351
|
query: str | Omit = omit,
|
|
342
352
|
render: bool | Omit = omit,
|
|
353
|
+
show_hidden_results: bool | Omit = omit,
|
|
343
354
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
344
355
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
345
356
|
extra_headers: Headers | None = None,
|
|
@@ -374,6 +385,9 @@ class AsyncSerpResource(AsyncAPIResource):
|
|
|
374
385
|
|
|
375
386
|
render: Whether to render the page in a browser before extracting.
|
|
376
387
|
|
|
388
|
+
show_hidden_results: When true, disables Google result filtering (filter=0) so omitted/duplicate and
|
|
389
|
+
highly similar pages are also returned. Applies to Google search engines.
|
|
390
|
+
|
|
377
391
|
extra_headers: Send extra headers
|
|
378
392
|
|
|
379
393
|
extra_query: Add additional query parameters to the request
|
|
@@ -397,6 +411,7 @@ class AsyncSerpResource(AsyncAPIResource):
|
|
|
397
411
|
"parse": parse,
|
|
398
412
|
"query": query,
|
|
399
413
|
"render": render,
|
|
414
|
+
"show_hidden_results": show_hidden_results,
|
|
400
415
|
},
|
|
401
416
|
serp_run_params.SerpRunParams,
|
|
402
417
|
),
|
|
@@ -432,6 +447,7 @@ class AsyncSerpResource(AsyncAPIResource):
|
|
|
432
447
|
parse: bool | Omit = omit,
|
|
433
448
|
query: str | Omit = omit,
|
|
434
449
|
render: bool | Omit = omit,
|
|
450
|
+
show_hidden_results: bool | Omit = omit,
|
|
435
451
|
storage_compress: bool | Omit = omit,
|
|
436
452
|
storage_object_name: str | Omit = omit,
|
|
437
453
|
storage_type: str | Omit = omit,
|
|
@@ -472,6 +488,9 @@ class AsyncSerpResource(AsyncAPIResource):
|
|
|
472
488
|
|
|
473
489
|
render: Whether to render the page in a browser before extracting.
|
|
474
490
|
|
|
491
|
+
show_hidden_results: When true, disables Google result filtering (filter=0) so omitted/duplicate and
|
|
492
|
+
highly similar pages are also returned. Applies to Google search engines.
|
|
493
|
+
|
|
475
494
|
storage_compress: Whether to compress stored data
|
|
476
495
|
|
|
477
496
|
storage_object_name: Custom name for the stored object
|
|
@@ -504,6 +523,7 @@ class AsyncSerpResource(AsyncAPIResource):
|
|
|
504
523
|
"parse": parse,
|
|
505
524
|
"query": query,
|
|
506
525
|
"render": render,
|
|
526
|
+
"show_hidden_results": show_hidden_results,
|
|
507
527
|
"storage_compress": storage_compress,
|
|
508
528
|
"storage_object_name": storage_object_name,
|
|
509
529
|
"storage_type": storage_type,
|