Skip to content

Commit 4493d6c

Browse files
feat(ai): add support for search endpoints and finetunes (#2305)
1 parent c10d3b7 commit 4493d6c

28 files changed

+2512
-1
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 1483
1+
configured_endpoints: 1490
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-f9dc65d353b377858f3d63d594de47559ed3a9d562295719690867315b8ec2fe.yml

api.md

+71
Original file line numberDiff line numberDiff line change
@@ -8507,8 +8507,79 @@ Methods:
85078507

85088508
- <code title="post /accounts/{account_id}/ai/run/{model_name}">client.ai.<a href="./src/cloudflare/resources/ai/ai.py">run</a>(model_name, \*, account_id, \*\*<a href="src/cloudflare/types/ai/ai_run_params.py">params</a>) -> <a href="./src/cloudflare/types/ai/ai_run_response.py">Optional[AIRunResponse]</a></code>
85098509

8510+
## Finetunes
8511+
8512+
Types:
8513+
8514+
```python
8515+
from cloudflare.types.ai import FinetuneCreateResponse, FinetuneListResponse
8516+
```
8517+
8518+
Methods:
8519+
8520+
- <code title="post /accounts/{account_id}/ai/finetunes">client.ai.finetunes.<a href="./src/cloudflare/resources/ai/finetunes/finetunes.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/ai/finetune_create_params.py">params</a>) -> <a href="./src/cloudflare/types/ai/finetune_create_response.py">FinetuneCreateResponse</a></code>
8521+
- <code title="get /accounts/{account_id}/ai/finetunes">client.ai.finetunes.<a href="./src/cloudflare/resources/ai/finetunes/finetunes.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/ai/finetune_list_response.py">FinetuneListResponse</a></code>
8522+
8523+
### Assets
8524+
8525+
Types:
8526+
8527+
```python
8528+
from cloudflare.types.ai.finetunes import AssetCreateResponse
8529+
```
8530+
8531+
Methods:
8532+
8533+
- <code title="post /accounts/{account_id}/ai/finetunes/{finetune_id}/finetune-assets">client.ai.finetunes.assets.<a href="./src/cloudflare/resources/ai/finetunes/assets.py">create</a>(finetune_id, \*, account_id, \*\*<a href="src/cloudflare/types/ai/finetunes/asset_create_params.py">params</a>) -> <a href="./src/cloudflare/types/ai/finetunes/asset_create_response.py">AssetCreateResponse</a></code>
8534+
8535+
### Public
8536+
8537+
Types:
8538+
8539+
```python
8540+
from cloudflare.types.ai.finetunes import PublicListResponse
8541+
```
8542+
8543+
Methods:
8544+
8545+
- <code title="get /accounts/{account_id}/ai/finetunes/public">client.ai.finetunes.public.<a href="./src/cloudflare/resources/ai/finetunes/public.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/ai/finetunes/public_list_params.py">params</a>) -> <a href="./src/cloudflare/types/ai/finetunes/public_list_response.py">SyncSinglePage[PublicListResponse]</a></code>
8546+
8547+
## Authors
8548+
8549+
Types:
8550+
8551+
```python
8552+
from cloudflare.types.ai import AuthorListResponse
8553+
```
8554+
8555+
Methods:
8556+
8557+
- <code title="get /accounts/{account_id}/ai/authors/search">client.ai.authors.<a href="./src/cloudflare/resources/ai/authors.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/ai/author_list_response.py">SyncSinglePage[object]</a></code>
8558+
8559+
## Tasks
8560+
8561+
Types:
8562+
8563+
```python
8564+
from cloudflare.types.ai import TaskListResponse
8565+
```
8566+
8567+
Methods:
8568+
8569+
- <code title="get /accounts/{account_id}/ai/tasks/search">client.ai.tasks.<a href="./src/cloudflare/resources/ai/tasks.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/ai/task_list_response.py">SyncSinglePage[object]</a></code>
8570+
85108571
## Models
85118572

8573+
Types:
8574+
8575+
```python
8576+
from cloudflare.types.ai import ModelListResponse
8577+
```
8578+
8579+
Methods:
8580+
8581+
- <code title="get /accounts/{account_id}/ai/models/search">client.ai.models.<a href="./src/cloudflare/resources/ai/models/models.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/ai/model_list_params.py">params</a>) -> <a href="./src/cloudflare/types/ai/model_list_response.py">SyncV4PagePaginationArray[object]</a></code>
8582+
85128583
### Schema
85138584

85148585
Types:

src/cloudflare/resources/ai/__init__.py

+42
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
AIResourceWithStreamingResponse,
99
AsyncAIResourceWithStreamingResponse,
1010
)
11+
from .tasks import (
12+
TasksResource,
13+
AsyncTasksResource,
14+
TasksResourceWithRawResponse,
15+
AsyncTasksResourceWithRawResponse,
16+
TasksResourceWithStreamingResponse,
17+
AsyncTasksResourceWithStreamingResponse,
18+
)
1119
from .models import (
1220
ModelsResource,
1321
AsyncModelsResource,
@@ -16,8 +24,42 @@
1624
ModelsResourceWithStreamingResponse,
1725
AsyncModelsResourceWithStreamingResponse,
1826
)
27+
from .authors import (
28+
AuthorsResource,
29+
AsyncAuthorsResource,
30+
AuthorsResourceWithRawResponse,
31+
AsyncAuthorsResourceWithRawResponse,
32+
AuthorsResourceWithStreamingResponse,
33+
AsyncAuthorsResourceWithStreamingResponse,
34+
)
35+
from .finetunes import (
36+
FinetunesResource,
37+
AsyncFinetunesResource,
38+
FinetunesResourceWithRawResponse,
39+
AsyncFinetunesResourceWithRawResponse,
40+
FinetunesResourceWithStreamingResponse,
41+
AsyncFinetunesResourceWithStreamingResponse,
42+
)
1943

2044
__all__ = [
45+
"FinetunesResource",
46+
"AsyncFinetunesResource",
47+
"FinetunesResourceWithRawResponse",
48+
"AsyncFinetunesResourceWithRawResponse",
49+
"FinetunesResourceWithStreamingResponse",
50+
"AsyncFinetunesResourceWithStreamingResponse",
51+
"AuthorsResource",
52+
"AsyncAuthorsResource",
53+
"AuthorsResourceWithRawResponse",
54+
"AsyncAuthorsResourceWithRawResponse",
55+
"AuthorsResourceWithStreamingResponse",
56+
"AsyncAuthorsResourceWithStreamingResponse",
57+
"TasksResource",
58+
"AsyncTasksResource",
59+
"TasksResourceWithRawResponse",
60+
"AsyncTasksResourceWithRawResponse",
61+
"TasksResourceWithStreamingResponse",
62+
"AsyncTasksResourceWithStreamingResponse",
2163
"ModelsResource",
2264
"AsyncModelsResource",
2365
"ModelsResourceWithRawResponse",

src/cloudflare/resources/ai/ai.py

+96
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,22 @@
77

88
import httpx
99

10+
from .tasks import (
11+
TasksResource,
12+
AsyncTasksResource,
13+
TasksResourceWithRawResponse,
14+
AsyncTasksResourceWithRawResponse,
15+
TasksResourceWithStreamingResponse,
16+
AsyncTasksResourceWithStreamingResponse,
17+
)
18+
from .authors import (
19+
AuthorsResource,
20+
AsyncAuthorsResource,
21+
AuthorsResourceWithRawResponse,
22+
AsyncAuthorsResourceWithRawResponse,
23+
AuthorsResourceWithStreamingResponse,
24+
AsyncAuthorsResourceWithStreamingResponse,
25+
)
1026
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
1127
from ..._utils import (
1228
required_args,
@@ -32,12 +48,32 @@
3248
AsyncModelsResourceWithStreamingResponse,
3349
)
3450
from ..._base_client import make_request_options
51+
from .finetunes.finetunes import (
52+
FinetunesResource,
53+
AsyncFinetunesResource,
54+
FinetunesResourceWithRawResponse,
55+
AsyncFinetunesResourceWithRawResponse,
56+
FinetunesResourceWithStreamingResponse,
57+
AsyncFinetunesResourceWithStreamingResponse,
58+
)
3559
from ...types.ai.ai_run_response import AIRunResponse
3660

3761
__all__ = ["AIResource", "AsyncAIResource"]
3862

3963

4064
class AIResource(SyncAPIResource):
65+
@cached_property
66+
def finetunes(self) -> FinetunesResource:
67+
return FinetunesResource(self._client)
68+
69+
@cached_property
70+
def authors(self) -> AuthorsResource:
71+
return AuthorsResource(self._client)
72+
73+
@cached_property
74+
def tasks(self) -> TasksResource:
75+
return TasksResource(self._client)
76+
4177
@cached_property
4278
def models(self) -> ModelsResource:
4379
return ModelsResource(self._client)
@@ -778,6 +814,18 @@ def run(
778814

779815

780816
class AsyncAIResource(AsyncAPIResource):
817+
@cached_property
818+
def finetunes(self) -> AsyncFinetunesResource:
819+
return AsyncFinetunesResource(self._client)
820+
821+
@cached_property
822+
def authors(self) -> AsyncAuthorsResource:
823+
return AsyncAuthorsResource(self._client)
824+
825+
@cached_property
826+
def tasks(self) -> AsyncTasksResource:
827+
return AsyncTasksResource(self._client)
828+
781829
@cached_property
782830
def models(self) -> AsyncModelsResource:
783831
return AsyncModelsResource(self._client)
@@ -1525,6 +1573,18 @@ def __init__(self, ai: AIResource) -> None:
15251573
ai.run,
15261574
)
15271575

1576+
@cached_property
1577+
def finetunes(self) -> FinetunesResourceWithRawResponse:
1578+
return FinetunesResourceWithRawResponse(self._ai.finetunes)
1579+
1580+
@cached_property
1581+
def authors(self) -> AuthorsResourceWithRawResponse:
1582+
return AuthorsResourceWithRawResponse(self._ai.authors)
1583+
1584+
@cached_property
1585+
def tasks(self) -> TasksResourceWithRawResponse:
1586+
return TasksResourceWithRawResponse(self._ai.tasks)
1587+
15281588
@cached_property
15291589
def models(self) -> ModelsResourceWithRawResponse:
15301590
return ModelsResourceWithRawResponse(self._ai.models)
@@ -1538,6 +1598,18 @@ def __init__(self, ai: AsyncAIResource) -> None:
15381598
ai.run,
15391599
)
15401600

1601+
@cached_property
1602+
def finetunes(self) -> AsyncFinetunesResourceWithRawResponse:
1603+
return AsyncFinetunesResourceWithRawResponse(self._ai.finetunes)
1604+
1605+
@cached_property
1606+
def authors(self) -> AsyncAuthorsResourceWithRawResponse:
1607+
return AsyncAuthorsResourceWithRawResponse(self._ai.authors)
1608+
1609+
@cached_property
1610+
def tasks(self) -> AsyncTasksResourceWithRawResponse:
1611+
return AsyncTasksResourceWithRawResponse(self._ai.tasks)
1612+
15411613
@cached_property
15421614
def models(self) -> AsyncModelsResourceWithRawResponse:
15431615
return AsyncModelsResourceWithRawResponse(self._ai.models)
@@ -1551,6 +1623,18 @@ def __init__(self, ai: AIResource) -> None:
15511623
ai.run,
15521624
)
15531625

1626+
@cached_property
1627+
def finetunes(self) -> FinetunesResourceWithStreamingResponse:
1628+
return FinetunesResourceWithStreamingResponse(self._ai.finetunes)
1629+
1630+
@cached_property
1631+
def authors(self) -> AuthorsResourceWithStreamingResponse:
1632+
return AuthorsResourceWithStreamingResponse(self._ai.authors)
1633+
1634+
@cached_property
1635+
def tasks(self) -> TasksResourceWithStreamingResponse:
1636+
return TasksResourceWithStreamingResponse(self._ai.tasks)
1637+
15541638
@cached_property
15551639
def models(self) -> ModelsResourceWithStreamingResponse:
15561640
return ModelsResourceWithStreamingResponse(self._ai.models)
@@ -1564,6 +1648,18 @@ def __init__(self, ai: AsyncAIResource) -> None:
15641648
ai.run,
15651649
)
15661650

1651+
@cached_property
1652+
def finetunes(self) -> AsyncFinetunesResourceWithStreamingResponse:
1653+
return AsyncFinetunesResourceWithStreamingResponse(self._ai.finetunes)
1654+
1655+
@cached_property
1656+
def authors(self) -> AsyncAuthorsResourceWithStreamingResponse:
1657+
return AsyncAuthorsResourceWithStreamingResponse(self._ai.authors)
1658+
1659+
@cached_property
1660+
def tasks(self) -> AsyncTasksResourceWithStreamingResponse:
1661+
return AsyncTasksResourceWithStreamingResponse(self._ai.tasks)
1662+
15671663
@cached_property
15681664
def models(self) -> AsyncModelsResourceWithStreamingResponse:
15691665
return AsyncModelsResourceWithStreamingResponse(self._ai.models)

0 commit comments

Comments
 (0)