Skip to content

Commit 43a4557

Browse files
feat: feat(api): RAG-395: add AI Search endpoints
* feat(api): RAG-395: fix ai search casing * feat(api): RAG-395: re-enable search and chat completions endpoints for ai search * feat(api): RAG-395: add more AI Search endpoints * feat(api): RAG-395: add remaining ai search token endpoints and temporarily disable chat completions and search * feat(api): RAG-395: add AI Search endpoints
1 parent 2f1981a commit 43a4557

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+7258
-2
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 1925
1+
configured_endpoints: 1940
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-5fc91fe703941755eabe8e53f6d53056d31c38bff2f098dfa2389512e52b586f.yml
33
openapi_spec_hash: 7d4707f46e5b07408d6a083bfe164f51
4-
config_hash: 93c66810e920a180099213f0e36aacbd
4+
config_hash: 3e9cdaaf8fbff19639d218f89b85a116

api.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10302,6 +10302,87 @@ Methods:
1030210302
- <code title="get /accounts/{account_id}/ai/tomarkdown/supported">client.ai.to_markdown.<a href="./src/cloudflare/resources/ai/to_markdown.py">supported</a>(\*, account_id) -> <a href="./src/cloudflare/types/ai/to_markdown_supported_response.py">SyncSinglePage[ToMarkdownSupportedResponse]</a></code>
1030310303
- <code title="post /accounts/{account_id}/ai/tomarkdown">client.ai.to_markdown.<a href="./src/cloudflare/resources/ai/to_markdown.py">transform</a>(file, \*, account_id, \*\*<a href="src/cloudflare/types/ai/to_markdown_transform_params.py">params</a>) -> <a href="./src/cloudflare/types/ai/to_markdown_transform_response.py">SyncSinglePage[ToMarkdownTransformResponse]</a></code>
1030410304

10305+
# AISearch
10306+
10307+
## Instances
10308+
10309+
Types:
10310+
10311+
```python
10312+
from cloudflare.types.aisearch import (
10313+
InstanceCreateResponse,
10314+
InstanceUpdateResponse,
10315+
InstanceListResponse,
10316+
InstanceDeleteResponse,
10317+
InstanceReadResponse,
10318+
InstanceStatsResponse,
10319+
)
10320+
```
10321+
10322+
Methods:
10323+
10324+
- <code title="post /accounts/{account_id}/ai-search/instances">client.aisearch.instances.<a href="./src/cloudflare/resources/aisearch/instances/instances.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/aisearch/instance_create_params.py">params</a>) -> <a href="./src/cloudflare/types/aisearch/instance_create_response.py">InstanceCreateResponse</a></code>
10325+
- <code title="put /accounts/{account_id}/ai-search/instances/{id}">client.aisearch.instances.<a href="./src/cloudflare/resources/aisearch/instances/instances.py">update</a>(id, \*, account_id, \*\*<a href="src/cloudflare/types/aisearch/instance_update_params.py">params</a>) -> <a href="./src/cloudflare/types/aisearch/instance_update_response.py">InstanceUpdateResponse</a></code>
10326+
- <code title="get /accounts/{account_id}/ai-search/instances">client.aisearch.instances.<a href="./src/cloudflare/resources/aisearch/instances/instances.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/aisearch/instance_list_params.py">params</a>) -> <a href="./src/cloudflare/types/aisearch/instance_list_response.py">SyncV4PagePaginationArray[InstanceListResponse]</a></code>
10327+
- <code title="delete /accounts/{account_id}/ai-search/instances/{id}">client.aisearch.instances.<a href="./src/cloudflare/resources/aisearch/instances/instances.py">delete</a>(id, \*, account_id) -> <a href="./src/cloudflare/types/aisearch/instance_delete_response.py">InstanceDeleteResponse</a></code>
10328+
- <code title="get /accounts/{account_id}/ai-search/instances/{id}">client.aisearch.instances.<a href="./src/cloudflare/resources/aisearch/instances/instances.py">read</a>(id, \*, account_id) -> <a href="./src/cloudflare/types/aisearch/instance_read_response.py">InstanceReadResponse</a></code>
10329+
- <code title="get /accounts/{account_id}/ai-search/instances/{id}/stats">client.aisearch.instances.<a href="./src/cloudflare/resources/aisearch/instances/instances.py">stats</a>(id, \*, account_id) -> <a href="./src/cloudflare/types/aisearch/instance_stats_response.py">InstanceStatsResponse</a></code>
10330+
10331+
### Items
10332+
10333+
Types:
10334+
10335+
```python
10336+
from cloudflare.types.aisearch.instances import ItemListResponse, ItemGetResponse
10337+
```
10338+
10339+
Methods:
10340+
10341+
- <code title="get /accounts/{account_id}/ai-search/instances/{id}/items">client.aisearch.instances.items.<a href="./src/cloudflare/resources/aisearch/instances/items.py">list</a>(id, \*, account_id, \*\*<a href="src/cloudflare/types/aisearch/instances/item_list_params.py">params</a>) -> <a href="./src/cloudflare/types/aisearch/instances/item_list_response.py">SyncV4PagePaginationArray[ItemListResponse]</a></code>
10342+
- <code title="get /accounts/{account_id}/ai-search/instances/{id}/items/{item_id}">client.aisearch.instances.items.<a href="./src/cloudflare/resources/aisearch/instances/items.py">get</a>(item_id, \*, account_id, id) -> <a href="./src/cloudflare/types/aisearch/instances/item_get_response.py">ItemGetResponse</a></code>
10343+
10344+
### Jobs
10345+
10346+
Types:
10347+
10348+
```python
10349+
from cloudflare.types.aisearch.instances import (
10350+
JobCreateResponse,
10351+
JobListResponse,
10352+
JobGetResponse,
10353+
JobLogsResponse,
10354+
)
10355+
```
10356+
10357+
Methods:
10358+
10359+
- <code title="post /accounts/{account_id}/ai-search/instances/{id}/jobs">client.aisearch.instances.jobs.<a href="./src/cloudflare/resources/aisearch/instances/jobs.py">create</a>(id, \*, account_id) -> <a href="./src/cloudflare/types/aisearch/instances/job_create_response.py">JobCreateResponse</a></code>
10360+
- <code title="get /accounts/{account_id}/ai-search/instances/{id}/jobs">client.aisearch.instances.jobs.<a href="./src/cloudflare/resources/aisearch/instances/jobs.py">list</a>(id, \*, account_id, \*\*<a href="src/cloudflare/types/aisearch/instances/job_list_params.py">params</a>) -> <a href="./src/cloudflare/types/aisearch/instances/job_list_response.py">SyncV4PagePaginationArray[JobListResponse]</a></code>
10361+
- <code title="get /accounts/{account_id}/ai-search/instances/{id}/jobs/{job_id}">client.aisearch.instances.jobs.<a href="./src/cloudflare/resources/aisearch/instances/jobs.py">get</a>(job_id, \*, account_id, id) -> <a href="./src/cloudflare/types/aisearch/instances/job_get_response.py">JobGetResponse</a></code>
10362+
- <code title="get /accounts/{account_id}/ai-search/instances/{id}/jobs/{job_id}/logs">client.aisearch.instances.jobs.<a href="./src/cloudflare/resources/aisearch/instances/jobs.py">logs</a>(job_id, \*, account_id, id, \*\*<a href="src/cloudflare/types/aisearch/instances/job_logs_params.py">params</a>) -> <a href="./src/cloudflare/types/aisearch/instances/job_logs_response.py">JobLogsResponse</a></code>
10363+
10364+
## Tokens
10365+
10366+
Types:
10367+
10368+
```python
10369+
from cloudflare.types.aisearch import (
10370+
TokenCreateResponse,
10371+
TokenUpdateResponse,
10372+
TokenListResponse,
10373+
TokenDeleteResponse,
10374+
TokenReadResponse,
10375+
)
10376+
```
10377+
10378+
Methods:
10379+
10380+
- <code title="post /accounts/{account_id}/ai-search/tokens">client.aisearch.tokens.<a href="./src/cloudflare/resources/aisearch/tokens.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/aisearch/token_create_params.py">params</a>) -> <a href="./src/cloudflare/types/aisearch/token_create_response.py">TokenCreateResponse</a></code>
10381+
- <code title="delete /accounts/{account_id}/ai-search/tokens/{id}">client.aisearch.tokens.<a href="./src/cloudflare/resources/aisearch/tokens.py">update</a>(id, \*, account_id) -> <a href="./src/cloudflare/types/aisearch/token_update_response.py">TokenUpdateResponse</a></code>
10382+
- <code title="get /accounts/{account_id}/ai-search/tokens">client.aisearch.tokens.<a href="./src/cloudflare/resources/aisearch/tokens.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/aisearch/token_list_params.py">params</a>) -> <a href="./src/cloudflare/types/aisearch/token_list_response.py">SyncV4PagePaginationArray[TokenListResponse]</a></code>
10383+
- <code title="delete /accounts/{account_id}/ai-search/tokens/{id}">client.aisearch.tokens.<a href="./src/cloudflare/resources/aisearch/tokens.py">delete</a>(id, \*, account_id) -> <a href="./src/cloudflare/types/aisearch/token_delete_response.py">TokenDeleteResponse</a></code>
10384+
- <code title="delete /accounts/{account_id}/ai-search/tokens/{id}">client.aisearch.tokens.<a href="./src/cloudflare/resources/aisearch/tokens.py">read</a>(id, \*, account_id) -> <a href="./src/cloudflare/types/aisearch/token_read_response.py">TokenReadResponse</a></code>
10385+
1030510386
# SecurityCenter
1030610387

