diff --git a/.stats.yml b/.stats.yml index ae473c1891a8..0a0068803e89 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 1259 +configured_endpoints: 1249 diff --git a/api.md b/api.md index c92fa2a6d89c..e0919f4499a4 100644 --- a/api.md +++ b/api.md @@ -5988,24 +5988,9 @@ from cloudflare.types.vectorize import ( IndexInsert, IndexQuery, IndexUpsert, - IndexDeleteResponse, - IndexGetByIDsResponse, ) ``` -Methods: - -- client.vectorize.indexes.create(account_identifier, \*\*params) -> Optional -- client.vectorize.indexes.update(index_name, \*, account_identifier, \*\*params) -> Optional -- client.vectorize.indexes.list(account_identifier) -> SyncSinglePage[CreateIndex] -- client.vectorize.indexes.delete(index_name, \*, account_identifier) -> IndexDeleteResponse -- client.vectorize.indexes.delete_by_ids(index_name, \*, account_identifier, \*\*params) -> Optional -- client.vectorize.indexes.get(index_name, \*, account_identifier) -> Optional -- client.vectorize.indexes.get_by_ids(index_name, \*, account_identifier, \*\*params) -> object -- client.vectorize.indexes.insert(index_name, \*, account_identifier, \*\*params) -> Optional -- client.vectorize.indexes.query(index_name, \*, account_identifier, \*\*params) -> Optional -- client.vectorize.indexes.upsert(index_name, \*, account_identifier, \*\*params) -> Optional - # URLScanner Types: diff --git a/src/cloudflare/_client.py b/src/cloudflare/_client.py index 1e34cb57856c..5df69095bcc9 100644 --- a/src/cloudflare/_client.py +++ b/src/cloudflare/_client.py @@ -116,7 +116,6 @@ class Cloudflare(SyncAPIClient): challenges: resources.Challenges hyperdrive: resources.HyperdriveResource rum: resources.RUM - vectorize: resources.Vectorize url_scanner: resources.URLScanner radar: resources.Radar bot_management: resources.BotManagement @@ -272,7 +271,6 @@ def __init__( self.challenges = resources.Challenges(self) self.hyperdrive = resources.HyperdriveResource(self) self.rum = resources.RUM(self) - self.vectorize = resources.Vectorize(self) self.url_scanner = resources.URLScanner(self) self.radar = resources.Radar(self) self.bot_management = resources.BotManagement(self) @@ -531,7 +529,6 @@ class AsyncCloudflare(AsyncAPIClient): challenges: resources.AsyncChallenges hyperdrive: resources.AsyncHyperdriveResource rum: resources.AsyncRUM - vectorize: resources.AsyncVectorize url_scanner: resources.AsyncURLScanner radar: resources.AsyncRadar bot_management: resources.AsyncBotManagement @@ -687,7 +684,6 @@ def __init__( self.challenges = resources.AsyncChallenges(self) self.hyperdrive = resources.AsyncHyperdriveResource(self) self.rum = resources.AsyncRUM(self) - self.vectorize = resources.AsyncVectorize(self) self.url_scanner = resources.AsyncURLScanner(self) self.radar = resources.AsyncRadar(self) self.bot_management = resources.AsyncBotManagement(self) @@ -947,7 +943,6 @@ def __init__(self, client: Cloudflare) -> None: self.challenges = resources.ChallengesWithRawResponse(client.challenges) self.hyperdrive = resources.HyperdriveResourceWithRawResponse(client.hyperdrive) self.rum = resources.RUMWithRawResponse(client.rum) - self.vectorize = resources.VectorizeWithRawResponse(client.vectorize) self.url_scanner = resources.URLScannerWithRawResponse(client.url_scanner) self.radar = resources.RadarWithRawResponse(client.radar) self.bot_management = resources.BotManagementWithRawResponse(client.bot_management) @@ -1038,7 +1033,6 @@ def __init__(self, client: AsyncCloudflare) -> None: self.challenges = resources.AsyncChallengesWithRawResponse(client.challenges) self.hyperdrive = resources.AsyncHyperdriveResourceWithRawResponse(client.hyperdrive) self.rum = resources.AsyncRUMWithRawResponse(client.rum) - self.vectorize = resources.AsyncVectorizeWithRawResponse(client.vectorize) self.url_scanner = resources.AsyncURLScannerWithRawResponse(client.url_scanner) self.radar = resources.AsyncRadarWithRawResponse(client.radar) self.bot_management = resources.AsyncBotManagementWithRawResponse(client.bot_management) @@ -1129,7 +1123,6 @@ def __init__(self, client: Cloudflare) -> None: self.challenges = resources.ChallengesWithStreamingResponse(client.challenges) self.hyperdrive = resources.HyperdriveResourceWithStreamingResponse(client.hyperdrive) self.rum = resources.RUMWithStreamingResponse(client.rum) - self.vectorize = resources.VectorizeWithStreamingResponse(client.vectorize) self.url_scanner = resources.URLScannerWithStreamingResponse(client.url_scanner) self.radar = resources.RadarWithStreamingResponse(client.radar) self.bot_management = resources.BotManagementWithStreamingResponse(client.bot_management) @@ -1226,7 +1219,6 @@ def __init__(self, client: AsyncCloudflare) -> None: self.challenges = resources.AsyncChallengesWithStreamingResponse(client.challenges) self.hyperdrive = resources.AsyncHyperdriveResourceWithStreamingResponse(client.hyperdrive) self.rum = resources.AsyncRUMWithStreamingResponse(client.rum) - self.vectorize = resources.AsyncVectorizeWithStreamingResponse(client.vectorize) self.url_scanner = resources.AsyncURLScannerWithStreamingResponse(client.url_scanner) self.radar = resources.AsyncRadarWithStreamingResponse(client.radar) self.bot_management = resources.AsyncBotManagementWithStreamingResponse(client.bot_management) diff --git a/src/cloudflare/resources/__init__.py b/src/cloudflare/resources/__init__.py index bc46849e478f..e097e9d3dc0b 100644 --- a/src/cloudflare/resources/__init__.py +++ b/src/cloudflare/resources/__init__.py @@ -320,14 +320,6 @@ RegistrarWithStreamingResponse, AsyncRegistrarWithStreamingResponse, ) -from .vectorize import ( - Vectorize, - AsyncVectorize, - VectorizeWithRawResponse, - AsyncVectorizeWithRawResponse, - VectorizeWithStreamingResponse, - AsyncVectorizeWithStreamingResponse, -) from .addressing import ( Addressing, AsyncAddressing, @@ -1064,12 +1056,6 @@ "AsyncRUMWithRawResponse", "RUMWithStreamingResponse", "AsyncRUMWithStreamingResponse", - "Vectorize", - "AsyncVectorize", - "VectorizeWithRawResponse", - "AsyncVectorizeWithRawResponse", - "VectorizeWithStreamingResponse", - "AsyncVectorizeWithStreamingResponse", "URLScanner", "AsyncURLScanner", "URLScannerWithRawResponse", diff --git a/src/cloudflare/resources/vectorize/__init__.py b/src/cloudflare/resources/vectorize/__init__.py deleted file mode 100644 index ded339e95540..000000000000 --- a/src/cloudflare/resources/vectorize/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .indexes import ( - Indexes, - AsyncIndexes, - IndexesWithRawResponse, - AsyncIndexesWithRawResponse, - IndexesWithStreamingResponse, - AsyncIndexesWithStreamingResponse, -) -from .vectorize import ( - Vectorize, - AsyncVectorize, - VectorizeWithRawResponse, - AsyncVectorizeWithRawResponse, - VectorizeWithStreamingResponse, - AsyncVectorizeWithStreamingResponse, -) - -__all__ = [ - "Indexes", - "AsyncIndexes", - "IndexesWithRawResponse", - "AsyncIndexesWithRawResponse", - "IndexesWithStreamingResponse", - "AsyncIndexesWithStreamingResponse", - "Vectorize", - "AsyncVectorize", - "VectorizeWithRawResponse", - "AsyncVectorizeWithRawResponse", - "VectorizeWithStreamingResponse", - "AsyncVectorizeWithStreamingResponse", -] diff --git a/src/cloudflare/resources/vectorize/indexes.py b/src/cloudflare/resources/vectorize/indexes.py deleted file mode 100644 index 96533c0670e7..000000000000 --- a/src/cloudflare/resources/vectorize/indexes.py +++ /dev/null @@ -1,1148 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Any, List, Type, Iterable, Optional, cast - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._wrappers import ResultWrapper -from ...pagination import SyncSinglePage, AsyncSinglePage -from ..._base_client import ( - AsyncPaginator, - make_request_options, -) -from ...types.vectorize import ( - IndexQuery, - CreateIndex, - IndexInsert, - IndexUpsert, - IndexDeleteResponse, - IndexDeleteVectorsByID, - index_query_params, - index_create_params, - index_insert_params, - index_update_params, - index_upsert_params, - index_get_by_ids_params, - index_delete_by_ids_params, -) - -__all__ = ["Indexes", "AsyncIndexes"] - - -class Indexes(SyncAPIResource): - @cached_property - def with_raw_response(self) -> IndexesWithRawResponse: - return IndexesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> IndexesWithStreamingResponse: - return IndexesWithStreamingResponse(self) - - def create( - self, - account_identifier: str, - *, - config: index_create_params.Config, - name: str, - description: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CreateIndex]: - """ - Creates and returns a new Vectorize Index. - - Args: - account_identifier: Identifier - - config: Specifies the type of configuration to use for the index. - - description: Specifies the description of the index. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - return self._post( - f"/accounts/{account_identifier}/vectorize/indexes", - body=maybe_transform( - { - "config": config, - "name": name, - "description": description, - }, - index_create_params.IndexCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[CreateIndex]], ResultWrapper[CreateIndex]), - ) - - def update( - self, - index_name: str, - *, - account_identifier: str, - description: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CreateIndex]: - """ - Updates and returns the specified Vectorize Index. - - Args: - account_identifier: Identifier - - description: Specifies the description of the index. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - if not index_name: - raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") - return self._put( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}", - body=maybe_transform({"description": description}, index_update_params.IndexUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[CreateIndex]], ResultWrapper[CreateIndex]), - ) - - def list( - self, - account_identifier: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[CreateIndex]: - """ - Returns a list of Vectorize Indexes - - Args: - account_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - return self._get_api_list( - f"/accounts/{account_identifier}/vectorize/indexes", - page=SyncSinglePage[CreateIndex], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=CreateIndex, - ) - - def delete( - self, - index_name: str, - *, - account_identifier: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IndexDeleteResponse: - """ - Deletes the specified Vectorize Index. - - Args: - account_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - if not index_name: - raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") - return cast( - IndexDeleteResponse, - self._delete( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[IndexDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - def delete_by_ids( - self, - index_name: str, - *, - account_identifier: str, - ids: List[str] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IndexDeleteVectorsByID]: - """ - Delete a set of vectors from an index by their vector identifiers. - - Args: - account_identifier: Identifier - - ids: A list of vector identifiers to delete from the index indicated by the path. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - if not index_name: - raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") - return self._post( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}/delete-by-ids", - body=maybe_transform({"ids": ids}, index_delete_by_ids_params.IndexDeleteByIDsParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[IndexDeleteVectorsByID]], ResultWrapper[IndexDeleteVectorsByID]), - ) - - def get( - self, - index_name: str, - *, - account_identifier: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CreateIndex]: - """ - Returns the specified Vectorize Index. - - Args: - account_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - if not index_name: - raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") - return self._get( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[CreateIndex]], ResultWrapper[CreateIndex]), - ) - - def get_by_ids( - self, - index_name: str, - *, - account_identifier: str, - ids: List[str] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - Get a set of vectors from an index by their vector identifiers. - - Args: - account_identifier: Identifier - - ids: A list of vector identifiers to retrieve from the index indicated by the path. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - if not index_name: - raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") - return self._post( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}/get-by-ids", - body=maybe_transform({"ids": ids}, index_get_by_ids_params.IndexGetByIDsParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[object], ResultWrapper[object]), - ) - - def insert( - self, - index_name: str, - *, - account_identifier: str, - body: object, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IndexInsert]: - """ - Inserts vectors into the specified index and returns the count of the vectors - successfully inserted. - - Args: - account_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - if not index_name: - raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") - return self._post( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}/insert", - body=maybe_transform(body, index_insert_params.IndexInsertParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[IndexInsert]], ResultWrapper[IndexInsert]), - ) - - def query( - self, - index_name: str, - *, - account_identifier: str, - return_metadata: bool | NotGiven = NOT_GIVEN, - return_values: bool | NotGiven = NOT_GIVEN, - top_k: float | NotGiven = NOT_GIVEN, - vector: Iterable[float] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IndexQuery]: - """ - Finds vectors closest to a given vector in an index. - - Args: - account_identifier: Identifier - - return_metadata: Whether to return the metadata associated with the closest vectors. - - return_values: Whether to return the values associated with the closest vectors. - - top_k: The number of nearest neighbors to find. - - vector: The search vector that will be used to find the nearest neighbors. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - if not index_name: - raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") - return self._post( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}/query", - body=maybe_transform( - { - "return_metadata": return_metadata, - "return_values": return_values, - "top_k": top_k, - "vector": vector, - }, - index_query_params.IndexQueryParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[IndexQuery]], ResultWrapper[IndexQuery]), - ) - - def upsert( - self, - index_name: str, - *, - account_identifier: str, - body: object, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IndexUpsert]: - """ - Upserts vectors into the specified index, creating them if they do not exist and - returns the count of values and ids successfully inserted. - - Args: - account_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - if not index_name: - raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") - return self._post( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}/upsert", - body=maybe_transform(body, index_upsert_params.IndexUpsertParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[IndexUpsert]], ResultWrapper[IndexUpsert]), - ) - - -class AsyncIndexes(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncIndexesWithRawResponse: - return AsyncIndexesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncIndexesWithStreamingResponse: - return AsyncIndexesWithStreamingResponse(self) - - async def create( - self, - account_identifier: str, - *, - config: index_create_params.Config, - name: str, - description: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CreateIndex]: - """ - Creates and returns a new Vectorize Index. - - Args: - account_identifier: Identifier - - config: Specifies the type of configuration to use for the index. - - description: Specifies the description of the index. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - return await self._post( - f"/accounts/{account_identifier}/vectorize/indexes", - body=await async_maybe_transform( - { - "config": config, - "name": name, - "description": description, - }, - index_create_params.IndexCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[CreateIndex]], ResultWrapper[CreateIndex]), - ) - - async def update( - self, - index_name: str, - *, - account_identifier: str, - description: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CreateIndex]: - """ - Updates and returns the specified Vectorize Index. - - Args: - account_identifier: Identifier - - description: Specifies the description of the index. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - if not index_name: - raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") - return await self._put( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}", - body=await async_maybe_transform({"description": description}, index_update_params.IndexUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[CreateIndex]], ResultWrapper[CreateIndex]), - ) - - def list( - self, - account_identifier: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[CreateIndex, AsyncSinglePage[CreateIndex]]: - """ - Returns a list of Vectorize Indexes - - Args: - account_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - return self._get_api_list( - f"/accounts/{account_identifier}/vectorize/indexes", - page=AsyncSinglePage[CreateIndex], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=CreateIndex, - ) - - async def delete( - self, - index_name: str, - *, - account_identifier: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IndexDeleteResponse: - """ - Deletes the specified Vectorize Index. - - Args: - account_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - if not index_name: - raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") - return cast( - IndexDeleteResponse, - await self._delete( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[IndexDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - async def delete_by_ids( - self, - index_name: str, - *, - account_identifier: str, - ids: List[str] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IndexDeleteVectorsByID]: - """ - Delete a set of vectors from an index by their vector identifiers. - - Args: - account_identifier: Identifier - - ids: A list of vector identifiers to delete from the index indicated by the path. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - if not index_name: - raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") - return await self._post( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}/delete-by-ids", - body=await async_maybe_transform({"ids": ids}, index_delete_by_ids_params.IndexDeleteByIDsParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[IndexDeleteVectorsByID]], ResultWrapper[IndexDeleteVectorsByID]), - ) - - async def get( - self, - index_name: str, - *, - account_identifier: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CreateIndex]: - """ - Returns the specified Vectorize Index. - - Args: - account_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - if not index_name: - raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") - return await self._get( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[CreateIndex]], ResultWrapper[CreateIndex]), - ) - - async def get_by_ids( - self, - index_name: str, - *, - account_identifier: str, - ids: List[str] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: - """ - Get a set of vectors from an index by their vector identifiers. - - Args: - account_identifier: Identifier - - ids: A list of vector identifiers to retrieve from the index indicated by the path. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - if not index_name: - raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") - return await self._post( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}/get-by-ids", - body=await async_maybe_transform({"ids": ids}, index_get_by_ids_params.IndexGetByIDsParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[object], ResultWrapper[object]), - ) - - async def insert( - self, - index_name: str, - *, - account_identifier: str, - body: object, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IndexInsert]: - """ - Inserts vectors into the specified index and returns the count of the vectors - successfully inserted. - - Args: - account_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - if not index_name: - raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") - return await self._post( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}/insert", - body=await async_maybe_transform(body, index_insert_params.IndexInsertParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[IndexInsert]], ResultWrapper[IndexInsert]), - ) - - async def query( - self, - index_name: str, - *, - account_identifier: str, - return_metadata: bool | NotGiven = NOT_GIVEN, - return_values: bool | NotGiven = NOT_GIVEN, - top_k: float | NotGiven = NOT_GIVEN, - vector: Iterable[float] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IndexQuery]: - """ - Finds vectors closest to a given vector in an index. - - Args: - account_identifier: Identifier - - return_metadata: Whether to return the metadata associated with the closest vectors. - - return_values: Whether to return the values associated with the closest vectors. - - top_k: The number of nearest neighbors to find. - - vector: The search vector that will be used to find the nearest neighbors. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - if not index_name: - raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") - return await self._post( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}/query", - body=await async_maybe_transform( - { - "return_metadata": return_metadata, - "return_values": return_values, - "top_k": top_k, - "vector": vector, - }, - index_query_params.IndexQueryParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[IndexQuery]], ResultWrapper[IndexQuery]), - ) - - async def upsert( - self, - index_name: str, - *, - account_identifier: str, - body: object, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IndexUpsert]: - """ - Upserts vectors into the specified index, creating them if they do not exist and - returns the count of values and ids successfully inserted. - - Args: - account_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - if not index_name: - raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") - return await self._post( - f"/accounts/{account_identifier}/vectorize/indexes/{index_name}/upsert", - body=await async_maybe_transform(body, index_upsert_params.IndexUpsertParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[IndexUpsert]], ResultWrapper[IndexUpsert]), - ) - - -class IndexesWithRawResponse: - def __init__(self, indexes: Indexes) -> None: - self._indexes = indexes - - self.create = to_raw_response_wrapper( - indexes.create, - ) - self.update = to_raw_response_wrapper( - indexes.update, - ) - self.list = to_raw_response_wrapper( - indexes.list, - ) - self.delete = to_raw_response_wrapper( - indexes.delete, - ) - self.delete_by_ids = to_raw_response_wrapper( - indexes.delete_by_ids, - ) - self.get = to_raw_response_wrapper( - indexes.get, - ) - self.get_by_ids = to_raw_response_wrapper( - indexes.get_by_ids, - ) - self.insert = to_raw_response_wrapper( - indexes.insert, - ) - self.query = to_raw_response_wrapper( - indexes.query, - ) - self.upsert = to_raw_response_wrapper( - indexes.upsert, - ) - - -class AsyncIndexesWithRawResponse: - def __init__(self, indexes: AsyncIndexes) -> None: - self._indexes = indexes - - self.create = async_to_raw_response_wrapper( - indexes.create, - ) - self.update = async_to_raw_response_wrapper( - indexes.update, - ) - self.list = async_to_raw_response_wrapper( - indexes.list, - ) - self.delete = async_to_raw_response_wrapper( - indexes.delete, - ) - self.delete_by_ids = async_to_raw_response_wrapper( - indexes.delete_by_ids, - ) - self.get = async_to_raw_response_wrapper( - indexes.get, - ) - self.get_by_ids = async_to_raw_response_wrapper( - indexes.get_by_ids, - ) - self.insert = async_to_raw_response_wrapper( - indexes.insert, - ) - self.query = async_to_raw_response_wrapper( - indexes.query, - ) - self.upsert = async_to_raw_response_wrapper( - indexes.upsert, - ) - - -class IndexesWithStreamingResponse: - def __init__(self, indexes: Indexes) -> None: - self._indexes = indexes - - self.create = to_streamed_response_wrapper( - indexes.create, - ) - self.update = to_streamed_response_wrapper( - indexes.update, - ) - self.list = to_streamed_response_wrapper( - indexes.list, - ) - self.delete = to_streamed_response_wrapper( - indexes.delete, - ) - self.delete_by_ids = to_streamed_response_wrapper( - indexes.delete_by_ids, - ) - self.get = to_streamed_response_wrapper( - indexes.get, - ) - self.get_by_ids = to_streamed_response_wrapper( - indexes.get_by_ids, - ) - self.insert = to_streamed_response_wrapper( - indexes.insert, - ) - self.query = to_streamed_response_wrapper( - indexes.query, - ) - self.upsert = to_streamed_response_wrapper( - indexes.upsert, - ) - - -class AsyncIndexesWithStreamingResponse: - def __init__(self, indexes: AsyncIndexes) -> None: - self._indexes = indexes - - self.create = async_to_streamed_response_wrapper( - indexes.create, - ) - self.update = async_to_streamed_response_wrapper( - indexes.update, - ) - self.list = async_to_streamed_response_wrapper( - indexes.list, - ) - self.delete = async_to_streamed_response_wrapper( - indexes.delete, - ) - self.delete_by_ids = async_to_streamed_response_wrapper( - indexes.delete_by_ids, - ) - self.get = async_to_streamed_response_wrapper( - indexes.get, - ) - self.get_by_ids = async_to_streamed_response_wrapper( - indexes.get_by_ids, - ) - self.insert = async_to_streamed_response_wrapper( - indexes.insert, - ) - self.query = async_to_streamed_response_wrapper( - indexes.query, - ) - self.upsert = async_to_streamed_response_wrapper( - indexes.upsert, - ) diff --git a/src/cloudflare/resources/vectorize/vectorize.py b/src/cloudflare/resources/vectorize/vectorize.py deleted file mode 100644 index bb5adf5237dd..000000000000 --- a/src/cloudflare/resources/vectorize/vectorize.py +++ /dev/null @@ -1,80 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .indexes import ( - Indexes, - AsyncIndexes, - IndexesWithRawResponse, - AsyncIndexesWithRawResponse, - IndexesWithStreamingResponse, - AsyncIndexesWithStreamingResponse, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource - -__all__ = ["Vectorize", "AsyncVectorize"] - - -class Vectorize(SyncAPIResource): - @cached_property - def indexes(self) -> Indexes: - return Indexes(self._client) - - @cached_property - def with_raw_response(self) -> VectorizeWithRawResponse: - return VectorizeWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> VectorizeWithStreamingResponse: - return VectorizeWithStreamingResponse(self) - - -class AsyncVectorize(AsyncAPIResource): - @cached_property - def indexes(self) -> AsyncIndexes: - return AsyncIndexes(self._client) - - @cached_property - def with_raw_response(self) -> AsyncVectorizeWithRawResponse: - return AsyncVectorizeWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncVectorizeWithStreamingResponse: - return AsyncVectorizeWithStreamingResponse(self) - - -class VectorizeWithRawResponse: - def __init__(self, vectorize: Vectorize) -> None: - self._vectorize = vectorize - - @cached_property - def indexes(self) -> IndexesWithRawResponse: - return IndexesWithRawResponse(self._vectorize.indexes) - - -class AsyncVectorizeWithRawResponse: - def __init__(self, vectorize: AsyncVectorize) -> None: - self._vectorize = vectorize - - @cached_property - def indexes(self) -> AsyncIndexesWithRawResponse: - return AsyncIndexesWithRawResponse(self._vectorize.indexes) - - -class VectorizeWithStreamingResponse: - def __init__(self, vectorize: Vectorize) -> None: - self._vectorize = vectorize - - @cached_property - def indexes(self) -> IndexesWithStreamingResponse: - return IndexesWithStreamingResponse(self._vectorize.indexes) - - -class AsyncVectorizeWithStreamingResponse: - def __init__(self, vectorize: AsyncVectorize) -> None: - self._vectorize = vectorize - - @cached_property - def indexes(self) -> AsyncIndexesWithStreamingResponse: - return AsyncIndexesWithStreamingResponse(self._vectorize.indexes) diff --git a/src/cloudflare/types/vectorize/__init__.py b/src/cloudflare/types/vectorize/__init__.py index 756fca55ae59..f8ee8b14b1c9 100644 --- a/src/cloudflare/types/vectorize/__init__.py +++ b/src/cloudflare/types/vectorize/__init__.py @@ -1,19 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations - -from .index_query import IndexQuery as IndexQuery -from .create_index import CreateIndex as CreateIndex -from .index_insert import IndexInsert as IndexInsert -from .index_upsert import IndexUpsert as IndexUpsert -from .index_query_params import IndexQueryParams as IndexQueryParams -from .index_create_params import IndexCreateParams as IndexCreateParams -from .index_insert_params import IndexInsertParams as IndexInsertParams -from .index_update_params import IndexUpdateParams as IndexUpdateParams -from .index_upsert_params import IndexUpsertParams as IndexUpsertParams -from .index_delete_response import IndexDeleteResponse as IndexDeleteResponse -from .index_get_by_ids_params import IndexGetByIDsParams as IndexGetByIDsParams -from .index_delete_by_ids_params import IndexDeleteByIDsParams as IndexDeleteByIDsParams -from .index_delete_vectors_by_id import IndexDeleteVectorsByID as IndexDeleteVectorsByID -from .index_dimension_configuration import IndexDimensionConfiguration as IndexDimensionConfiguration -from .index_dimension_configuration_param import IndexDimensionConfigurationParam as IndexDimensionConfigurationParam diff --git a/src/cloudflare/types/vectorize/create_index.py b/src/cloudflare/types/vectorize/create_index.py deleted file mode 100644 index e28d4e352d41..000000000000 --- a/src/cloudflare/types/vectorize/create_index.py +++ /dev/null @@ -1,23 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel -from .index_dimension_configuration import IndexDimensionConfiguration - -__all__ = ["CreateIndex"] - - -class CreateIndex(BaseModel): - config: Optional[IndexDimensionConfiguration] = None - - created_on: Optional[str] = None - """Specifies the timestamp the resource was created as an ISO8601 string.""" - - description: Optional[str] = None - """Specifies the description of the index.""" - - modified_on: Optional[str] = None - """Specifies the timestamp the resource was modified as an ISO8601 string.""" - - name: Optional[str] = None diff --git a/src/cloudflare/types/vectorize/index_create_params.py b/src/cloudflare/types/vectorize/index_create_params.py deleted file mode 100644 index fd7928e4c3a3..000000000000 --- a/src/cloudflare/types/vectorize/index_create_params.py +++ /dev/null @@ -1,36 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from typing_extensions import Literal, Required, TypedDict - -from .index_dimension_configuration_param import IndexDimensionConfigurationParam - -__all__ = ["IndexCreateParams", "Config", "ConfigVectorizeIndexPresetConfiguration"] - - -class IndexCreateParams(TypedDict, total=False): - config: Required[Config] - """Specifies the type of configuration to use for the index.""" - - name: Required[str] - - description: str - """Specifies the description of the index.""" - - -class ConfigVectorizeIndexPresetConfiguration(TypedDict, total=False): - preset: Required[ - Literal[ - "@cf/baai/bge-small-en-v1.5", - "@cf/baai/bge-base-en-v1.5", - "@cf/baai/bge-large-en-v1.5", - "openai/text-embedding-ada-002", - "cohere/embed-multilingual-v2.0", - ] - ] - """Specifies the preset to use for the index.""" - - -Config = Union[ConfigVectorizeIndexPresetConfiguration, IndexDimensionConfigurationParam] diff --git a/src/cloudflare/types/vectorize/index_delete_by_ids_params.py b/src/cloudflare/types/vectorize/index_delete_by_ids_params.py deleted file mode 100644 index a9416916892a..000000000000 --- a/src/cloudflare/types/vectorize/index_delete_by_ids_params.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List -from typing_extensions import Required, TypedDict - -__all__ = ["IndexDeleteByIDsParams"] - - -class IndexDeleteByIDsParams(TypedDict, total=False): - account_identifier: Required[str] - """Identifier""" - - ids: List[str] - """A list of vector identifiers to delete from the index indicated by the path.""" diff --git a/src/cloudflare/types/vectorize/index_delete_response.py b/src/cloudflare/types/vectorize/index_delete_response.py deleted file mode 100644 index b64904cdd6e2..000000000000 --- a/src/cloudflare/types/vectorize/index_delete_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union, Optional - -__all__ = ["IndexDeleteResponse"] - -IndexDeleteResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/vectorize/index_delete_vectors_by_id.py b/src/cloudflare/types/vectorize/index_delete_vectors_by_id.py deleted file mode 100644 index b06650b76cbb..000000000000 --- a/src/cloudflare/types/vectorize/index_delete_vectors_by_id.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = ["IndexDeleteVectorsByID"] - - -class IndexDeleteVectorsByID(BaseModel): - count: Optional[int] = None - """The count of the vectors successfully deleted.""" - - ids: Optional[List[str]] = None - """ - Array of vector identifiers of the vectors that were successfully processed for - deletion. - """ diff --git a/src/cloudflare/types/vectorize/index_dimension_configuration.py b/src/cloudflare/types/vectorize/index_dimension_configuration.py deleted file mode 100644 index f9450682916c..000000000000 --- a/src/cloudflare/types/vectorize/index_dimension_configuration.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["IndexDimensionConfiguration"] - - -class IndexDimensionConfiguration(BaseModel): - dimensions: int - """Specifies the number of dimensions for the index""" - - metric: Literal["cosine", "euclidean", "dot-product"] - """Specifies the type of metric to use calculating distance.""" diff --git a/src/cloudflare/types/vectorize/index_dimension_configuration_param.py b/src/cloudflare/types/vectorize/index_dimension_configuration_param.py deleted file mode 100644 index 13c383d6dc2e..000000000000 --- a/src/cloudflare/types/vectorize/index_dimension_configuration_param.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["IndexDimensionConfigurationParam"] - - -class IndexDimensionConfigurationParam(TypedDict, total=False): - dimensions: Required[int] - """Specifies the number of dimensions for the index""" - - metric: Required[Literal["cosine", "euclidean", "dot-product"]] - """Specifies the type of metric to use calculating distance.""" diff --git a/src/cloudflare/types/vectorize/index_get_by_ids_params.py b/src/cloudflare/types/vectorize/index_get_by_ids_params.py deleted file mode 100644 index d29234183c10..000000000000 --- a/src/cloudflare/types/vectorize/index_get_by_ids_params.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List -from typing_extensions import Required, TypedDict - -__all__ = ["IndexGetByIDsParams"] - - -class IndexGetByIDsParams(TypedDict, total=False): - account_identifier: Required[str] - """Identifier""" - - ids: List[str] - """A list of vector identifiers to retrieve from the index indicated by the path.""" diff --git a/src/cloudflare/types/vectorize/index_insert.py b/src/cloudflare/types/vectorize/index_insert.py deleted file mode 100644 index 17cc6ecbe4b7..000000000000 --- a/src/cloudflare/types/vectorize/index_insert.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = ["IndexInsert"] - - -class IndexInsert(BaseModel): - count: Optional[int] = None - """Specifies the count of the vectors successfully inserted.""" - - ids: Optional[List[str]] = None - """Array of vector identifiers of the vectors successfully inserted.""" diff --git a/src/cloudflare/types/vectorize/index_insert_params.py b/src/cloudflare/types/vectorize/index_insert_params.py deleted file mode 100644 index 7dbc90f7e4df..000000000000 --- a/src/cloudflare/types/vectorize/index_insert_params.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["IndexInsertParams"] - - -class IndexInsertParams(TypedDict, total=False): - account_identifier: Required[str] - """Identifier""" - - body: Required[object] diff --git a/src/cloudflare/types/vectorize/index_query.py b/src/cloudflare/types/vectorize/index_query.py deleted file mode 100644 index 11de5c950e03..000000000000 --- a/src/cloudflare/types/vectorize/index_query.py +++ /dev/null @@ -1,27 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = ["IndexQuery", "Match"] - - -class Match(BaseModel): - id: Optional[str] = None - """Identifier""" - - metadata: Optional[object] = None - - score: Optional[float] = None - """The score of the vector according to the index's distance metric""" - - values: Optional[List[float]] = None - - -class IndexQuery(BaseModel): - count: Optional[int] = None - """Specifies the count of vectors returned by the search""" - - matches: Optional[List[Match]] = None - """Array of vectors matched by the search""" diff --git a/src/cloudflare/types/vectorize/index_query_params.py b/src/cloudflare/types/vectorize/index_query_params.py deleted file mode 100644 index e4853aa0ba56..000000000000 --- a/src/cloudflare/types/vectorize/index_query_params.py +++ /dev/null @@ -1,27 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable -from typing_extensions import Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["IndexQueryParams"] - - -class IndexQueryParams(TypedDict, total=False): - account_identifier: Required[str] - """Identifier""" - - return_metadata: Annotated[bool, PropertyInfo(alias="returnMetadata")] - """Whether to return the metadata associated with the closest vectors.""" - - return_values: Annotated[bool, PropertyInfo(alias="returnValues")] - """Whether to return the values associated with the closest vectors.""" - - top_k: Annotated[float, PropertyInfo(alias="topK")] - """The number of nearest neighbors to find.""" - - vector: Iterable[float] - """The search vector that will be used to find the nearest neighbors.""" diff --git a/src/cloudflare/types/vectorize/index_update_params.py b/src/cloudflare/types/vectorize/index_update_params.py deleted file mode 100644 index 57f2ab477d46..000000000000 --- a/src/cloudflare/types/vectorize/index_update_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["IndexUpdateParams"] - - -class IndexUpdateParams(TypedDict, total=False): - account_identifier: Required[str] - """Identifier""" - - description: Required[str] - """Specifies the description of the index.""" diff --git a/src/cloudflare/types/vectorize/index_upsert.py b/src/cloudflare/types/vectorize/index_upsert.py deleted file mode 100644 index 400b88324fab..000000000000 --- a/src/cloudflare/types/vectorize/index_upsert.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = ["IndexUpsert"] - - -class IndexUpsert(BaseModel): - count: Optional[int] = None - """Specifies the count of the vectors successfully inserted.""" - - ids: Optional[List[str]] = None - """Array of vector identifiers of the vectors successfully inserted.""" diff --git a/src/cloudflare/types/vectorize/index_upsert_params.py b/src/cloudflare/types/vectorize/index_upsert_params.py deleted file mode 100644 index 4831f16c7279..000000000000 --- a/src/cloudflare/types/vectorize/index_upsert_params.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["IndexUpsertParams"] - - -class IndexUpsertParams(TypedDict, total=False): - account_identifier: Required[str] - """Identifier""" - - body: Required[object] diff --git a/tests/api_resources/vectorize/test_indexes.py b/tests/api_resources/vectorize/test_indexes.py deleted file mode 100644 index 5f49d3ff9f3f..000000000000 --- a/tests/api_resources/vectorize/test_indexes.py +++ /dev/null @@ -1,1164 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.vectorize import ( - IndexQuery, - CreateIndex, - IndexInsert, - IndexUpsert, - IndexDeleteResponse, - IndexDeleteVectorsByID, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestIndexes: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_create(self, client: Cloudflare) -> None: - index = client.vectorize.indexes.create( - "023e105f4ecef8ad9ca31a8372d0c353", - config={"preset": "@cf/baai/bge-small-en-v1.5"}, - name="example-index", - ) - assert_matches_type(Optional[CreateIndex], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_create_with_all_params(self, client: Cloudflare) -> None: - index = client.vectorize.indexes.create( - "023e105f4ecef8ad9ca31a8372d0c353", - config={"preset": "@cf/baai/bge-small-en-v1.5"}, - name="example-index", - description="This is my example index.", - ) - assert_matches_type(Optional[CreateIndex], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.vectorize.indexes.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - config={"preset": "@cf/baai/bge-small-en-v1.5"}, - name="example-index", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - index = response.parse() - assert_matches_type(Optional[CreateIndex], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.vectorize.indexes.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - config={"preset": "@cf/baai/bge-small-en-v1.5"}, - name="example-index", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - index = response.parse() - assert_matches_type(Optional[CreateIndex], index, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - client.vectorize.indexes.with_raw_response.create( - "", - config={"preset": "@cf/baai/bge-small-en-v1.5"}, - name="example-index", - ) - - @pytest.mark.skip() - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - index = client.vectorize.indexes.update( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - description="This is my example index.", - ) - assert_matches_type(Optional[CreateIndex], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.vectorize.indexes.with_raw_response.update( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - description="This is my example index.", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - index = response.parse() - assert_matches_type(Optional[CreateIndex], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.vectorize.indexes.with_streaming_response.update( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - description="This is my example index.", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - index = response.parse() - assert_matches_type(Optional[CreateIndex], index, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - client.vectorize.indexes.with_raw_response.update( - "example-index", - account_identifier="", - description="This is my example index.", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): - client.vectorize.indexes.with_raw_response.update( - "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - description="This is my example index.", - ) - - @pytest.mark.skip() - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - index = client.vectorize.indexes.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(SyncSinglePage[CreateIndex], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.vectorize.indexes.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - index = response.parse() - assert_matches_type(SyncSinglePage[CreateIndex], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.vectorize.indexes.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - index = response.parse() - assert_matches_type(SyncSinglePage[CreateIndex], index, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - client.vectorize.indexes.with_raw_response.list( - "", - ) - - @pytest.mark.skip() - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - index = client.vectorize.indexes.delete( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(IndexDeleteResponse, index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.vectorize.indexes.with_raw_response.delete( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - index = response.parse() - assert_matches_type(IndexDeleteResponse, index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.vectorize.indexes.with_streaming_response.delete( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - index = response.parse() - assert_matches_type(IndexDeleteResponse, index, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - client.vectorize.indexes.with_raw_response.delete( - "example-index", - account_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): - client.vectorize.indexes.with_raw_response.delete( - "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - def test_method_delete_by_ids(self, client: Cloudflare) -> None: - index = client.vectorize.indexes.delete_by_ids( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[IndexDeleteVectorsByID], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_delete_by_ids_with_all_params(self, client: Cloudflare) -> None: - index = client.vectorize.indexes.delete_by_ids( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ids=["5121db81354a40c6aedc3fe1ace51c59", "f90eb49c2107486abdfd78c67e853430"], - ) - assert_matches_type(Optional[IndexDeleteVectorsByID], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_delete_by_ids(self, client: Cloudflare) -> None: - response = client.vectorize.indexes.with_raw_response.delete_by_ids( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - index = response.parse() - assert_matches_type(Optional[IndexDeleteVectorsByID], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_delete_by_ids(self, client: Cloudflare) -> None: - with client.vectorize.indexes.with_streaming_response.delete_by_ids( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - index = response.parse() - assert_matches_type(Optional[IndexDeleteVectorsByID], index, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_delete_by_ids(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - client.vectorize.indexes.with_raw_response.delete_by_ids( - "example-index", - account_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): - client.vectorize.indexes.with_raw_response.delete_by_ids( - "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - index = client.vectorize.indexes.get( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[CreateIndex], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.vectorize.indexes.with_raw_response.get( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - index = response.parse() - assert_matches_type(Optional[CreateIndex], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.vectorize.indexes.with_streaming_response.get( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - index = response.parse() - assert_matches_type(Optional[CreateIndex], index, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - client.vectorize.indexes.with_raw_response.get( - "example-index", - account_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): - client.vectorize.indexes.with_raw_response.get( - "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - def test_method_get_by_ids(self, client: Cloudflare) -> None: - index = client.vectorize.indexes.get_by_ids( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(object, index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_get_by_ids_with_all_params(self, client: Cloudflare) -> None: - index = client.vectorize.indexes.get_by_ids( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ids=["5121db81354a40c6aedc3fe1ace51c59", "f90eb49c2107486abdfd78c67e853430"], - ) - assert_matches_type(object, index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get_by_ids(self, client: Cloudflare) -> None: - response = client.vectorize.indexes.with_raw_response.get_by_ids( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - index = response.parse() - assert_matches_type(object, index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get_by_ids(self, client: Cloudflare) -> None: - with client.vectorize.indexes.with_streaming_response.get_by_ids( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - index = response.parse() - assert_matches_type(object, index, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get_by_ids(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - client.vectorize.indexes.with_raw_response.get_by_ids( - "example-index", - account_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): - client.vectorize.indexes.with_raw_response.get_by_ids( - "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - def test_method_insert(self, client: Cloudflare) -> None: - index = client.vectorize.indexes.insert( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - assert_matches_type(Optional[IndexInsert], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_insert(self, client: Cloudflare) -> None: - response = client.vectorize.indexes.with_raw_response.insert( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - index = response.parse() - assert_matches_type(Optional[IndexInsert], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_insert(self, client: Cloudflare) -> None: - with client.vectorize.indexes.with_streaming_response.insert( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - index = response.parse() - assert_matches_type(Optional[IndexInsert], index, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_insert(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - client.vectorize.indexes.with_raw_response.insert( - "example-index", - account_identifier="", - body={}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): - client.vectorize.indexes.with_raw_response.insert( - "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - - @pytest.mark.skip() - @parametrize - def test_method_query(self, client: Cloudflare) -> None: - index = client.vectorize.indexes.query( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[IndexQuery], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_query_with_all_params(self, client: Cloudflare) -> None: - index = client.vectorize.indexes.query( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - return_metadata=True, - return_values=True, - top_k=5, - vector=[0.5, 0.5, 0.5], - ) - assert_matches_type(Optional[IndexQuery], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_query(self, client: Cloudflare) -> None: - response = client.vectorize.indexes.with_raw_response.query( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - index = response.parse() - assert_matches_type(Optional[IndexQuery], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_query(self, client: Cloudflare) -> None: - with client.vectorize.indexes.with_streaming_response.query( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - index = response.parse() - assert_matches_type(Optional[IndexQuery], index, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_query(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - client.vectorize.indexes.with_raw_response.query( - "example-index", - account_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): - client.vectorize.indexes.with_raw_response.query( - "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - def test_method_upsert(self, client: Cloudflare) -> None: - index = client.vectorize.indexes.upsert( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - assert_matches_type(Optional[IndexUpsert], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_upsert(self, client: Cloudflare) -> None: - response = client.vectorize.indexes.with_raw_response.upsert( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - index = response.parse() - assert_matches_type(Optional[IndexUpsert], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_upsert(self, client: Cloudflare) -> None: - with client.vectorize.indexes.with_streaming_response.upsert( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - index = response.parse() - assert_matches_type(Optional[IndexUpsert], index, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_upsert(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - client.vectorize.indexes.with_raw_response.upsert( - "example-index", - account_identifier="", - body={}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): - client.vectorize.indexes.with_raw_response.upsert( - "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - - -class TestAsyncIndexes: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create(self, async_client: AsyncCloudflare) -> None: - index = await async_client.vectorize.indexes.create( - "023e105f4ecef8ad9ca31a8372d0c353", - config={"preset": "@cf/baai/bge-small-en-v1.5"}, - name="example-index", - ) - assert_matches_type(Optional[CreateIndex], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - index = await async_client.vectorize.indexes.create( - "023e105f4ecef8ad9ca31a8372d0c353", - config={"preset": "@cf/baai/bge-small-en-v1.5"}, - name="example-index", - description="This is my example index.", - ) - assert_matches_type(Optional[CreateIndex], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.vectorize.indexes.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - config={"preset": "@cf/baai/bge-small-en-v1.5"}, - name="example-index", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - index = await response.parse() - assert_matches_type(Optional[CreateIndex], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.vectorize.indexes.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - config={"preset": "@cf/baai/bge-small-en-v1.5"}, - name="example-index", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - index = await response.parse() - assert_matches_type(Optional[CreateIndex], index, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - await async_client.vectorize.indexes.with_raw_response.create( - "", - config={"preset": "@cf/baai/bge-small-en-v1.5"}, - name="example-index", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - index = await async_client.vectorize.indexes.update( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - description="This is my example index.", - ) - assert_matches_type(Optional[CreateIndex], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.vectorize.indexes.with_raw_response.update( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - description="This is my example index.", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - index = await response.parse() - assert_matches_type(Optional[CreateIndex], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.vectorize.indexes.with_streaming_response.update( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - description="This is my example index.", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - index = await response.parse() - assert_matches_type(Optional[CreateIndex], index, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - await async_client.vectorize.indexes.with_raw_response.update( - "example-index", - account_identifier="", - description="This is my example index.", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): - await async_client.vectorize.indexes.with_raw_response.update( - "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - description="This is my example index.", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - index = await async_client.vectorize.indexes.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(AsyncSinglePage[CreateIndex], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.vectorize.indexes.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - index = await response.parse() - assert_matches_type(AsyncSinglePage[CreateIndex], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.vectorize.indexes.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - index = await response.parse() - assert_matches_type(AsyncSinglePage[CreateIndex], index, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - await async_client.vectorize.indexes.with_raw_response.list( - "", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - index = await async_client.vectorize.indexes.delete( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(IndexDeleteResponse, index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.vectorize.indexes.with_raw_response.delete( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - index = await response.parse() - assert_matches_type(IndexDeleteResponse, index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.vectorize.indexes.with_streaming_response.delete( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - index = await response.parse() - assert_matches_type(IndexDeleteResponse, index, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - await async_client.vectorize.indexes.with_raw_response.delete( - "example-index", - account_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): - await async_client.vectorize.indexes.with_raw_response.delete( - "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_delete_by_ids(self, async_client: AsyncCloudflare) -> None: - index = await async_client.vectorize.indexes.delete_by_ids( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[IndexDeleteVectorsByID], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_delete_by_ids_with_all_params(self, async_client: AsyncCloudflare) -> None: - index = await async_client.vectorize.indexes.delete_by_ids( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ids=["5121db81354a40c6aedc3fe1ace51c59", "f90eb49c2107486abdfd78c67e853430"], - ) - assert_matches_type(Optional[IndexDeleteVectorsByID], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_delete_by_ids(self, async_client: AsyncCloudflare) -> None: - response = await async_client.vectorize.indexes.with_raw_response.delete_by_ids( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - index = await response.parse() - assert_matches_type(Optional[IndexDeleteVectorsByID], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_delete_by_ids(self, async_client: AsyncCloudflare) -> None: - async with async_client.vectorize.indexes.with_streaming_response.delete_by_ids( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - index = await response.parse() - assert_matches_type(Optional[IndexDeleteVectorsByID], index, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_delete_by_ids(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - await async_client.vectorize.indexes.with_raw_response.delete_by_ids( - "example-index", - account_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): - await async_client.vectorize.indexes.with_raw_response.delete_by_ids( - "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - index = await async_client.vectorize.indexes.get( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[CreateIndex], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.vectorize.indexes.with_raw_response.get( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - index = await response.parse() - assert_matches_type(Optional[CreateIndex], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.vectorize.indexes.with_streaming_response.get( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - index = await response.parse() - assert_matches_type(Optional[CreateIndex], index, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - await async_client.vectorize.indexes.with_raw_response.get( - "example-index", - account_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): - await async_client.vectorize.indexes.with_raw_response.get( - "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_get_by_ids(self, async_client: AsyncCloudflare) -> None: - index = await async_client.vectorize.indexes.get_by_ids( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(object, index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_get_by_ids_with_all_params(self, async_client: AsyncCloudflare) -> None: - index = await async_client.vectorize.indexes.get_by_ids( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ids=["5121db81354a40c6aedc3fe1ace51c59", "f90eb49c2107486abdfd78c67e853430"], - ) - assert_matches_type(object, index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get_by_ids(self, async_client: AsyncCloudflare) -> None: - response = await async_client.vectorize.indexes.with_raw_response.get_by_ids( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - index = await response.parse() - assert_matches_type(object, index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get_by_ids(self, async_client: AsyncCloudflare) -> None: - async with async_client.vectorize.indexes.with_streaming_response.get_by_ids( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - index = await response.parse() - assert_matches_type(object, index, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get_by_ids(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - await async_client.vectorize.indexes.with_raw_response.get_by_ids( - "example-index", - account_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): - await async_client.vectorize.indexes.with_raw_response.get_by_ids( - "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_insert(self, async_client: AsyncCloudflare) -> None: - index = await async_client.vectorize.indexes.insert( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - assert_matches_type(Optional[IndexInsert], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_insert(self, async_client: AsyncCloudflare) -> None: - response = await async_client.vectorize.indexes.with_raw_response.insert( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - index = await response.parse() - assert_matches_type(Optional[IndexInsert], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_insert(self, async_client: AsyncCloudflare) -> None: - async with async_client.vectorize.indexes.with_streaming_response.insert( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - index = await response.parse() - assert_matches_type(Optional[IndexInsert], index, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_insert(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - await async_client.vectorize.indexes.with_raw_response.insert( - "example-index", - account_identifier="", - body={}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): - await async_client.vectorize.indexes.with_raw_response.insert( - "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - - @pytest.mark.skip() - @parametrize - async def test_method_query(self, async_client: AsyncCloudflare) -> None: - index = await async_client.vectorize.indexes.query( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[IndexQuery], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_query_with_all_params(self, async_client: AsyncCloudflare) -> None: - index = await async_client.vectorize.indexes.query( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - return_metadata=True, - return_values=True, - top_k=5, - vector=[0.5, 0.5, 0.5], - ) - assert_matches_type(Optional[IndexQuery], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_query(self, async_client: AsyncCloudflare) -> None: - response = await async_client.vectorize.indexes.with_raw_response.query( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - index = await response.parse() - assert_matches_type(Optional[IndexQuery], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_query(self, async_client: AsyncCloudflare) -> None: - async with async_client.vectorize.indexes.with_streaming_response.query( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - index = await response.parse() - assert_matches_type(Optional[IndexQuery], index, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_query(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - await async_client.vectorize.indexes.with_raw_response.query( - "example-index", - account_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): - await async_client.vectorize.indexes.with_raw_response.query( - "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_upsert(self, async_client: AsyncCloudflare) -> None: - index = await async_client.vectorize.indexes.upsert( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - assert_matches_type(Optional[IndexUpsert], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_upsert(self, async_client: AsyncCloudflare) -> None: - response = await async_client.vectorize.indexes.with_raw_response.upsert( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - index = await response.parse() - assert_matches_type(Optional[IndexUpsert], index, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_upsert(self, async_client: AsyncCloudflare) -> None: - async with async_client.vectorize.indexes.with_streaming_response.upsert( - "example-index", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - index = await response.parse() - assert_matches_type(Optional[IndexUpsert], index, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_upsert(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - await async_client.vectorize.indexes.with_raw_response.upsert( - "example-index", - account_identifier="", - body={}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): - await async_client.vectorize.indexes.with_raw_response.upsert( - "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - )