From f1c184ee625fa42d313a160efa2dbd517a0f5738 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Jul 2025 16:20:48 +0000 Subject: [PATCH 1/5] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 8071ffce..a7519b60 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 49 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-315b0ef2cbe106abc1299563d329b70c233e3bcbe5233db006fa09fbeafb7b62.yml openapi_spec_hash: 56fa40291a1ee5d7bfcde5654540cba8 -config_hash: e4d40031e9232e8e6c16e73430b7f535 +config_hash: ecd1ddc3fbd3072806e3a29c2f8910b9 From 52a6f0e00d2f44b74610cb208f531e5ead98427d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Jul 2025 16:28:32 +0000 Subject: [PATCH 2/5] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index a7519b60..fcbd8614 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 49 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-315b0ef2cbe106abc1299563d329b70c233e3bcbe5233db006fa09fbeafb7b62.yml openapi_spec_hash: 56fa40291a1ee5d7bfcde5654540cba8 -config_hash: ecd1ddc3fbd3072806e3a29c2f8910b9 +config_hash: 439b5981c2fb63306c76f2a17052d688 From 1a49ee97770a6422b4f1f953cafebb86b68de320 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Jul 2025 16:29:17 +0000 Subject: [PATCH 3/5] feat(api): update via SDK Studio --- .stats.yml | 2 +- README.md | 63 +++++++++++++++++ api.md | 23 +++---- .../resources/data_sources/connectors.py | 22 +++--- .../resources/data_sources/data_sources.py | 22 +++--- src/mixedbread/resources/files.py | 22 +++--- src/mixedbread/resources/parsing/jobs.py | 21 +++--- .../resources/vector_stores/files.py | 22 +++--- .../resources/vector_stores/vector_stores.py | 22 +++--- src/mixedbread/types/__init__.py | 3 - .../types/data_source_list_response.py | 69 ------------------- src/mixedbread/types/data_sources/__init__.py | 1 - .../data_sources/connector_list_response.py | 69 ------------------- src/mixedbread/types/file_list_response.py | 69 ------------------- .../types/parsing/job_list_response.py | 66 +----------------- .../types/vector_store_list_response.py | 69 ------------------- .../types/vector_stores/__init__.py | 1 - .../types/vector_stores/file_list_response.py | 69 ------------------- .../data_sources/test_connectors.py | 18 ++--- tests/api_resources/parsing/test_jobs.py | 17 ++--- tests/api_resources/test_data_sources.py | 18 ++--- tests/api_resources/test_files.py | 23 +++---- tests/api_resources/test_vector_stores.py | 18 ++--- .../api_resources/vector_stores/test_files.py | 18 ++--- 24 files changed, 202 insertions(+), 545 deletions(-) delete mode 100644 src/mixedbread/types/data_source_list_response.py delete mode 100644 src/mixedbread/types/data_sources/connector_list_response.py delete mode 100644 src/mixedbread/types/file_list_response.py delete mode 100644 src/mixedbread/types/vector_store_list_response.py delete mode 100644 src/mixedbread/types/vector_stores/file_list_response.py diff --git a/.stats.yml b/.stats.yml index fcbd8614..f195d2e8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 49 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-315b0ef2cbe106abc1299563d329b70c233e3bcbe5233db006fa09fbeafb7b62.yml openapi_spec_hash: 56fa40291a1ee5d7bfcde5654540cba8 -config_hash: 439b5981c2fb63306c76f2a17052d688 +config_hash: d2da42a6eb83a404ee93a107e3b5c0f2 diff --git a/README.md b/README.md index 8bfd5cf1..ef53e23e 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,69 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`. +## Pagination + +List methods in the Mixedbread API are paginated. + +This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually: + +```python +from mixedbread import Mixedbread + +client = Mixedbread() + +all_vector_stores = [] +# Automatically fetches more pages as needed. +for vector_store in client.vector_stores.list(): + # Do something with vector_store here + all_vector_stores.append(vector_store) +print(all_vector_stores) +``` + +Or, asynchronously: + +```python +import asyncio +from mixedbread import AsyncMixedbread + +client = AsyncMixedbread() + + +async def main() -> None: + all_vector_stores = [] + # Iterate through items across all pages, issuing requests as needed. + async for vector_store in client.vector_stores.list(): + all_vector_stores.append(vector_store) + print(all_vector_stores) + + +asyncio.run(main()) +``` + +Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages: + +```python +first_page = await client.vector_stores.list() +if first_page.has_next_page(): + print(f"will fetch next page using these details: {first_page.next_page_info()}") + next_page = await first_page.get_next_page() + print(f"number of items we just fetched: {len(next_page.data)}") + +# Remove `await` for non-async usage. +``` + +Or just work directly with the returned data: + +```python +first_page = await client.vector_stores.list() + +print(f"next page cursor: {first_page.pagination.last_cursor}") # => "next page cursor: ..." +for vector_store in first_page.data: + print(vector_store.id) + +# Remove `await` for non-async usage. +``` + ## Nested params Nested parameters are dictionaries, typed using `TypedDict`, for example: diff --git a/api.md b/api.md index 71c47d0b..a9f5376f 100644 --- a/api.md +++ b/api.md @@ -37,7 +37,6 @@ from mixedbread.types import ( ScoredVideoURLInputChunk, VectorStore, VectorStoreChunkSearchOptions, - VectorStoreListResponse, VectorStoreDeleteResponse, VectorStoreQuestionAnsweringResponse, VectorStoreSearchResponse, @@ -49,7 +48,7 @@ Methods: - client.vector_stores.create(\*\*params) -> VectorStore - client.vector_stores.retrieve(vector_store_identifier) -> VectorStore - client.vector_stores.update(vector_store_identifier, \*\*params) -> VectorStore -- client.vector_stores.list(\*\*params) -> VectorStoreListResponse +- client.vector_stores.list(\*\*params) -> SyncCursor[VectorStore] - client.vector_stores.delete(vector_store_identifier) -> VectorStoreDeleteResponse - client.vector_stores.question_answering(\*\*params) -> VectorStoreQuestionAnsweringResponse - client.vector_stores.search(\*\*params) -> VectorStoreSearchResponse @@ -64,7 +63,6 @@ from mixedbread.types.vector_stores import ( ScoredVectorStoreFile, VectorStoreFileStatus, VectorStoreFile, - FileListResponse, FileDeleteResponse, FileSearchResponse, ) @@ -74,7 +72,7 @@ Methods: - client.vector_stores.files.create(vector_store_identifier, \*\*params) -> VectorStoreFile - client.vector_stores.files.retrieve(file_id, \*, vector_store_identifier) -> VectorStoreFile -- client.vector_stores.files.list(vector_store_identifier, \*\*params) -> FileListResponse +- client.vector_stores.files.list(vector_store_identifier, \*\*params) -> SyncCursor[VectorStoreFile] - client.vector_stores.files.delete(file_id, \*, vector_store_identifier) -> FileDeleteResponse - client.vector_stores.files.search(\*\*params) -> FileSearchResponse @@ -100,7 +98,7 @@ Methods: - client.parsing.jobs.create(\*\*params) -> ParsingJob - client.parsing.jobs.retrieve(job_id) -> ParsingJob -- client.parsing.jobs.list(\*\*params) -> JobListResponse +- client.parsing.jobs.list(\*\*params) -> SyncCursor[JobListResponse] - client.parsing.jobs.delete(job_id) -> JobDeleteResponse - client.parsing.jobs.cancel(job_id) -> ParsingJob @@ -109,7 +107,7 @@ Methods: Types: ```python -from mixedbread.types import FileObject, PaginationWithTotal, FileListResponse, FileDeleteResponse +from mixedbread.types import FileObject, PaginationWithTotal, FileDeleteResponse ``` Methods: @@ -117,7 +115,7 @@ Methods: - client.files.create(\*\*params) -> FileObject - client.files.retrieve(file_id) -> FileObject - client.files.update(file_id, \*\*params) -> FileObject -- client.files.list(\*\*params) -> FileListResponse +- client.files.list(\*\*params) -> SyncCursor[FileObject] - client.files.delete(file_id) -> FileDeleteResponse - client.files.content(file_id) -> BinaryAPIResponse @@ -186,7 +184,6 @@ from mixedbread.types import ( LinearDataSource, NotionDataSource, Oauth2Params, - DataSourceListResponse, DataSourceDeleteResponse, ) ``` @@ -196,7 +193,7 @@ Methods: - client.data_sources.create(\*\*params) -> DataSource - client.data_sources.retrieve(data_source_id) -> DataSource - client.data_sources.update(data_source_id, \*\*params) -> DataSource -- client.data_sources.list(\*\*params) -> DataSourceListResponse +- client.data_sources.list(\*\*params) -> SyncCursor[DataSource] - client.data_sources.delete(data_source_id) -> DataSourceDeleteResponse ## Connectors @@ -204,11 +201,7 @@ Methods: Types: ```python -from mixedbread.types.data_sources import ( - DataSourceConnector, - ConnectorListResponse, - ConnectorDeleteResponse, -) +from mixedbread.types.data_sources import DataSourceConnector, ConnectorDeleteResponse ``` Methods: @@ -216,7 +209,7 @@ Methods: - client.data_sources.connectors.create(data_source_id, \*\*params) -> DataSourceConnector - client.data_sources.connectors.retrieve(connector_id, \*, data_source_id) -> DataSourceConnector - client.data_sources.connectors.update(connector_id, \*, data_source_id, \*\*params) -> DataSourceConnector -- client.data_sources.connectors.list(data_source_id, \*\*params) -> ConnectorListResponse +- client.data_sources.connectors.list(data_source_id, \*\*params) -> SyncCursor[DataSourceConnector] - client.data_sources.connectors.delete(connector_id, \*, data_source_id) -> ConnectorDeleteResponse # APIKeys diff --git a/src/mixedbread/resources/data_sources/connectors.py b/src/mixedbread/resources/data_sources/connectors.py index f333b4e9..30c2ed30 100644 --- a/src/mixedbread/resources/data_sources/connectors.py +++ b/src/mixedbread/resources/data_sources/connectors.py @@ -16,10 +16,10 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._base_client import make_request_options +from ...pagination import SyncCursor, AsyncCursor +from ..._base_client import AsyncPaginator, make_request_options from ...types.data_sources import connector_list_params, connector_create_params, connector_update_params from ...types.data_sources.data_source_connector import DataSourceConnector -from ...types.data_sources.connector_list_response import ConnectorListResponse from ...types.data_sources.connector_delete_response import ConnectorDeleteResponse __all__ = ["ConnectorsResource", "AsyncConnectorsResource"] @@ -246,7 +246,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ConnectorListResponse: + ) -> SyncCursor[DataSourceConnector]: """ Get all connectors for a data source. @@ -278,8 +278,9 @@ def list( """ if not data_source_id: raise ValueError(f"Expected a non-empty value for `data_source_id` but received {data_source_id!r}") - return self._get( + return self._get_api_list( f"/v1/data_sources/{data_source_id}/connectors", + page=SyncCursor[DataSourceConnector], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -295,7 +296,7 @@ def list( connector_list_params.ConnectorListParams, ), ), - cast_to=ConnectorListResponse, + model=DataSourceConnector, ) def delete( @@ -551,7 +552,7 @@ async def update( cast_to=DataSourceConnector, ) - async def list( + def list( self, data_source_id: str, *, @@ -565,7 +566,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ConnectorListResponse: + ) -> AsyncPaginator[DataSourceConnector, AsyncCursor[DataSourceConnector]]: """ Get all connectors for a data source. @@ -597,14 +598,15 @@ async def list( """ if not data_source_id: raise ValueError(f"Expected a non-empty value for `data_source_id` but received {data_source_id!r}") - return await self._get( + return self._get_api_list( f"/v1/data_sources/{data_source_id}/connectors", + page=AsyncCursor[DataSourceConnector], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "limit": limit, "after": after, @@ -614,7 +616,7 @@ async def list( connector_list_params.ConnectorListParams, ), ), - cast_to=ConnectorListResponse, + model=DataSourceConnector, ) async def delete( diff --git a/src/mixedbread/resources/data_sources/data_sources.py b/src/mixedbread/resources/data_sources/data_sources.py index c8a83074..dd533886 100644 --- a/src/mixedbread/resources/data_sources/data_sources.py +++ b/src/mixedbread/resources/data_sources/data_sources.py @@ -32,11 +32,11 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._base_client import make_request_options +from ...pagination import SyncCursor, AsyncCursor +from ..._base_client import AsyncPaginator, make_request_options from ...types.data_source import DataSource from ...types.oauth2_params import Oauth2Params from ...types.data_source_type import DataSourceType -from ...types.data_source_list_response import DataSourceListResponse from ...types.data_source_delete_response import DataSourceDeleteResponse __all__ = ["DataSourcesResource", "AsyncDataSourcesResource"] @@ -365,7 +365,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DataSourceListResponse: + ) -> SyncCursor[DataSource]: """ Get all data sources. @@ -390,8 +390,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( "/v1/data_sources/", + page=SyncCursor[DataSource], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -407,7 +408,7 @@ def list( data_source_list_params.DataSourceListParams, ), ), - cast_to=DataSourceListResponse, + model=DataSource, ) def delete( @@ -758,7 +759,7 @@ async def update( cast_to=DataSource, ) - async def list( + def list( self, *, limit: int | NotGiven = NOT_GIVEN, @@ -771,7 +772,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DataSourceListResponse: + ) -> AsyncPaginator[DataSource, AsyncCursor[DataSource]]: """ Get all data sources. @@ -796,14 +797,15 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( "/v1/data_sources/", + page=AsyncCursor[DataSource], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "limit": limit, "after": after, @@ -813,7 +815,7 @@ async def list( data_source_list_params.DataSourceListParams, ), ), - cast_to=DataSourceListResponse, + model=DataSource, ) async def delete( diff --git a/src/mixedbread/resources/files.py b/src/mixedbread/resources/files.py index 10f6a213..5d00457d 100644 --- a/src/mixedbread/resources/files.py +++ b/src/mixedbread/resources/files.py @@ -25,9 +25,9 @@ async_to_custom_raw_response_wrapper, async_to_custom_streamed_response_wrapper, ) -from .._base_client import make_request_options +from ..pagination import SyncCursor, AsyncCursor +from .._base_client import AsyncPaginator, make_request_options from ..types.file_object import FileObject -from ..types.file_list_response import FileListResponse from ..types.file_delete_response import FileDeleteResponse __all__ = ["FilesResource", "AsyncFilesResource"] @@ -201,7 +201,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FileListResponse: + ) -> SyncCursor[FileObject]: """ List all files for the authenticated user. @@ -230,8 +230,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( "/v1/files", + page=SyncCursor[FileObject], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -248,7 +249,7 @@ def list( file_list_params.FileListParams, ), ), - cast_to=FileListResponse, + model=FileObject, ) def delete( @@ -485,7 +486,7 @@ async def update( cast_to=FileObject, ) - async def list( + def list( self, *, limit: int | NotGiven = NOT_GIVEN, @@ -499,7 +500,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FileListResponse: + ) -> AsyncPaginator[FileObject, AsyncCursor[FileObject]]: """ List all files for the authenticated user. @@ -528,14 +529,15 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( "/v1/files", + page=AsyncCursor[FileObject], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "limit": limit, "after": after, @@ -546,7 +548,7 @@ async def list( file_list_params.FileListParams, ), ), - cast_to=FileListResponse, + model=FileObject, ) async def delete( diff --git a/src/mixedbread/resources/parsing/jobs.py b/src/mixedbread/resources/parsing/jobs.py index ea6ec2d3..f329dd7c 100644 --- a/src/mixedbread/resources/parsing/jobs.py +++ b/src/mixedbread/resources/parsing/jobs.py @@ -19,7 +19,8 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._base_client import make_request_options +from ...pagination import SyncCursor, AsyncCursor +from ..._base_client import AsyncPaginator, make_request_options from ...types.parsing import ReturnFormat, ChunkingStrategy, job_list_params, job_create_params from ...types.parsing.parsing_job import ParsingJob from ...types.parsing.element_type import ElementType @@ -165,7 +166,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> JobListResponse: + ) -> SyncCursor[JobListResponse]: """List parsing jobs with pagination. Args: limit: The number of items to return. @@ -197,8 +198,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( "/v1/parsing/jobs", + page=SyncCursor[JobListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -216,7 +218,7 @@ def list( job_list_params.JobListParams, ), ), - cast_to=JobListResponse, + model=JobListResponse, ) def delete( @@ -573,7 +575,7 @@ async def retrieve( cast_to=ParsingJob, ) - async def list( + def list( self, *, limit: int | NotGiven = NOT_GIVEN, @@ -588,7 +590,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> JobListResponse: + ) -> AsyncPaginator[JobListResponse, AsyncCursor[JobListResponse]]: """List parsing jobs with pagination. Args: limit: The number of items to return. @@ -620,14 +622,15 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( "/v1/parsing/jobs", + page=AsyncCursor[JobListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "limit": limit, "after": after, @@ -639,7 +642,7 @@ async def list( job_list_params.JobListParams, ), ), - cast_to=JobListResponse, + model=JobListResponse, ) async def delete( diff --git a/src/mixedbread/resources/vector_stores/files.py b/src/mixedbread/resources/vector_stores/files.py index 6bd6b1c7..f73400a2 100644 --- a/src/mixedbread/resources/vector_stores/files.py +++ b/src/mixedbread/resources/vector_stores/files.py @@ -18,10 +18,10 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._base_client import make_request_options +from ...pagination import SyncCursor, AsyncCursor +from ..._base_client import AsyncPaginator, make_request_options from ...types.vector_stores import file_list_params, file_create_params, file_search_params from ...types.vector_stores.vector_store_file import VectorStoreFile -from ...types.vector_stores.file_list_response import FileListResponse from ...types.vector_stores.file_delete_response import FileDeleteResponse from ...types.vector_stores.file_search_response import FileSearchResponse from ...types.vector_stores.vector_store_file_status import VectorStoreFileStatus @@ -170,7 +170,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FileListResponse: + ) -> SyncCursor[VectorStoreFile]: """ List files indexed in a vector store with pagination. @@ -206,8 +206,9 @@ def list( raise ValueError( f"Expected a non-empty value for `vector_store_identifier` but received {vector_store_identifier!r}" ) - return self._get( + return self._get_api_list( f"/v1/vector_stores/{vector_store_identifier}/files", + page=SyncCursor[VectorStoreFile], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -224,7 +225,7 @@ def list( file_list_params.FileListParams, ), ), - cast_to=FileListResponse, + model=VectorStoreFile, ) def delete( @@ -583,7 +584,7 @@ async def retrieve( cast_to=VectorStoreFile, ) - async def list( + def list( self, vector_store_identifier: str, *, @@ -598,7 +599,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FileListResponse: + ) -> AsyncPaginator[VectorStoreFile, AsyncCursor[VectorStoreFile]]: """ List files indexed in a vector store with pagination. @@ -634,14 +635,15 @@ async def list( raise ValueError( f"Expected a non-empty value for `vector_store_identifier` but received {vector_store_identifier!r}" ) - return await self._get( + return self._get_api_list( f"/v1/vector_stores/{vector_store_identifier}/files", + page=AsyncCursor[VectorStoreFile], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "limit": limit, "after": after, @@ -652,7 +654,7 @@ async def list( file_list_params.FileListParams, ), ), - cast_to=FileListResponse, + model=VectorStoreFile, ) async def delete( diff --git a/src/mixedbread/resources/vector_stores/vector_stores.py b/src/mixedbread/resources/vector_stores/vector_stores.py index 96bf67de..7fb443de 100644 --- a/src/mixedbread/resources/vector_stores/vector_stores.py +++ b/src/mixedbread/resources/vector_stores/vector_stores.py @@ -31,10 +31,10 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._base_client import make_request_options +from ...pagination import SyncCursor, AsyncCursor +from ..._base_client import AsyncPaginator, make_request_options from ...types.vector_store import VectorStore from ...types.expires_after_param import ExpiresAfterParam -from ...types.vector_store_list_response import VectorStoreListResponse from ...types.vector_store_delete_response import VectorStoreDeleteResponse from ...types.vector_store_search_response import VectorStoreSearchResponse from ...types.vector_store_chunk_search_options_param import VectorStoreChunkSearchOptionsParam @@ -254,7 +254,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreListResponse: + ) -> SyncCursor[VectorStore]: """ List all vector stores with optional search. @@ -284,8 +284,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( "/v1/vector_stores", + page=SyncCursor[VectorStore], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -302,7 +303,7 @@ def list( vector_store_list_params.VectorStoreListParams, ), ), - cast_to=VectorStoreListResponse, + model=VectorStore, ) def delete( @@ -692,7 +693,7 @@ async def update( cast_to=VectorStore, ) - async def list( + def list( self, *, limit: int | NotGiven = NOT_GIVEN, @@ -706,7 +707,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreListResponse: + ) -> AsyncPaginator[VectorStore, AsyncCursor[VectorStore]]: """ List all vector stores with optional search. @@ -736,14 +737,15 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( "/v1/vector_stores", + page=AsyncCursor[VectorStore], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "limit": limit, "after": after, @@ -754,7 +756,7 @@ async def list( vector_store_list_params.VectorStoreListParams, ), ), - cast_to=VectorStoreListResponse, + model=VectorStore, ) async def delete( diff --git a/src/mixedbread/types/__init__.py b/src/mixedbread/types/__init__.py index a726eb8f..5fead10f 100644 --- a/src/mixedbread/types/__init__.py +++ b/src/mixedbread/types/__init__.py @@ -18,7 +18,6 @@ from .data_source_type import DataSourceType as DataSourceType from .file_list_params import FileListParams as FileListParams from .file_create_params import FileCreateParams as FileCreateParams -from .file_list_response import FileListResponse as FileListResponse from .file_update_params import FileUpdateParams as FileUpdateParams from .api_key_list_params import APIKeyListParams as APIKeyListParams from .client_embed_params import ClientEmbedParams as ClientEmbedParams @@ -36,12 +35,10 @@ from .notion_data_source_param import NotionDataSourceParam as NotionDataSourceParam from .vector_store_list_params import VectorStoreListParams as VectorStoreListParams from .data_source_create_params import DataSourceCreateParams as DataSourceCreateParams -from .data_source_list_response import DataSourceListResponse as DataSourceListResponse from .data_source_oauth2_params import DataSourceOauth2Params as DataSourceOauth2Params from .data_source_update_params import DataSourceUpdateParams as DataSourceUpdateParams from .embedding_create_response import EmbeddingCreateResponse as EmbeddingCreateResponse from .vector_store_create_params import VectorStoreCreateParams as VectorStoreCreateParams -from .vector_store_list_response import VectorStoreListResponse as VectorStoreListResponse from .vector_store_search_params import VectorStoreSearchParams as VectorStoreSearchParams from .vector_store_update_params import VectorStoreUpdateParams as VectorStoreUpdateParams from .data_source_delete_response import DataSourceDeleteResponse as DataSourceDeleteResponse diff --git a/src/mixedbread/types/data_source_list_response.py b/src/mixedbread/types/data_source_list_response.py deleted file mode 100644 index 0c7298f5..00000000 --- a/src/mixedbread/types/data_source_list_response.py +++ /dev/null @@ -1,69 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from .._models import BaseModel -from .data_source import DataSource - -__all__ = ["DataSourceListResponse", "Pagination"] - - -class Pagination(BaseModel): - has_more: bool - """ - Contextual direction-aware flag: True if more items exist in the requested - pagination direction. For 'after': more items after this page. For 'before': - more items before this page. - """ - - first_cursor: Optional[str] = None - """Cursor of the first item in this page. - - Use for backward pagination. None if page is empty. - """ - - last_cursor: Optional[str] = None - """Cursor of the last item in this page. - - Use for forward pagination. None if page is empty. - """ - - total: Optional[int] = None - """Total number of items available across all pages. - - Only included when include_total=true was requested. Expensive operation - use - sparingly. - """ - - -class DataSourceListResponse(BaseModel): - pagination: Pagination - """Response model for cursor-based pagination. - - Examples: Forward pagination response: { "has_more": true, "first_cursor": - "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMSIsImlkIjoiYWJjMTIzIn0=", "last_cursor": - "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMCIsImlkIjoieHl6Nzg5In0=", "total": null } - - Final page response: - { - "has_more": false, - "first_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0yOSIsImlkIjoibGFzdDEyMyJ9", - "last_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0yOCIsImlkIjoiZmluYWw0NTYifQ==", - "total": 42 - } - - Empty results: - { - "has_more": false, - "first_cursor": null, - "last_cursor": null, - "total": 0 - } - """ - - data: List[DataSource] - """The list of data sources""" - - object: Optional[Literal["list"]] = None - """The object type of the response""" diff --git a/src/mixedbread/types/data_sources/__init__.py b/src/mixedbread/types/data_sources/__init__.py index c925bcc7..c35b6f2e 100644 --- a/src/mixedbread/types/data_sources/__init__.py +++ b/src/mixedbread/types/data_sources/__init__.py @@ -5,6 +5,5 @@ from .connector_list_params import ConnectorListParams as ConnectorListParams from .data_source_connector import DataSourceConnector as DataSourceConnector from .connector_create_params import ConnectorCreateParams as ConnectorCreateParams -from .connector_list_response import ConnectorListResponse as ConnectorListResponse from .connector_update_params import ConnectorUpdateParams as ConnectorUpdateParams from .connector_delete_response import ConnectorDeleteResponse as ConnectorDeleteResponse diff --git a/src/mixedbread/types/data_sources/connector_list_response.py b/src/mixedbread/types/data_sources/connector_list_response.py deleted file mode 100644 index c6f2f388..00000000 --- a/src/mixedbread/types/data_sources/connector_list_response.py +++ /dev/null @@ -1,69 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from ..._models import BaseModel -from .data_source_connector import DataSourceConnector - -__all__ = ["ConnectorListResponse", "Pagination"] - - -class Pagination(BaseModel): - has_more: bool - """ - Contextual direction-aware flag: True if more items exist in the requested - pagination direction. For 'after': more items after this page. For 'before': - more items before this page. - """ - - first_cursor: Optional[str] = None - """Cursor of the first item in this page. - - Use for backward pagination. None if page is empty. - """ - - last_cursor: Optional[str] = None - """Cursor of the last item in this page. - - Use for forward pagination. None if page is empty. - """ - - total: Optional[int] = None - """Total number of items available across all pages. - - Only included when include_total=true was requested. Expensive operation - use - sparingly. - """ - - -class ConnectorListResponse(BaseModel): - pagination: Pagination - """Response model for cursor-based pagination. - - Examples: Forward pagination response: { "has_more": true, "first_cursor": - "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMSIsImlkIjoiYWJjMTIzIn0=", "last_cursor": - "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMCIsImlkIjoieHl6Nzg5In0=", "total": null } - - Final page response: - { - "has_more": false, - "first_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0yOSIsImlkIjoibGFzdDEyMyJ9", - "last_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0yOCIsImlkIjoiZmluYWw0NTYifQ==", - "total": 42 - } - - Empty results: - { - "has_more": false, - "first_cursor": null, - "last_cursor": null, - "total": 0 - } - """ - - data: List[DataSourceConnector] - """The list of connectors""" - - object: Optional[Literal["list"]] = None - """The object type of the response""" diff --git a/src/mixedbread/types/file_list_response.py b/src/mixedbread/types/file_list_response.py deleted file mode 100644 index c7322db2..00000000 --- a/src/mixedbread/types/file_list_response.py +++ /dev/null @@ -1,69 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from .._models import BaseModel -from .file_object import FileObject - -__all__ = ["FileListResponse", "Pagination"] - - -class Pagination(BaseModel): - has_more: bool - """ - Contextual direction-aware flag: True if more items exist in the requested - pagination direction. For 'after': more items after this page. For 'before': - more items before this page. - """ - - first_cursor: Optional[str] = None - """Cursor of the first item in this page. - - Use for backward pagination. None if page is empty. - """ - - last_cursor: Optional[str] = None - """Cursor of the last item in this page. - - Use for forward pagination. None if page is empty. - """ - - total: Optional[int] = None - """Total number of items available across all pages. - - Only included when include_total=true was requested. Expensive operation - use - sparingly. - """ - - -class FileListResponse(BaseModel): - pagination: Pagination - """Response model for cursor-based pagination. - - Examples: Forward pagination response: { "has_more": true, "first_cursor": - "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMSIsImlkIjoiYWJjMTIzIn0=", "last_cursor": - "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMCIsImlkIjoieHl6Nzg5In0=", "total": null } - - Final page response: - { - "has_more": false, - "first_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0yOSIsImlkIjoibGFzdDEyMyJ9", - "last_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0yOCIsImlkIjoiZmluYWw0NTYifQ==", - "total": 42 - } - - Empty results: - { - "has_more": false, - "first_cursor": null, - "last_cursor": null, - "total": 0 - } - """ - - object: Optional[Literal["list"]] = None - """The object type of the response""" - - data: List[FileObject] - """The list of files""" diff --git a/src/mixedbread/types/parsing/job_list_response.py b/src/mixedbread/types/parsing/job_list_response.py index 4b24ab2c..14b52eb4 100644 --- a/src/mixedbread/types/parsing/job_list_response.py +++ b/src/mixedbread/types/parsing/job_list_response.py @@ -1,44 +1,16 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel from .parsing_job_status import ParsingJobStatus -__all__ = ["JobListResponse", "Pagination", "Data"] +__all__ = ["JobListResponse"] -class Pagination(BaseModel): - has_more: bool - """ - Contextual direction-aware flag: True if more items exist in the requested - pagination direction. For 'after': more items after this page. For 'before': - more items before this page. - """ - - first_cursor: Optional[str] = None - """Cursor of the first item in this page. - - Use for backward pagination. None if page is empty. - """ - - last_cursor: Optional[str] = None - """Cursor of the last item in this page. - - Use for forward pagination. None if page is empty. - """ - - total: Optional[int] = None - """Total number of items available across all pages. - - Only included when include_total=true was requested. Expensive operation - use - sparingly. - """ - - -class Data(BaseModel): +class JobListResponse(BaseModel): id: str """The ID of the job""" @@ -65,35 +37,3 @@ class Data(BaseModel): object: Optional[Literal["parsing_job"]] = None """The type of the object""" - - -class JobListResponse(BaseModel): - pagination: Pagination - """Response model for cursor-based pagination. - - Examples: Forward pagination response: { "has_more": true, "first_cursor": - "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMSIsImlkIjoiYWJjMTIzIn0=", "last_cursor": - "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMCIsImlkIjoieHl6Nzg5In0=", "total": null } - - Final page response: - { - "has_more": false, - "first_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0yOSIsImlkIjoibGFzdDEyMyJ9", - "last_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0yOCIsImlkIjoiZmluYWw0NTYifQ==", - "total": 42 - } - - Empty results: - { - "has_more": false, - "first_cursor": null, - "last_cursor": null, - "total": 0 - } - """ - - data: List[Data] - """The list of parsing jobs""" - - object: Optional[Literal["list"]] = None - """The object type of the response""" diff --git a/src/mixedbread/types/vector_store_list_response.py b/src/mixedbread/types/vector_store_list_response.py deleted file mode 100644 index 5ab4c798..00000000 --- a/src/mixedbread/types/vector_store_list_response.py +++ /dev/null @@ -1,69 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from .._models import BaseModel -from .vector_store import VectorStore - -__all__ = ["VectorStoreListResponse", "Pagination"] - - -class Pagination(BaseModel): - has_more: bool - """ - Contextual direction-aware flag: True if more items exist in the requested - pagination direction. For 'after': more items after this page. For 'before': - more items before this page. - """ - - first_cursor: Optional[str] = None - """Cursor of the first item in this page. - - Use for backward pagination. None if page is empty. - """ - - last_cursor: Optional[str] = None - """Cursor of the last item in this page. - - Use for forward pagination. None if page is empty. - """ - - total: Optional[int] = None - """Total number of items available across all pages. - - Only included when include_total=true was requested. Expensive operation - use - sparingly. - """ - - -class VectorStoreListResponse(BaseModel): - pagination: Pagination - """Response model for cursor-based pagination. - - Examples: Forward pagination response: { "has_more": true, "first_cursor": - "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMSIsImlkIjoiYWJjMTIzIn0=", "last_cursor": - "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMCIsImlkIjoieHl6Nzg5In0=", "total": null } - - Final page response: - { - "has_more": false, - "first_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0yOSIsImlkIjoibGFzdDEyMyJ9", - "last_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0yOCIsImlkIjoiZmluYWw0NTYifQ==", - "total": 42 - } - - Empty results: - { - "has_more": false, - "first_cursor": null, - "last_cursor": null, - "total": 0 - } - """ - - object: Optional[Literal["list"]] = None - """The object type of the response""" - - data: List[VectorStore] - """The list of vector stores""" diff --git a/src/mixedbread/types/vector_stores/__init__.py b/src/mixedbread/types/vector_stores/__init__.py index f0cee6f2..6ce1aafe 100644 --- a/src/mixedbread/types/vector_stores/__init__.py +++ b/src/mixedbread/types/vector_stores/__init__.py @@ -5,7 +5,6 @@ from .file_list_params import FileListParams as FileListParams from .vector_store_file import VectorStoreFile as VectorStoreFile from .file_create_params import FileCreateParams as FileCreateParams -from .file_list_response import FileListResponse as FileListResponse from .file_search_params import FileSearchParams as FileSearchParams from .rerank_config_param import RerankConfigParam as RerankConfigParam from .file_delete_response import FileDeleteResponse as FileDeleteResponse diff --git a/src/mixedbread/types/vector_stores/file_list_response.py b/src/mixedbread/types/vector_stores/file_list_response.py deleted file mode 100644 index 252d1c93..00000000 --- a/src/mixedbread/types/vector_stores/file_list_response.py +++ /dev/null @@ -1,69 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from ..._models import BaseModel -from .vector_store_file import VectorStoreFile - -__all__ = ["FileListResponse", "Pagination"] - - -class Pagination(BaseModel): - has_more: bool - """ - Contextual direction-aware flag: True if more items exist in the requested - pagination direction. For 'after': more items after this page. For 'before': - more items before this page. - """ - - first_cursor: Optional[str] = None - """Cursor of the first item in this page. - - Use for backward pagination. None if page is empty. - """ - - last_cursor: Optional[str] = None - """Cursor of the last item in this page. - - Use for forward pagination. None if page is empty. - """ - - total: Optional[int] = None - """Total number of items available across all pages. - - Only included when include_total=true was requested. Expensive operation - use - sparingly. - """ - - -class FileListResponse(BaseModel): - pagination: Pagination - """Response model for cursor-based pagination. - - Examples: Forward pagination response: { "has_more": true, "first_cursor": - "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMSIsImlkIjoiYWJjMTIzIn0=", "last_cursor": - "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMCIsImlkIjoieHl6Nzg5In0=", "total": null } - - Final page response: - { - "has_more": false, - "first_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0yOSIsImlkIjoibGFzdDEyMyJ9", - "last_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0yOCIsImlkIjoiZmluYWw0NTYifQ==", - "total": 42 - } - - Empty results: - { - "has_more": false, - "first_cursor": null, - "last_cursor": null, - "total": 0 - } - """ - - object: Optional[Literal["list"]] = None - """The object type of the response""" - - data: List[VectorStoreFile] - """The list of vector store files""" diff --git a/tests/api_resources/data_sources/test_connectors.py b/tests/api_resources/data_sources/test_connectors.py index f0b2b2e3..23c313d4 100644 --- a/tests/api_resources/data_sources/test_connectors.py +++ b/tests/api_resources/data_sources/test_connectors.py @@ -9,9 +9,9 @@ from mixedbread import Mixedbread, AsyncMixedbread from tests.utils import assert_matches_type +from mixedbread.pagination import SyncCursor, AsyncCursor from mixedbread.types.data_sources import ( DataSourceConnector, - ConnectorListResponse, ConnectorDeleteResponse, ) @@ -188,7 +188,7 @@ def test_method_list(self, client: Mixedbread) -> None: connector = client.data_sources.connectors.list( data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) - assert_matches_type(ConnectorListResponse, connector, path=["response"]) + assert_matches_type(SyncCursor[DataSourceConnector], connector, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Mixedbread) -> None: @@ -199,7 +199,7 @@ def test_method_list_with_all_params(self, client: Mixedbread) -> None: before="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", include_total=False, ) - assert_matches_type(ConnectorListResponse, connector, path=["response"]) + assert_matches_type(SyncCursor[DataSourceConnector], connector, path=["response"]) @parametrize def test_raw_response_list(self, client: Mixedbread) -> None: @@ -210,7 +210,7 @@ def test_raw_response_list(self, client: Mixedbread) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connector = response.parse() - assert_matches_type(ConnectorListResponse, connector, path=["response"]) + assert_matches_type(SyncCursor[DataSourceConnector], connector, path=["response"]) @parametrize def test_streaming_response_list(self, client: Mixedbread) -> None: @@ -221,7 +221,7 @@ def test_streaming_response_list(self, client: Mixedbread) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" connector = response.parse() - assert_matches_type(ConnectorListResponse, connector, path=["response"]) + assert_matches_type(SyncCursor[DataSourceConnector], connector, path=["response"]) assert cast(Any, response.is_closed) is True @@ -453,7 +453,7 @@ async def test_method_list(self, async_client: AsyncMixedbread) -> None: connector = await async_client.data_sources.connectors.list( data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) - assert_matches_type(ConnectorListResponse, connector, path=["response"]) + assert_matches_type(AsyncCursor[DataSourceConnector], connector, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) -> None: @@ -464,7 +464,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) before="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", include_total=False, ) - assert_matches_type(ConnectorListResponse, connector, path=["response"]) + assert_matches_type(AsyncCursor[DataSourceConnector], connector, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None: @@ -475,7 +475,7 @@ async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connector = await response.parse() - assert_matches_type(ConnectorListResponse, connector, path=["response"]) + assert_matches_type(AsyncCursor[DataSourceConnector], connector, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> None: @@ -486,7 +486,7 @@ async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" connector = await response.parse() - assert_matches_type(ConnectorListResponse, connector, path=["response"]) + assert_matches_type(AsyncCursor[DataSourceConnector], connector, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/parsing/test_jobs.py b/tests/api_resources/parsing/test_jobs.py index 5ce07165..7ffccb59 100644 --- a/tests/api_resources/parsing/test_jobs.py +++ b/tests/api_resources/parsing/test_jobs.py @@ -9,6 +9,7 @@ from mixedbread import Mixedbread, AsyncMixedbread from tests.utils import assert_matches_type +from mixedbread.pagination import SyncCursor, AsyncCursor from mixedbread.types.parsing import ( ParsingJob, JobListResponse, @@ -104,7 +105,7 @@ def test_path_params_retrieve(self, client: Mixedbread) -> None: @parametrize def test_method_list(self, client: Mixedbread) -> None: job = client.parsing.jobs.list() - assert_matches_type(JobListResponse, job, path=["response"]) + assert_matches_type(SyncCursor[JobListResponse], job, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Mixedbread) -> None: @@ -116,7 +117,7 @@ def test_method_list_with_all_params(self, client: Mixedbread) -> None: statuses=["pending", "in_progress"], q="x", ) - assert_matches_type(JobListResponse, job, path=["response"]) + assert_matches_type(SyncCursor[JobListResponse], job, path=["response"]) @parametrize def test_raw_response_list(self, client: Mixedbread) -> None: @@ -125,7 +126,7 @@ def test_raw_response_list(self, client: Mixedbread) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" job = response.parse() - assert_matches_type(JobListResponse, job, path=["response"]) + assert_matches_type(SyncCursor[JobListResponse], job, path=["response"]) @parametrize def test_streaming_response_list(self, client: Mixedbread) -> None: @@ -134,7 +135,7 @@ def test_streaming_response_list(self, client: Mixedbread) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" job = response.parse() - assert_matches_type(JobListResponse, job, path=["response"]) + assert_matches_type(SyncCursor[JobListResponse], job, path=["response"]) assert cast(Any, response.is_closed) is True @@ -303,7 +304,7 @@ async def test_path_params_retrieve(self, async_client: AsyncMixedbread) -> None @parametrize async def test_method_list(self, async_client: AsyncMixedbread) -> None: job = await async_client.parsing.jobs.list() - assert_matches_type(JobListResponse, job, path=["response"]) + assert_matches_type(AsyncCursor[JobListResponse], job, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) -> None: @@ -315,7 +316,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) statuses=["pending", "in_progress"], q="x", ) - assert_matches_type(JobListResponse, job, path=["response"]) + assert_matches_type(AsyncCursor[JobListResponse], job, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None: @@ -324,7 +325,7 @@ async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" job = await response.parse() - assert_matches_type(JobListResponse, job, path=["response"]) + assert_matches_type(AsyncCursor[JobListResponse], job, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> None: @@ -333,7 +334,7 @@ async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" job = await response.parse() - assert_matches_type(JobListResponse, job, path=["response"]) + assert_matches_type(AsyncCursor[JobListResponse], job, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_data_sources.py b/tests/api_resources/test_data_sources.py index 3e2075e0..7ecf2ff1 100644 --- a/tests/api_resources/test_data_sources.py +++ b/tests/api_resources/test_data_sources.py @@ -11,9 +11,9 @@ from tests.utils import assert_matches_type from mixedbread.types import ( DataSource, - DataSourceListResponse, DataSourceDeleteResponse, ) +from mixedbread.pagination import SyncCursor, AsyncCursor base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -250,7 +250,7 @@ def test_path_params_update_overload_2(self, client: Mixedbread) -> None: @parametrize def test_method_list(self, client: Mixedbread) -> None: data_source = client.data_sources.list() - assert_matches_type(DataSourceListResponse, data_source, path=["response"]) + assert_matches_type(SyncCursor[DataSource], data_source, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Mixedbread) -> None: @@ -260,7 +260,7 @@ def test_method_list_with_all_params(self, client: Mixedbread) -> None: before="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", include_total=False, ) - assert_matches_type(DataSourceListResponse, data_source, path=["response"]) + assert_matches_type(SyncCursor[DataSource], data_source, path=["response"]) @parametrize def test_raw_response_list(self, client: Mixedbread) -> None: @@ -269,7 +269,7 @@ def test_raw_response_list(self, client: Mixedbread) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" data_source = response.parse() - assert_matches_type(DataSourceListResponse, data_source, path=["response"]) + assert_matches_type(SyncCursor[DataSource], data_source, path=["response"]) @parametrize def test_streaming_response_list(self, client: Mixedbread) -> None: @@ -278,7 +278,7 @@ def test_streaming_response_list(self, client: Mixedbread) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" data_source = response.parse() - assert_matches_type(DataSourceListResponse, data_source, path=["response"]) + assert_matches_type(SyncCursor[DataSource], data_source, path=["response"]) assert cast(Any, response.is_closed) is True @@ -555,7 +555,7 @@ async def test_path_params_update_overload_2(self, async_client: AsyncMixedbread @parametrize async def test_method_list(self, async_client: AsyncMixedbread) -> None: data_source = await async_client.data_sources.list() - assert_matches_type(DataSourceListResponse, data_source, path=["response"]) + assert_matches_type(AsyncCursor[DataSource], data_source, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) -> None: @@ -565,7 +565,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) before="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", include_total=False, ) - assert_matches_type(DataSourceListResponse, data_source, path=["response"]) + assert_matches_type(AsyncCursor[DataSource], data_source, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None: @@ -574,7 +574,7 @@ async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" data_source = await response.parse() - assert_matches_type(DataSourceListResponse, data_source, path=["response"]) + assert_matches_type(AsyncCursor[DataSource], data_source, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> None: @@ -583,7 +583,7 @@ async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" data_source = await response.parse() - assert_matches_type(DataSourceListResponse, data_source, path=["response"]) + assert_matches_type(AsyncCursor[DataSource], data_source, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_files.py b/tests/api_resources/test_files.py index 5fb0941b..62adce9b 100644 --- a/tests/api_resources/test_files.py +++ b/tests/api_resources/test_files.py @@ -11,17 +11,14 @@ from mixedbread import Mixedbread, AsyncMixedbread from tests.utils import assert_matches_type -from mixedbread.types import ( - FileObject, - FileListResponse, - FileDeleteResponse, -) +from mixedbread.types import FileObject, FileDeleteResponse from mixedbread._response import ( BinaryAPIResponse, AsyncBinaryAPIResponse, StreamedBinaryAPIResponse, AsyncStreamedBinaryAPIResponse, ) +from mixedbread.pagination import SyncCursor, AsyncCursor base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -143,7 +140,7 @@ def test_path_params_update(self, client: Mixedbread) -> None: @parametrize def test_method_list(self, client: Mixedbread) -> None: file = client.files.list() - assert_matches_type(FileListResponse, file, path=["response"]) + assert_matches_type(SyncCursor[FileObject], file, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Mixedbread) -> None: @@ -154,7 +151,7 @@ def test_method_list_with_all_params(self, client: Mixedbread) -> None: include_total=False, q="x", ) - assert_matches_type(FileListResponse, file, path=["response"]) + assert_matches_type(SyncCursor[FileObject], file, path=["response"]) @parametrize def test_raw_response_list(self, client: Mixedbread) -> None: @@ -163,7 +160,7 @@ def test_raw_response_list(self, client: Mixedbread) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" file = response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) + assert_matches_type(SyncCursor[FileObject], file, path=["response"]) @parametrize def test_streaming_response_list(self, client: Mixedbread) -> None: @@ -172,7 +169,7 @@ def test_streaming_response_list(self, client: Mixedbread) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" file = response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) + assert_matches_type(SyncCursor[FileObject], file, path=["response"]) assert cast(Any, response.is_closed) is True @@ -390,7 +387,7 @@ async def test_path_params_update(self, async_client: AsyncMixedbread) -> None: @parametrize async def test_method_list(self, async_client: AsyncMixedbread) -> None: file = await async_client.files.list() - assert_matches_type(FileListResponse, file, path=["response"]) + assert_matches_type(AsyncCursor[FileObject], file, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) -> None: @@ -401,7 +398,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) include_total=False, q="x", ) - assert_matches_type(FileListResponse, file, path=["response"]) + assert_matches_type(AsyncCursor[FileObject], file, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None: @@ -410,7 +407,7 @@ async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" file = await response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) + assert_matches_type(AsyncCursor[FileObject], file, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> None: @@ -419,7 +416,7 @@ async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" file = await response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) + assert_matches_type(AsyncCursor[FileObject], file, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_vector_stores.py b/tests/api_resources/test_vector_stores.py index f8a62782..cc5891a9 100644 --- a/tests/api_resources/test_vector_stores.py +++ b/tests/api_resources/test_vector_stores.py @@ -11,11 +11,11 @@ from tests.utils import assert_matches_type from mixedbread.types import ( VectorStore, - VectorStoreListResponse, VectorStoreDeleteResponse, VectorStoreSearchResponse, VectorStoreQuestionAnsweringResponse, ) +from mixedbread.pagination import SyncCursor, AsyncCursor base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -161,7 +161,7 @@ def test_path_params_update(self, client: Mixedbread) -> None: @parametrize def test_method_list(self, client: Mixedbread) -> None: vector_store = client.vector_stores.list() - assert_matches_type(VectorStoreListResponse, vector_store, path=["response"]) + assert_matches_type(SyncCursor[VectorStore], vector_store, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Mixedbread) -> None: @@ -172,7 +172,7 @@ def test_method_list_with_all_params(self, client: Mixedbread) -> None: include_total=False, q="x", ) - assert_matches_type(VectorStoreListResponse, vector_store, path=["response"]) + assert_matches_type(SyncCursor[VectorStore], vector_store, path=["response"]) @parametrize def test_raw_response_list(self, client: Mixedbread) -> None: @@ -181,7 +181,7 @@ def test_raw_response_list(self, client: Mixedbread) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" vector_store = response.parse() - assert_matches_type(VectorStoreListResponse, vector_store, path=["response"]) + assert_matches_type(SyncCursor[VectorStore], vector_store, path=["response"]) @parametrize def test_streaming_response_list(self, client: Mixedbread) -> None: @@ -190,7 +190,7 @@ def test_streaming_response_list(self, client: Mixedbread) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" vector_store = response.parse() - assert_matches_type(VectorStoreListResponse, vector_store, path=["response"]) + assert_matches_type(SyncCursor[VectorStore], vector_store, path=["response"]) assert cast(Any, response.is_closed) is True @@ -549,7 +549,7 @@ async def test_path_params_update(self, async_client: AsyncMixedbread) -> None: @parametrize async def test_method_list(self, async_client: AsyncMixedbread) -> None: vector_store = await async_client.vector_stores.list() - assert_matches_type(VectorStoreListResponse, vector_store, path=["response"]) + assert_matches_type(AsyncCursor[VectorStore], vector_store, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) -> None: @@ -560,7 +560,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) include_total=False, q="x", ) - assert_matches_type(VectorStoreListResponse, vector_store, path=["response"]) + assert_matches_type(AsyncCursor[VectorStore], vector_store, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None: @@ -569,7 +569,7 @@ async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" vector_store = await response.parse() - assert_matches_type(VectorStoreListResponse, vector_store, path=["response"]) + assert_matches_type(AsyncCursor[VectorStore], vector_store, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> None: @@ -578,7 +578,7 @@ async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" vector_store = await response.parse() - assert_matches_type(VectorStoreListResponse, vector_store, path=["response"]) + assert_matches_type(AsyncCursor[VectorStore], vector_store, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/vector_stores/test_files.py b/tests/api_resources/vector_stores/test_files.py index e3122544..1208d103 100644 --- a/tests/api_resources/vector_stores/test_files.py +++ b/tests/api_resources/vector_stores/test_files.py @@ -9,9 +9,9 @@ from mixedbread import Mixedbread, AsyncMixedbread from tests.utils import assert_matches_type +from mixedbread.pagination import SyncCursor, AsyncCursor from mixedbread.types.vector_stores import ( VectorStoreFile, - FileListResponse, FileDeleteResponse, FileSearchResponse, ) @@ -134,7 +134,7 @@ def test_method_list(self, client: Mixedbread) -> None: file = client.vector_stores.files.list( vector_store_identifier="vector_store_identifier", ) - assert_matches_type(FileListResponse, file, path=["response"]) + assert_matches_type(SyncCursor[VectorStoreFile], file, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Mixedbread) -> None: @@ -146,7 +146,7 @@ def test_method_list_with_all_params(self, client: Mixedbread) -> None: include_total=False, statuses=["pending", "in_progress"], ) - assert_matches_type(FileListResponse, file, path=["response"]) + assert_matches_type(SyncCursor[VectorStoreFile], file, path=["response"]) @parametrize def test_raw_response_list(self, client: Mixedbread) -> None: @@ -157,7 +157,7 @@ def test_raw_response_list(self, client: Mixedbread) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" file = response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) + assert_matches_type(SyncCursor[VectorStoreFile], file, path=["response"]) @parametrize def test_streaming_response_list(self, client: Mixedbread) -> None: @@ -168,7 +168,7 @@ def test_streaming_response_list(self, client: Mixedbread) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" file = response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) + assert_matches_type(SyncCursor[VectorStoreFile], file, path=["response"]) assert cast(Any, response.is_closed) is True @@ -437,7 +437,7 @@ async def test_method_list(self, async_client: AsyncMixedbread) -> None: file = await async_client.vector_stores.files.list( vector_store_identifier="vector_store_identifier", ) - assert_matches_type(FileListResponse, file, path=["response"]) + assert_matches_type(AsyncCursor[VectorStoreFile], file, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) -> None: @@ -449,7 +449,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) include_total=False, statuses=["pending", "in_progress"], ) - assert_matches_type(FileListResponse, file, path=["response"]) + assert_matches_type(AsyncCursor[VectorStoreFile], file, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None: @@ -460,7 +460,7 @@ async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" file = await response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) + assert_matches_type(AsyncCursor[VectorStoreFile], file, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> None: @@ -471,7 +471,7 @@ async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" file = await response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) + assert_matches_type(AsyncCursor[VectorStoreFile], file, path=["response"]) assert cast(Any, response.is_closed) is True From 9d5a391978da015a97e3fa4482f0e8a4f490af98 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Jul 2025 21:26:15 +0000 Subject: [PATCH 4/5] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index f195d2e8..7c7d6d61 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 49 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-315b0ef2cbe106abc1299563d329b70c233e3bcbe5233db006fa09fbeafb7b62.yml -openapi_spec_hash: 56fa40291a1ee5d7bfcde5654540cba8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-1cb5e131887b451004a08be20efac2fa11c58a80dcee0176c38182b335499f05.yml +openapi_spec_hash: 1476cba193e17ebfb4bbf20c74753b05 config_hash: d2da42a6eb83a404ee93a107e3b5c0f2 From 3c7857d8548a89ef3015a927106e539a2875bdb8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 4 Jul 2025 03:12:40 +0000 Subject: [PATCH 5/5] release: 0.17.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/mixedbread/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b4e9013b..6db19b95 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.16.0" + ".": "0.17.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 53cb41a1..a6d5cce8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.17.0 (2025-07-04) + +Full Changelog: [v0.16.0...v0.17.0](https://github.com/mixedbread-ai/mixedbread-python/compare/v0.16.0...v0.17.0) + +### Features + +* **api:** update via SDK Studio ([1a49ee9](https://github.com/mixedbread-ai/mixedbread-python/commit/1a49ee97770a6422b4f1f953cafebb86b68de320)) + ## 0.16.0 (2025-07-02) Full Changelog: [v0.15.0...v0.16.0](https://github.com/mixedbread-ai/mixedbread-python/compare/v0.15.0...v0.16.0) diff --git a/pyproject.toml b/pyproject.toml index d4b82f8b..bc769ba0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "mixedbread" -version = "0.16.0" +version = "0.17.0" description = "The official Python library for the Mixedbread API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/mixedbread/_version.py b/src/mixedbread/_version.py index 1fc64f37..596ec9fb 100644 --- a/src/mixedbread/_version.py +++ b/src/mixedbread/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "mixedbread" -__version__ = "0.16.0" # x-release-please-version +__version__ = "0.17.0" # x-release-please-version