1030710388
## Insights

src/cloudflare/_client.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
logpush,
6666
workers,
6767
accounts,
68+
aisearch,
6869
alerting,
6970
firewall,
7071
rulesets,
@@ -173,6 +174,7 @@
173174
from .resources.logpush.logpush import LogpushResource, AsyncLogpushResource
174175
from .resources.workers.workers import WorkersResource, AsyncWorkersResource
175176
from .resources.accounts.accounts import AccountsResource, AsyncAccountsResource
177+
from .resources.aisearch.aisearch import AISearchResource, AsyncAISearchResource
176178
from .resources.alerting.alerting import AlertingResource, AsyncAlertingResource
177179
from .resources.firewall.firewall import FirewallResource, AsyncFirewallResource
178180
from .resources.rulesets.rulesets import RulesetsResource, AsyncRulesetsResource
@@ -903,6 +905,12 @@ def ai(self) -> AIResource:
903905

904906
return AIResource(self)
905907

908+
@cached_property
909+
def aisearch(self) -> AISearchResource:
910+
from .resources.aisearch import AISearchResource
911+
912+
return AISearchResource(self)
913+
906914
@cached_property
907915
def security_center(self) -> SecurityCenterResource:
908916
from .resources.security_center import SecurityCenterResource
@@ -1759,6 +1767,12 @@ def ai(self) -> AsyncAIResource:
17591767

17601768
return AsyncAIResource(self)
17611769

1770+
@cached_property
1771+
def aisearch(self) -> AsyncAISearchResource:
1772+
from .resources.aisearch import AsyncAISearchResource
1773+
1774+
return AsyncAISearchResource(self)
1775+
17621776
@cached_property
17631777
def security_center(self) -> AsyncSecurityCenterResource:
17641778
from .resources.security_center import AsyncSecurityCenterResource
@@ -2545,6 +2559,12 @@ def ai(self) -> ai.AIResourceWithRawResponse:
25452559

25462560
return AIResourceWithRawResponse(self._client.ai)
25472561

2562+
@cached_property
2563+
def aisearch(self) -> aisearch.AISearchResourceWithRawResponse:
2564+
from .resources.aisearch import AISearchResourceWithRawResponse
2565+
2566+
return AISearchResourceWithRawResponse(self._client.aisearch)
2567+
25482568
@cached_property
25492569
def security_center(self) -> security_center.SecurityCenterResourceWithRawResponse:
25502570
from .resources.security_center import SecurityCenterResourceWithRawResponse
@@ -3148,6 +3168,12 @@ def ai(self) -> ai.AsyncAIResourceWithRawResponse:
31483168

31493169
return AsyncAIResourceWithRawResponse(self._client.ai)
31503170

3171+
@cached_property
3172+
def aisearch(self) -> aisearch.AsyncAISearchResourceWithRawResponse:
3173+
from .resources.aisearch import AsyncAISearchResourceWithRawResponse
3174+
3175+
return AsyncAISearchResourceWithRawResponse(self._client.aisearch)
3176+
31513177
@cached_property
31523178
def security_center(self) -> security_center.AsyncSecurityCenterResourceWithRawResponse:
31533179
from .resources.security_center import AsyncSecurityCenterResourceWithRawResponse
@@ -3751,6 +3777,12 @@ def ai(self) -> ai.AIResourceWithStreamingResponse:
37513777

37523778
return AIResourceWithStreamingResponse(self._client.ai)
37533779

3780+
@cached_property
3781+
def aisearch(self) -> aisearch.AISearchResourceWithStreamingResponse:
3782+
from .resources.aisearch import AISearchResourceWithStreamingResponse
3783+
3784+
return AISearchResourceWithStreamingResponse(self._client.aisearch)
3785+
37543786
@cached_property
37553787
def security_center(self) -> security_center.SecurityCenterResourceWithStreamingResponse:
37563788
from .resources.security_center import SecurityCenterResourceWithStreamingResponse
@@ -4364,6 +4396,12 @@ def ai(self) -> ai.AsyncAIResourceWithStreamingResponse:
43644396

43654397
return AsyncAIResourceWithStreamingResponse(self._client.ai)
43664398

4399+
@cached_property
4400+
def aisearch(self) -> aisearch.AsyncAISearchResourceWithStreamingResponse:
4401+
from .resources.aisearch import AsyncAISearchResourceWithStreamingResponse
4402+
4403+
return AsyncAISearchResourceWithStreamingResponse(self._client.aisearch)
4404+
43674405
@cached_property
43684406
def security_center(self) -> security_center.AsyncSecurityCenterResourceWithStreamingResponse:
43694407
from .resources.security_center import AsyncSecurityCenterResourceWithStreamingResponse
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from .tokens import (
4+
TokensResource,
5+
AsyncTokensResource,
6+
TokensResourceWithRawResponse,
7+
AsyncTokensResourceWithRawResponse,
8+
TokensResourceWithStreamingResponse,
9+
AsyncTokensResourceWithStreamingResponse,
10+
)
11+
from .aisearch import (
12+
AISearchResource,
13+
AsyncAISearchResource,
14+
AISearchResourceWithRawResponse,
15+
AsyncAISearchResourceWithRawResponse,
16+
AISearchResourceWithStreamingResponse,
17+
AsyncAISearchResourceWithStreamingResponse,
18+
)
19+
from .instances import (
20+
InstancesResource,
21+
AsyncInstancesResource,
22+
InstancesResourceWithRawResponse,
23+
AsyncInstancesResourceWithRawResponse,
24+
InstancesResourceWithStreamingResponse,
25+
AsyncInstancesResourceWithStreamingResponse,
26+
)
27+
28+
__all__ = [
29+
"InstancesResource",
30+
"AsyncInstancesResource",
31+
"InstancesResourceWithRawResponse",
32+
"AsyncInstancesResourceWithRawResponse",
33+
"InstancesResourceWithStreamingResponse",
34+
"AsyncInstancesResourceWithStreamingResponse",
35+
"TokensResource",
36+
"AsyncTokensResource",
37+
"TokensResourceWithRawResponse",
38+
"AsyncTokensResourceWithRawResponse",
39+
"TokensResourceWithStreamingResponse",
40+
"AsyncTokensResourceWithStreamingResponse",
41+
"AISearchResource",
42+
"AsyncAISearchResource",
43+
"AISearchResourceWithRawResponse",
44+
"AsyncAISearchResourceWithRawResponse",
45+
"AISearchResourceWithStreamingResponse",
46+
"AsyncAISearchResourceWithStreamingResponse",
47+
]
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from .tokens import (
6+
TokensResource,
7+
AsyncTokensResource,
8+
TokensResourceWithRawResponse,
9+
AsyncTokensResourceWithRawResponse,
10+
TokensResourceWithStreamingResponse,
11+
AsyncTokensResourceWithStreamingResponse,
12+
)
13+
from ..._compat import cached_property
14+
from ..._resource import SyncAPIResource, AsyncAPIResource
15+
from .instances.instances import (
16+
InstancesResource,
17+
AsyncInstancesResource,
18+
InstancesResourceWithRawResponse,
19+
AsyncInstancesResourceWithRawResponse,
20+
InstancesResourceWithStreamingResponse,
21+
AsyncInstancesResourceWithStreamingResponse,
22+
)
23+
24+
__all__ = ["AISearchResource", "AsyncAISearchResource"]
25+
26+
27+
class AISearchResource(SyncAPIResource):
28+
@cached_property
29+
def instances(self) -> InstancesResource:
30+
return InstancesResource(self._client)
31+
32+
@cached_property
33+
def tokens(self) -> TokensResource:
34+
return TokensResource(self._client)
35+
36+
@cached_property
37+
def with_raw_response(self) -> AISearchResourceWithRawResponse:
38+
"""
39+
This property can be used as a prefix for any HTTP method call to return
40+
the raw response object instead of the parsed content.
41+
42+
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
43+
"""
44+
return AISearchResourceWithRawResponse(self)
45+
46+
@cached_property
47+
def with_streaming_response(self) -> AISearchResourceWithStreamingResponse:
48+
"""
49+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
50+
51+
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
52+
"""
53+
return AISearchResourceWithStreamingResponse(self)
54+
55+
56+
class AsyncAISearchResource(AsyncAPIResource):
57+
@cached_property
58+
def instances(self) -> AsyncInstancesResource:
59+
return AsyncInstancesResource(self._client)
60+
61+
@cached_property
62+
def tokens(self) -> AsyncTokensResource:
63+
return AsyncTokensResource(self._client)
64+
65+
@cached_property
66+
def with_raw_response(self) -> AsyncAISearchResourceWithRawResponse:
67+
"""
68+
This property can be used as a prefix for any HTTP method call to return
69+
the raw response object instead of the parsed content.
70+
71+
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
72+
"""
73+
return AsyncAISearchResourceWithRawResponse(self)
74+
75+
@cached_property
76+
def with_streaming_response(self) -> AsyncAISearchResourceWithStreamingResponse:
77+
"""
78+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
79+
80+
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
81+
"""
82+
return AsyncAISearchResourceWithStreamingResponse(self)
83+
84+
85+
class AISearchResourceWithRawResponse:
86+
def __init__(self, aisearch: AISearchResource) -> None:
87+
self._aisearch = aisearch
88+
89+
@cached_property
90+
def instances(self) -> InstancesResourceWithRawResponse:
91+
return InstancesResourceWithRawResponse(self._aisearch.instances)
92+
93+
@cached_property
94+
def tokens(self) -> TokensResourceWithRawResponse:
95+
return TokensResourceWithRawResponse(self._aisearch.tokens)
96+
97+
98+
class AsyncAISearchResourceWithRawResponse:
99+
def __init__(self, aisearch: AsyncAISearchResource) -> None:
100+
self._aisearch = aisearch
101+
102+
@cached_property
103+
def instances(self) -> AsyncInstancesResourceWithRawResponse:
104+
return AsyncInstancesResourceWithRawResponse(self._aisearch.instances)
105+
106+
@cached_property
107+
def tokens(self) -> AsyncTokensResourceWithRawResponse:
108+
return AsyncTokensResourceWithRawResponse(self._aisearch.tokens)
109+
110+
111+
class AISearchResourceWithStreamingResponse:
112+
def __init__(self, aisearch: AISearchResource) -> None:
113+
self._aisearch = aisearch
114+
115+
@cached_property
116+
def instances(self) -> InstancesResourceWithStreamingResponse:
117+
return InstancesResourceWithStreamingResponse(self._aisearch.instances)
118+
119+
@cached_property
120+
def tokens(self) -> TokensResourceWithStreamingResponse:
121+
return TokensResourceWithStreamingResponse(self._aisearch.tokens)
122+
123+
124+
class AsyncAISearchResourceWithStreamingResponse:
125+
def __init__(self, aisearch: AsyncAISearchResource) -> None:
126+
self._aisearch = aisearch
127+
128+
@cached_property
129+
def instances(self) -> AsyncInstancesResourceWithStreamingResponse:
130+
return AsyncInstancesResourceWithStreamingResponse(self._aisearch.instances)
131+
132+
@cached_property
133+
def tokens(self) -> AsyncTokensResourceWithStreamingResponse:
134+
return AsyncTokensResourceWithStreamingResponse(self._aisearch.tokens)

0 commit comments

Comments
 (0)