From 0fe5e399cfd281bd969d1b7a7e4cf82b0f7640ca Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 11 Aug 2025 13:52:23 +0000 Subject: [PATCH 1/3] feat(api): api update --- .stats.yml | 6 +- api.md | 4 +- .../resources/vector_stores/files.py | 162 ++++++++++++++- src/mixedbread/types/__init__.py | 13 +- src/mixedbread/types/shared/__init__.py | 1 + src/mixedbread/types/shared/search_filter.py | 38 ++++ .../types/shared_params/__init__.py | 1 + .../types/shared_params/search_filter.py | 37 ++++ .../vector_store_question_answering_params.py | 62 +----- .../types/vector_store_search_params.py | 58 +----- .../types/vector_stores/__init__.py | 2 + .../types/vector_stores/file_list_params.py | 44 ++++ .../types/vector_stores/file_list_response.py | 69 +++++++ .../types/vector_stores/file_search_params.py | 63 +----- tests/api_resources/test_vector_stores.py | 156 ++------------ .../api_resources/vector_stores/test_files.py | 193 +++++++++++------- 16 files changed, 520 insertions(+), 389 deletions(-) create mode 100644 src/mixedbread/types/shared/search_filter.py create mode 100644 src/mixedbread/types/shared_params/search_filter.py create mode 100644 src/mixedbread/types/vector_stores/file_list_params.py create mode 100644 src/mixedbread/types/vector_stores/file_list_response.py diff --git a/.stats.yml b/.stats.yml index b9d7aea4..33d7691d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 48 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-7f00f72937a82d3184ef21bc91c848984d4c3bacf910a671ac2c5736025d862c.yml -openapi_spec_hash: 5c59e45eebcbb99551e308b194ec6243 +configured_endpoints: 49 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-4983c57f5143aaeadfbb4af35595570e613035ae500ff1597fdf600cc2a48959.yml +openapi_spec_hash: ecc0a6cfe61c3c959d034d094f36befe config_hash: ac27678c24558b71ee39b3db54fa12da diff --git a/api.md b/api.md index 0507d2b5..f251791d 100644 --- a/api.md +++ b/api.md @@ -1,7 +1,7 @@ # Shared Types ```python -from mixedbread.types import SearchFilterCondition, Usage +from mixedbread.types import SearchFilter, SearchFilterCondition, Usage ``` # Mixedbread @@ -63,6 +63,7 @@ from mixedbread.types.vector_stores import ( ScoredVectorStoreFile, VectorStoreFileStatus, VectorStoreFile, + FileListResponse, FileDeleteResponse, FileSearchResponse, ) @@ -72,6 +73,7 @@ Methods: - client.vector_stores.files.create(vector_store_identifier, \*\*params) -> VectorStoreFile - client.vector_stores.files.retrieve(file_id, \*, vector_store_identifier, \*\*params) -> VectorStoreFile +- client.vector_stores.files.list(vector_store_identifier, \*\*params) -> FileListResponse - client.vector_stores.files.delete(file_id, \*, vector_store_identifier) -> FileDeleteResponse - client.vector_stores.files.search(\*\*params) -> FileSearchResponse diff --git a/src/mixedbread/resources/vector_stores/files.py b/src/mixedbread/resources/vector_stores/files.py index 97873d48..7f1ef7c7 100644 --- a/src/mixedbread/resources/vector_stores/files.py +++ b/src/mixedbread/resources/vector_stores/files.py @@ -19,10 +19,12 @@ async_to_streamed_response_wrapper, ) from ..._base_client import make_request_options -from ...types.vector_stores import file_create_params, file_search_params, file_retrieve_params +from ...types.vector_stores import file_list_params, file_create_params, file_search_params, file_retrieve_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 __all__ = ["FilesResource", "AsyncFilesResource"] @@ -160,6 +162,79 @@ def retrieve( cast_to=VectorStoreFile, ) + def list( + self, + vector_store_identifier: str, + *, + limit: int | NotGiven = NOT_GIVEN, + after: Optional[str] | NotGiven = NOT_GIVEN, + before: Optional[str] | NotGiven = NOT_GIVEN, + include_total: bool | NotGiven = NOT_GIVEN, + statuses: Optional[List[VectorStoreFileStatus]] | NotGiven = NOT_GIVEN, + metadata_filter: Optional[file_list_params.MetadataFilter] | 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, + ) -> FileListResponse: + """ + List files indexed in a vector store with pagination and metadata filter. + + Args: vector_store_identifier: The ID or name of the vector store pagination: + Pagination parameters and metadata filter + + Returns: VectorStoreFileListResponse: Paginated list of vector store files + + Args: + vector_store_identifier: The ID or name of the vector store + + limit: Maximum number of items to return per page (1-100) + + after: Cursor for forward pagination - get items after this position. Use last_cursor + from previous response. + + before: Cursor for backward pagination - get items before this position. Use + first_cursor from previous response. + + include_total: Whether to include total count in response (expensive operation) + + statuses: Status to filter by + + metadata_filter: Metadata filter to apply to the query + + 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 vector_store_identifier: + raise ValueError( + f"Expected a non-empty value for `vector_store_identifier` but received {vector_store_identifier!r}" + ) + return self._post( + f"/v1/vector_stores/{vector_store_identifier}/files/list", + body=maybe_transform( + { + "limit": limit, + "after": after, + "before": before, + "include_total": include_total, + "statuses": statuses, + "metadata_filter": metadata_filter, + }, + file_list_params.FileListParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileListResponse, + ) + def delete( self, file_id: str, @@ -525,6 +600,79 @@ async def retrieve( cast_to=VectorStoreFile, ) + async def list( + self, + vector_store_identifier: str, + *, + limit: int | NotGiven = NOT_GIVEN, + after: Optional[str] | NotGiven = NOT_GIVEN, + before: Optional[str] | NotGiven = NOT_GIVEN, + include_total: bool | NotGiven = NOT_GIVEN, + statuses: Optional[List[VectorStoreFileStatus]] | NotGiven = NOT_GIVEN, + metadata_filter: Optional[file_list_params.MetadataFilter] | 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, + ) -> FileListResponse: + """ + List files indexed in a vector store with pagination and metadata filter. + + Args: vector_store_identifier: The ID or name of the vector store pagination: + Pagination parameters and metadata filter + + Returns: VectorStoreFileListResponse: Paginated list of vector store files + + Args: + vector_store_identifier: The ID or name of the vector store + + limit: Maximum number of items to return per page (1-100) + + after: Cursor for forward pagination - get items after this position. Use last_cursor + from previous response. + + before: Cursor for backward pagination - get items before this position. Use + first_cursor from previous response. + + include_total: Whether to include total count in response (expensive operation) + + statuses: Status to filter by + + metadata_filter: Metadata filter to apply to the query + + 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 vector_store_identifier: + raise ValueError( + f"Expected a non-empty value for `vector_store_identifier` but received {vector_store_identifier!r}" + ) + return await self._post( + f"/v1/vector_stores/{vector_store_identifier}/files/list", + body=await async_maybe_transform( + { + "limit": limit, + "after": after, + "before": before, + "include_total": include_total, + "statuses": statuses, + "metadata_filter": metadata_filter, + }, + file_list_params.FileListParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileListResponse, + ) + async def delete( self, file_id: str, @@ -769,6 +917,9 @@ def __init__(self, files: FilesResource) -> None: self.retrieve = to_raw_response_wrapper( files.retrieve, ) + self.list = to_raw_response_wrapper( + files.list, + ) self.delete = to_raw_response_wrapper( files.delete, ) @@ -787,6 +938,9 @@ def __init__(self, files: AsyncFilesResource) -> None: self.retrieve = async_to_raw_response_wrapper( files.retrieve, ) + self.list = async_to_raw_response_wrapper( + files.list, + ) self.delete = async_to_raw_response_wrapper( files.delete, ) @@ -805,6 +959,9 @@ def __init__(self, files: FilesResource) -> None: self.retrieve = to_streamed_response_wrapper( files.retrieve, ) + self.list = to_streamed_response_wrapper( + files.list, + ) self.delete = to_streamed_response_wrapper( files.delete, ) @@ -823,6 +980,9 @@ def __init__(self, files: AsyncFilesResource) -> None: self.retrieve = async_to_streamed_response_wrapper( files.retrieve, ) + self.list = async_to_streamed_response_wrapper( + files.list, + ) self.delete = async_to_streamed_response_wrapper( files.delete, ) diff --git a/src/mixedbread/types/__init__.py b/src/mixedbread/types/__init__.py index f548be8f..aca3e061 100644 --- a/src/mixedbread/types/__init__.py +++ b/src/mixedbread/types/__init__.py @@ -2,7 +2,9 @@ from __future__ import annotations -from .shared import Usage as Usage, SearchFilterCondition as SearchFilterCondition +from . import shared +from .. import _compat +from .shared import Usage as Usage, SearchFilter as SearchFilter, SearchFilterCondition as SearchFilterCondition from .api_key import APIKey as APIKey from .embedding import Embedding as Embedding from .data_source import DataSource as DataSource @@ -56,3 +58,12 @@ from .vector_store_question_answering_response import ( VectorStoreQuestionAnsweringResponse as VectorStoreQuestionAnsweringResponse, ) + +# Rebuild cyclical models only after all modules are imported. +# This ensures that, when building the deferred (due to cyclical references) model schema, +# Pydantic can resolve the necessary references. +# See: https://github.com/pydantic/pydantic/issues/11250 for more context. +if _compat.PYDANTIC_V2: + shared.search_filter.SearchFilter.model_rebuild(_parent_namespace_depth=0) +else: + shared.search_filter.SearchFilter.update_forward_refs() # type: ignore diff --git a/src/mixedbread/types/shared/__init__.py b/src/mixedbread/types/shared/__init__.py index bdd92589..66d5dcf9 100644 --- a/src/mixedbread/types/shared/__init__.py +++ b/src/mixedbread/types/shared/__init__.py @@ -1,4 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .usage import Usage as Usage +from .search_filter import SearchFilter as SearchFilter from .search_filter_condition import SearchFilterCondition as SearchFilterCondition diff --git a/src/mixedbread/types/shared/search_filter.py b/src/mixedbread/types/shared/search_filter.py new file mode 100644 index 00000000..579ae162 --- /dev/null +++ b/src/mixedbread/types/shared/search_filter.py @@ -0,0 +1,38 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import TYPE_CHECKING, List, Union, Optional +from typing_extensions import TypeAlias, TypeAliasType + +from ..._compat import PYDANTIC_V2 +from ..._models import BaseModel +from .search_filter_condition import SearchFilterCondition + +__all__ = ["SearchFilter", "All", "Any", "NoneType"] + +if TYPE_CHECKING or PYDANTIC_V2: + All = TypeAliasType("All", Union["SearchFilter", SearchFilterCondition]) +else: + All: TypeAlias = Union["SearchFilter", SearchFilterCondition] + +if TYPE_CHECKING or PYDANTIC_V2: + Any = TypeAliasType("Any", Union["SearchFilter", SearchFilterCondition]) +else: + Any: TypeAlias = Union["SearchFilter", SearchFilterCondition] + +if TYPE_CHECKING or PYDANTIC_V2: + NoneType = TypeAliasType("NoneType", Union["SearchFilter", SearchFilterCondition]) +else: + NoneType: TypeAlias = Union["SearchFilter", SearchFilterCondition] + + +class SearchFilter(BaseModel): + all: Optional[List[All]] = None + """List of conditions or filters to be ANDed together""" + + any: Optional[List[Any]] = None + """List of conditions or filters to be ORed together""" + + none: Optional[List[NoneType]] = None + """List of conditions or filters to be NOTed""" diff --git a/src/mixedbread/types/shared_params/__init__.py b/src/mixedbread/types/shared_params/__init__.py index 69d169c2..c91e740d 100644 --- a/src/mixedbread/types/shared_params/__init__.py +++ b/src/mixedbread/types/shared_params/__init__.py @@ -1,3 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .search_filter import SearchFilter as SearchFilter from .search_filter_condition import SearchFilterCondition as SearchFilterCondition diff --git a/src/mixedbread/types/shared_params/search_filter.py b/src/mixedbread/types/shared_params/search_filter.py new file mode 100644 index 00000000..a952a27a --- /dev/null +++ b/src/mixedbread/types/shared_params/search_filter.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import TYPE_CHECKING, Union, Iterable, Optional +from typing_extensions import TypeAlias, TypedDict, TypeAliasType + +from ..._compat import PYDANTIC_V2 +from .search_filter_condition import SearchFilterCondition + +__all__ = ["SearchFilter", "All", "Any", "NoneType"] + +if TYPE_CHECKING or PYDANTIC_V2: + All = TypeAliasType("All", Union["SearchFilter", SearchFilterCondition]) +else: + All: TypeAlias = Union["SearchFilter", SearchFilterCondition] + +if TYPE_CHECKING or PYDANTIC_V2: + Any = TypeAliasType("Any", Union["SearchFilter", SearchFilterCondition]) +else: + Any: TypeAlias = Union["SearchFilter", SearchFilterCondition] + +if TYPE_CHECKING or PYDANTIC_V2: + NoneType = TypeAliasType("NoneType", Union["SearchFilter", SearchFilterCondition]) +else: + NoneType: TypeAlias = Union["SearchFilter", SearchFilterCondition] + + +class SearchFilter(TypedDict, total=False): + all: Optional[Iterable[All]] + """List of conditions or filters to be ANDed together""" + + any: Optional[Iterable[Any]] + """List of conditions or filters to be ORed together""" + + none: Optional[Iterable[NoneType]] + """List of conditions or filters to be NOTed""" diff --git a/src/mixedbread/types/vector_store_question_answering_params.py b/src/mixedbread/types/vector_store_question_answering_params.py index 6a21ffca..b34189b3 100644 --- a/src/mixedbread/types/vector_store_question_answering_params.py +++ b/src/mixedbread/types/vector_store_question_answering_params.py @@ -8,20 +8,7 @@ from .shared_params.search_filter_condition import SearchFilterCondition from .vector_store_chunk_search_options_param import VectorStoreChunkSearchOptionsParam -__all__ = [ - "VectorStoreQuestionAnsweringParams", - "Filters", - "FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1", - "FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1All", - "FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1Any", - "FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1None", - "FiltersUnionMember2", - "FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1", - "FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1All", - "FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1Any", - "FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1None", - "QaOptions", -] +__all__ = ["VectorStoreQuestionAnsweringParams", "Filters", "FiltersUnionMember2", "QaOptions"] class VectorStoreQuestionAnsweringParams(TypedDict, total=False): @@ -55,49 +42,9 @@ class VectorStoreQuestionAnsweringParams(TypedDict, total=False): """Question answering configuration options""" -FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1All: TypeAlias = Union[SearchFilterCondition, object] +FiltersUnionMember2: TypeAlias = Union["SearchFilter", SearchFilterCondition] -FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1Any: TypeAlias = Union[SearchFilterCondition, object] - -FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1None: TypeAlias = Union[SearchFilterCondition, object] - - -class FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1(TypedDict, total=False): - all: Optional[Iterable[FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1All]] - """List of conditions or filters to be ANDed together""" - - any: Optional[Iterable[FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1Any]] - """List of conditions or filters to be ORed together""" - - none: Optional[Iterable[FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1None]] - """List of conditions or filters to be NOTed""" - - -FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1All: TypeAlias = Union[SearchFilterCondition, object] - -FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1Any: TypeAlias = Union[SearchFilterCondition, object] - -FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1None: TypeAlias = Union[SearchFilterCondition, object] - - -class FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1(TypedDict, total=False): - all: Optional[Iterable[FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1All]] - """List of conditions or filters to be ANDed together""" - - any: Optional[Iterable[FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1Any]] - """List of conditions or filters to be ORed together""" - - none: Optional[Iterable[FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1None]] - """List of conditions or filters to be NOTed""" - - -FiltersUnionMember2: TypeAlias = Union[ - FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1, SearchFilterCondition -] - -Filters: TypeAlias = Union[ - FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1, SearchFilterCondition, Iterable[FiltersUnionMember2] -] +Filters: TypeAlias = Union["SearchFilter", SearchFilterCondition, Iterable[FiltersUnionMember2]] class QaOptions(TypedDict, total=False): @@ -106,3 +53,6 @@ class QaOptions(TypedDict, total=False): multimodal: bool """Whether to use multimodal context""" + + +from .shared_params.search_filter import SearchFilter diff --git a/src/mixedbread/types/vector_store_search_params.py b/src/mixedbread/types/vector_store_search_params.py index 84eed57b..48fc21e1 100644 --- a/src/mixedbread/types/vector_store_search_params.py +++ b/src/mixedbread/types/vector_store_search_params.py @@ -8,19 +8,7 @@ from .shared_params.search_filter_condition import SearchFilterCondition from .vector_store_chunk_search_options_param import VectorStoreChunkSearchOptionsParam -__all__ = [ - "VectorStoreSearchParams", - "Filters", - "FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1", - "FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1All", - "FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1Any", - "FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1None", - "FiltersUnionMember2", - "FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1", - "FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1All", - "FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1Any", - "FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1None", -] +__all__ = ["VectorStoreSearchParams", "Filters", "FiltersUnionMember2"] class VectorStoreSearchParams(TypedDict, total=False): @@ -45,46 +33,8 @@ class VectorStoreSearchParams(TypedDict, total=False): """Search configuration options""" -FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1All: TypeAlias = Union[SearchFilterCondition, object] +FiltersUnionMember2: TypeAlias = Union["SearchFilter", SearchFilterCondition] -FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1Any: TypeAlias = Union[SearchFilterCondition, object] +Filters: TypeAlias = Union["SearchFilter", SearchFilterCondition, Iterable[FiltersUnionMember2]] -FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1None: TypeAlias = Union[SearchFilterCondition, object] - - -class FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1(TypedDict, total=False): - all: Optional[Iterable[FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1All]] - """List of conditions or filters to be ANDed together""" - - any: Optional[Iterable[FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1Any]] - """List of conditions or filters to be ORed together""" - - none: Optional[Iterable[FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1None]] - """List of conditions or filters to be NOTed""" - - -FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1All: TypeAlias = Union[SearchFilterCondition, object] - -FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1Any: TypeAlias = Union[SearchFilterCondition, object] - -FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1None: TypeAlias = Union[SearchFilterCondition, object] - - -class FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1(TypedDict, total=False): - all: Optional[Iterable[FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1All]] - """List of conditions or filters to be ANDed together""" - - any: Optional[Iterable[FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1Any]] - """List of conditions or filters to be ORed together""" - - none: Optional[Iterable[FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1None]] - """List of conditions or filters to be NOTed""" - - -FiltersUnionMember2: TypeAlias = Union[ - FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1, SearchFilterCondition -] - -Filters: TypeAlias = Union[ - FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1, SearchFilterCondition, Iterable[FiltersUnionMember2] -] +from .shared_params.search_filter import SearchFilter diff --git a/src/mixedbread/types/vector_stores/__init__.py b/src/mixedbread/types/vector_stores/__init__.py index a75412b9..dcfaa05b 100644 --- a/src/mixedbread/types/vector_stores/__init__.py +++ b/src/mixedbread/types/vector_stores/__init__.py @@ -2,8 +2,10 @@ from __future__ import annotations +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_params.py b/src/mixedbread/types/vector_stores/file_list_params.py new file mode 100644 index 00000000..a4ac03c8 --- /dev/null +++ b/src/mixedbread/types/vector_stores/file_list_params.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Iterable, Optional +from typing_extensions import TypeAlias, TypedDict + +from .vector_store_file_status import VectorStoreFileStatus +from ..shared_params.search_filter_condition import SearchFilterCondition + +__all__ = ["FileListParams", "MetadataFilter", "MetadataFilterUnionMember2"] + + +class FileListParams(TypedDict, total=False): + limit: int + """Maximum number of items to return per page (1-100)""" + + after: Optional[str] + """Cursor for forward pagination - get items after this position. + + Use last_cursor from previous response. + """ + + before: Optional[str] + """Cursor for backward pagination - get items before this position. + + Use first_cursor from previous response. + """ + + include_total: bool + """Whether to include total count in response (expensive operation)""" + + statuses: Optional[List[VectorStoreFileStatus]] + """Status to filter by""" + + metadata_filter: Optional[MetadataFilter] + """Metadata filter to apply to the query""" + + +MetadataFilterUnionMember2: TypeAlias = Union["SearchFilter", SearchFilterCondition] + +MetadataFilter: TypeAlias = Union["SearchFilter", SearchFilterCondition, Iterable[MetadataFilterUnionMember2]] + +from ..shared_params.search_filter import SearchFilter diff --git a/src/mixedbread/types/vector_stores/file_list_response.py b/src/mixedbread/types/vector_stores/file_list_response.py new file mode 100644 index 00000000..252d1c93 --- /dev/null +++ b/src/mixedbread/types/vector_stores/file_list_response.py @@ -0,0 +1,69 @@ +# 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/src/mixedbread/types/vector_stores/file_search_params.py b/src/mixedbread/types/vector_stores/file_search_params.py index 8954e6e5..3c289bc1 100644 --- a/src/mixedbread/types/vector_stores/file_search_params.py +++ b/src/mixedbread/types/vector_stores/file_search_params.py @@ -8,21 +8,7 @@ from .rerank_config_param import RerankConfigParam from ..shared_params.search_filter_condition import SearchFilterCondition -__all__ = [ - "FileSearchParams", - "Filters", - "FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1", - "FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1All", - "FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1Any", - "FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1None", - "FiltersUnionMember2", - "FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1", - "FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1All", - "FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1Any", - "FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1None", - "SearchOptions", - "SearchOptionsRerank", -] +__all__ = ["FileSearchParams", "Filters", "FiltersUnionMember2", "SearchOptions", "SearchOptionsRerank"] class FileSearchParams(TypedDict, total=False): @@ -47,49 +33,9 @@ class FileSearchParams(TypedDict, total=False): """Search configuration options""" -FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1All: TypeAlias = Union[SearchFilterCondition, object] +FiltersUnionMember2: TypeAlias = Union["SearchFilter", SearchFilterCondition] -FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1Any: TypeAlias = Union[SearchFilterCondition, object] - -FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1None: TypeAlias = Union[SearchFilterCondition, object] - - -class FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1(TypedDict, total=False): - all: Optional[Iterable[FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1All]] - """List of conditions or filters to be ANDed together""" - - any: Optional[Iterable[FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1Any]] - """List of conditions or filters to be ORed together""" - - none: Optional[Iterable[FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1None]] - """List of conditions or filters to be NOTed""" - - -FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1All: TypeAlias = Union[SearchFilterCondition, object] - -FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1Any: TypeAlias = Union[SearchFilterCondition, object] - -FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1None: TypeAlias = Union[SearchFilterCondition, object] - - -class FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1(TypedDict, total=False): - all: Optional[Iterable[FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1All]] - """List of conditions or filters to be ANDed together""" - - any: Optional[Iterable[FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1Any]] - """List of conditions or filters to be ORed together""" - - none: Optional[Iterable[FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1None]] - """List of conditions or filters to be NOTed""" - - -FiltersUnionMember2: TypeAlias = Union[ - FiltersUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter1, SearchFilterCondition -] - -Filters: TypeAlias = Union[ - FiltersMxbaiOmniCoreVectorStoreModelsSearchFilter1, SearchFilterCondition, Iterable[FiltersUnionMember2] -] +Filters: TypeAlias = Union["SearchFilter", SearchFilterCondition, Iterable[FiltersUnionMember2]] SearchOptionsRerank: TypeAlias = Union[bool, RerankConfigParam] @@ -115,3 +61,6 @@ class SearchOptions(TypedDict, total=False): apply_search_rules: bool """Whether to apply search rules""" + + +from ..shared_params.search_filter import SearchFilter diff --git a/tests/api_resources/test_vector_stores.py b/tests/api_resources/test_vector_stores.py index 88ab340d..ab5f0c96 100644 --- a/tests/api_resources/test_vector_stores.py +++ b/tests/api_resources/test_vector_stores.py @@ -247,42 +247,9 @@ def test_method_question_answering_with_all_params(self, client: Mixedbread) -> vector_store_ids=["string"], top_k=1, filters={ - "all": [ - { - "key": "price", - "value": "100", - "operator": "gt", - }, - { - "key": "color", - "value": "red", - "operator": "eq", - }, - ], - "any": [ - { - "key": "price", - "value": "100", - "operator": "gt", - }, - { - "key": "color", - "value": "red", - "operator": "eq", - }, - ], - "none": [ - { - "key": "price", - "value": "100", - "operator": "gt", - }, - { - "key": "color", - "value": "red", - "operator": "eq", - }, - ], + "all": [], + "any": [], + "none": [], }, file_ids=["123e4567-e89b-12d3-a456-426614174000", "123e4567-e89b-12d3-a456-426614174001"], search_options={ @@ -335,42 +302,9 @@ def test_method_search_with_all_params(self, client: Mixedbread) -> None: vector_store_ids=["string"], top_k=1, filters={ - "all": [ - { - "key": "price", - "value": "100", - "operator": "gt", - }, - { - "key": "color", - "value": "red", - "operator": "eq", - }, - ], - "any": [ - { - "key": "price", - "value": "100", - "operator": "gt", - }, - { - "key": "color", - "value": "red", - "operator": "eq", - }, - ], - "none": [ - { - "key": "price", - "value": "100", - "operator": "gt", - }, - { - "key": "color", - "value": "red", - "operator": "eq", - }, - ], + "all": [], + "any": [], + "none": [], }, file_ids=["123e4567-e89b-12d3-a456-426614174000", "123e4567-e89b-12d3-a456-426614174001"], search_options={ @@ -637,42 +571,9 @@ async def test_method_question_answering_with_all_params(self, async_client: Asy vector_store_ids=["string"], top_k=1, filters={ - "all": [ - { - "key": "price", - "value": "100", - "operator": "gt", - }, - { - "key": "color", - "value": "red", - "operator": "eq", - }, - ], - "any": [ - { - "key": "price", - "value": "100", - "operator": "gt", - }, - { - "key": "color", - "value": "red", - "operator": "eq", - }, - ], - "none": [ - { - "key": "price", - "value": "100", - "operator": "gt", - }, - { - "key": "color", - "value": "red", - "operator": "eq", - }, - ], + "all": [], + "any": [], + "none": [], }, file_ids=["123e4567-e89b-12d3-a456-426614174000", "123e4567-e89b-12d3-a456-426614174001"], search_options={ @@ -725,42 +626,9 @@ async def test_method_search_with_all_params(self, async_client: AsyncMixedbread vector_store_ids=["string"], top_k=1, filters={ - "all": [ - { - "key": "price", - "value": "100", - "operator": "gt", - }, - { - "key": "color", - "value": "red", - "operator": "eq", - }, - ], - "any": [ - { - "key": "price", - "value": "100", - "operator": "gt", - }, - { - "key": "color", - "value": "red", - "operator": "eq", - }, - ], - "none": [ - { - "key": "price", - "value": "100", - "operator": "gt", - }, - { - "key": "color", - "value": "red", - "operator": "eq", - }, - ], + "all": [], + "any": [], + "none": [], }, file_ids=["123e4567-e89b-12d3-a456-426614174000", "123e4567-e89b-12d3-a456-426614174001"], search_options={ diff --git a/tests/api_resources/vector_stores/test_files.py b/tests/api_resources/vector_stores/test_files.py index b24c14c2..15a1c34b 100644 --- a/tests/api_resources/vector_stores/test_files.py +++ b/tests/api_resources/vector_stores/test_files.py @@ -11,6 +11,7 @@ from tests.utils import assert_matches_type from mixedbread.types.vector_stores import ( VectorStoreFile, + FileListResponse, FileDeleteResponse, FileSearchResponse, ) @@ -137,6 +138,63 @@ def test_path_params_retrieve(self, client: Mixedbread) -> None: vector_store_identifier="vector_store_identifier", ) + @parametrize + 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"]) + + @parametrize + def test_method_list_with_all_params(self, client: Mixedbread) -> None: + file = client.vector_stores.files.list( + vector_store_identifier="vector_store_identifier", + limit=10, + after="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", + before="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", + include_total=False, + statuses=["pending"], + metadata_filter={ + "all": [], + "any": [], + "none": [], + }, + ) + assert_matches_type(FileListResponse, file, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Mixedbread) -> None: + response = client.vector_stores.files.with_raw_response.list( + vector_store_identifier="vector_store_identifier", + ) + + 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"]) + + @parametrize + def test_streaming_response_list(self, client: Mixedbread) -> None: + with client.vector_stores.files.with_streaming_response.list( + vector_store_identifier="vector_store_identifier", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = response.parse() + assert_matches_type(FileListResponse, file, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Mixedbread) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `vector_store_identifier` but received ''" + ): + client.vector_stores.files.with_raw_response.list( + vector_store_identifier="", + ) + @parametrize def test_method_delete(self, client: Mixedbread) -> None: file = client.vector_stores.files.delete( @@ -202,42 +260,9 @@ def test_method_search_with_all_params(self, client: Mixedbread) -> None: vector_store_ids=["string"], top_k=1, filters={ - "all": [ - { - "key": "price", - "value": "100", - "operator": "gt", - }, - { - "key": "color", - "value": "red", - "operator": "eq", - }, - ], - "any": [ - { - "key": "price", - "value": "100", - "operator": "gt", - }, - { - "key": "color", - "value": "red", - "operator": "eq", - }, - ], - "none": [ - { - "key": "price", - "value": "100", - "operator": "gt", - }, - { - "key": "color", - "value": "red", - "operator": "eq", - }, - ], + "all": [], + "any": [], + "none": [], }, file_ids=["123e4567-e89b-12d3-a456-426614174000", "123e4567-e89b-12d3-a456-426614174001"], search_options={ @@ -398,6 +423,63 @@ async def test_path_params_retrieve(self, async_client: AsyncMixedbread) -> None vector_store_identifier="vector_store_identifier", ) + @parametrize + 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"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) -> None: + file = await async_client.vector_stores.files.list( + vector_store_identifier="vector_store_identifier", + limit=10, + after="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", + before="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", + include_total=False, + statuses=["pending"], + metadata_filter={ + "all": [], + "any": [], + "none": [], + }, + ) + assert_matches_type(FileListResponse, file, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None: + response = await async_client.vector_stores.files.with_raw_response.list( + vector_store_identifier="vector_store_identifier", + ) + + 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"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> None: + async with async_client.vector_stores.files.with_streaming_response.list( + vector_store_identifier="vector_store_identifier", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = await response.parse() + assert_matches_type(FileListResponse, file, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncMixedbread) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `vector_store_identifier` but received ''" + ): + await async_client.vector_stores.files.with_raw_response.list( + vector_store_identifier="", + ) + @parametrize async def test_method_delete(self, async_client: AsyncMixedbread) -> None: file = await async_client.vector_stores.files.delete( @@ -463,42 +545,9 @@ async def test_method_search_with_all_params(self, async_client: AsyncMixedbread vector_store_ids=["string"], top_k=1, filters={ - "all": [ - { - "key": "price", - "value": "100", - "operator": "gt", - }, - { - "key": "color", - "value": "red", - "operator": "eq", - }, - ], - "any": [ - { - "key": "price", - "value": "100", - "operator": "gt", - }, - { - "key": "color", - "value": "red", - "operator": "eq", - }, - ], - "none": [ - { - "key": "price", - "value": "100", - "operator": "gt", - }, - { - "key": "color", - "value": "red", - "operator": "eq", - }, - ], + "all": [], + "any": [], + "none": [], }, file_ids=["123e4567-e89b-12d3-a456-426614174000", "123e4567-e89b-12d3-a456-426614174001"], search_options={ From b509fd02421db24df2ca65f4016deb7e6752f1c7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 11 Aug 2025 14:52:34 +0000 Subject: [PATCH 2/3] feat(api): update via SDK Studio --- .stats.yml | 4 +- api.md | 2 - .../resources/vector_stores/files.py | 162 +----------------- .../types/vector_stores/__init__.py | 2 - .../types/vector_stores/file_list_params.py | 44 ----- .../types/vector_stores/file_list_response.py | 69 -------- .../api_resources/vector_stores/test_files.py | 115 ------------- 7 files changed, 3 insertions(+), 395 deletions(-) delete mode 100644 src/mixedbread/types/vector_stores/file_list_params.py delete mode 100644 src/mixedbread/types/vector_stores/file_list_response.py diff --git a/.stats.yml b/.stats.yml index 33d7691d..fe2990a2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 49 +configured_endpoints: 48 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-4983c57f5143aaeadfbb4af35595570e613035ae500ff1597fdf600cc2a48959.yml openapi_spec_hash: ecc0a6cfe61c3c959d034d094f36befe -config_hash: ac27678c24558b71ee39b3db54fa12da +config_hash: d98614cc5eec7ec8807fcc86c1799d62 diff --git a/api.md b/api.md index f251791d..e2f621af 100644 --- a/api.md +++ b/api.md @@ -63,7 +63,6 @@ from mixedbread.types.vector_stores import ( ScoredVectorStoreFile, VectorStoreFileStatus, VectorStoreFile, - FileListResponse, FileDeleteResponse, FileSearchResponse, ) @@ -73,7 +72,6 @@ Methods: - client.vector_stores.files.create(vector_store_identifier, \*\*params) -> VectorStoreFile - client.vector_stores.files.retrieve(file_id, \*, vector_store_identifier, \*\*params) -> VectorStoreFile -- client.vector_stores.files.list(vector_store_identifier, \*\*params) -> FileListResponse - client.vector_stores.files.delete(file_id, \*, vector_store_identifier) -> FileDeleteResponse - client.vector_stores.files.search(\*\*params) -> FileSearchResponse diff --git a/src/mixedbread/resources/vector_stores/files.py b/src/mixedbread/resources/vector_stores/files.py index 7f1ef7c7..97873d48 100644 --- a/src/mixedbread/resources/vector_stores/files.py +++ b/src/mixedbread/resources/vector_stores/files.py @@ -19,12 +19,10 @@ async_to_streamed_response_wrapper, ) from ..._base_client import make_request_options -from ...types.vector_stores import file_list_params, file_create_params, file_search_params, file_retrieve_params +from ...types.vector_stores import file_create_params, file_search_params, file_retrieve_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 __all__ = ["FilesResource", "AsyncFilesResource"] @@ -162,79 +160,6 @@ def retrieve( cast_to=VectorStoreFile, ) - def list( - self, - vector_store_identifier: str, - *, - limit: int | NotGiven = NOT_GIVEN, - after: Optional[str] | NotGiven = NOT_GIVEN, - before: Optional[str] | NotGiven = NOT_GIVEN, - include_total: bool | NotGiven = NOT_GIVEN, - statuses: Optional[List[VectorStoreFileStatus]] | NotGiven = NOT_GIVEN, - metadata_filter: Optional[file_list_params.MetadataFilter] | 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, - ) -> FileListResponse: - """ - List files indexed in a vector store with pagination and metadata filter. - - Args: vector_store_identifier: The ID or name of the vector store pagination: - Pagination parameters and metadata filter - - Returns: VectorStoreFileListResponse: Paginated list of vector store files - - Args: - vector_store_identifier: The ID or name of the vector store - - limit: Maximum number of items to return per page (1-100) - - after: Cursor for forward pagination - get items after this position. Use last_cursor - from previous response. - - before: Cursor for backward pagination - get items before this position. Use - first_cursor from previous response. - - include_total: Whether to include total count in response (expensive operation) - - statuses: Status to filter by - - metadata_filter: Metadata filter to apply to the query - - 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 vector_store_identifier: - raise ValueError( - f"Expected a non-empty value for `vector_store_identifier` but received {vector_store_identifier!r}" - ) - return self._post( - f"/v1/vector_stores/{vector_store_identifier}/files/list", - body=maybe_transform( - { - "limit": limit, - "after": after, - "before": before, - "include_total": include_total, - "statuses": statuses, - "metadata_filter": metadata_filter, - }, - file_list_params.FileListParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FileListResponse, - ) - def delete( self, file_id: str, @@ -600,79 +525,6 @@ async def retrieve( cast_to=VectorStoreFile, ) - async def list( - self, - vector_store_identifier: str, - *, - limit: int | NotGiven = NOT_GIVEN, - after: Optional[str] | NotGiven = NOT_GIVEN, - before: Optional[str] | NotGiven = NOT_GIVEN, - include_total: bool | NotGiven = NOT_GIVEN, - statuses: Optional[List[VectorStoreFileStatus]] | NotGiven = NOT_GIVEN, - metadata_filter: Optional[file_list_params.MetadataFilter] | 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, - ) -> FileListResponse: - """ - List files indexed in a vector store with pagination and metadata filter. - - Args: vector_store_identifier: The ID or name of the vector store pagination: - Pagination parameters and metadata filter - - Returns: VectorStoreFileListResponse: Paginated list of vector store files - - Args: - vector_store_identifier: The ID or name of the vector store - - limit: Maximum number of items to return per page (1-100) - - after: Cursor for forward pagination - get items after this position. Use last_cursor - from previous response. - - before: Cursor for backward pagination - get items before this position. Use - first_cursor from previous response. - - include_total: Whether to include total count in response (expensive operation) - - statuses: Status to filter by - - metadata_filter: Metadata filter to apply to the query - - 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 vector_store_identifier: - raise ValueError( - f"Expected a non-empty value for `vector_store_identifier` but received {vector_store_identifier!r}" - ) - return await self._post( - f"/v1/vector_stores/{vector_store_identifier}/files/list", - body=await async_maybe_transform( - { - "limit": limit, - "after": after, - "before": before, - "include_total": include_total, - "statuses": statuses, - "metadata_filter": metadata_filter, - }, - file_list_params.FileListParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FileListResponse, - ) - async def delete( self, file_id: str, @@ -917,9 +769,6 @@ def __init__(self, files: FilesResource) -> None: self.retrieve = to_raw_response_wrapper( files.retrieve, ) - self.list = to_raw_response_wrapper( - files.list, - ) self.delete = to_raw_response_wrapper( files.delete, ) @@ -938,9 +787,6 @@ def __init__(self, files: AsyncFilesResource) -> None: self.retrieve = async_to_raw_response_wrapper( files.retrieve, ) - self.list = async_to_raw_response_wrapper( - files.list, - ) self.delete = async_to_raw_response_wrapper( files.delete, ) @@ -959,9 +805,6 @@ def __init__(self, files: FilesResource) -> None: self.retrieve = to_streamed_response_wrapper( files.retrieve, ) - self.list = to_streamed_response_wrapper( - files.list, - ) self.delete = to_streamed_response_wrapper( files.delete, ) @@ -980,9 +823,6 @@ def __init__(self, files: AsyncFilesResource) -> None: self.retrieve = async_to_streamed_response_wrapper( files.retrieve, ) - self.list = async_to_streamed_response_wrapper( - files.list, - ) self.delete = async_to_streamed_response_wrapper( files.delete, ) diff --git a/src/mixedbread/types/vector_stores/__init__.py b/src/mixedbread/types/vector_stores/__init__.py index dcfaa05b..a75412b9 100644 --- a/src/mixedbread/types/vector_stores/__init__.py +++ b/src/mixedbread/types/vector_stores/__init__.py @@ -2,10 +2,8 @@ from __future__ import annotations -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_params.py b/src/mixedbread/types/vector_stores/file_list_params.py deleted file mode 100644 index a4ac03c8..00000000 --- a/src/mixedbread/types/vector_stores/file_list_params.py +++ /dev/null @@ -1,44 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union, Iterable, Optional -from typing_extensions import TypeAlias, TypedDict - -from .vector_store_file_status import VectorStoreFileStatus -from ..shared_params.search_filter_condition import SearchFilterCondition - -__all__ = ["FileListParams", "MetadataFilter", "MetadataFilterUnionMember2"] - - -class FileListParams(TypedDict, total=False): - limit: int - """Maximum number of items to return per page (1-100)""" - - after: Optional[str] - """Cursor for forward pagination - get items after this position. - - Use last_cursor from previous response. - """ - - before: Optional[str] - """Cursor for backward pagination - get items before this position. - - Use first_cursor from previous response. - """ - - include_total: bool - """Whether to include total count in response (expensive operation)""" - - statuses: Optional[List[VectorStoreFileStatus]] - """Status to filter by""" - - metadata_filter: Optional[MetadataFilter] - """Metadata filter to apply to the query""" - - -MetadataFilterUnionMember2: TypeAlias = Union["SearchFilter", SearchFilterCondition] - -MetadataFilter: TypeAlias = Union["SearchFilter", SearchFilterCondition, Iterable[MetadataFilterUnionMember2]] - -from ..shared_params.search_filter import SearchFilter 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/vector_stores/test_files.py b/tests/api_resources/vector_stores/test_files.py index 15a1c34b..2c837f92 100644 --- a/tests/api_resources/vector_stores/test_files.py +++ b/tests/api_resources/vector_stores/test_files.py @@ -11,7 +11,6 @@ from tests.utils import assert_matches_type from mixedbread.types.vector_stores import ( VectorStoreFile, - FileListResponse, FileDeleteResponse, FileSearchResponse, ) @@ -138,63 +137,6 @@ def test_path_params_retrieve(self, client: Mixedbread) -> None: vector_store_identifier="vector_store_identifier", ) - @parametrize - 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"]) - - @parametrize - def test_method_list_with_all_params(self, client: Mixedbread) -> None: - file = client.vector_stores.files.list( - vector_store_identifier="vector_store_identifier", - limit=10, - after="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", - before="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", - include_total=False, - statuses=["pending"], - metadata_filter={ - "all": [], - "any": [], - "none": [], - }, - ) - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Mixedbread) -> None: - response = client.vector_stores.files.with_raw_response.list( - vector_store_identifier="vector_store_identifier", - ) - - 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"]) - - @parametrize - def test_streaming_response_list(self, client: Mixedbread) -> None: - with client.vector_stores.files.with_streaming_response.list( - vector_store_identifier="vector_store_identifier", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Mixedbread) -> None: - with pytest.raises( - ValueError, match=r"Expected a non-empty value for `vector_store_identifier` but received ''" - ): - client.vector_stores.files.with_raw_response.list( - vector_store_identifier="", - ) - @parametrize def test_method_delete(self, client: Mixedbread) -> None: file = client.vector_stores.files.delete( @@ -423,63 +365,6 @@ async def test_path_params_retrieve(self, async_client: AsyncMixedbread) -> None vector_store_identifier="vector_store_identifier", ) - @parametrize - 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"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) -> None: - file = await async_client.vector_stores.files.list( - vector_store_identifier="vector_store_identifier", - limit=10, - after="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", - before="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", - include_total=False, - statuses=["pending"], - metadata_filter={ - "all": [], - "any": [], - "none": [], - }, - ) - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None: - response = await async_client.vector_stores.files.with_raw_response.list( - vector_store_identifier="vector_store_identifier", - ) - - 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"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> None: - async with async_client.vector_stores.files.with_streaming_response.list( - vector_store_identifier="vector_store_identifier", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = await response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncMixedbread) -> None: - with pytest.raises( - ValueError, match=r"Expected a non-empty value for `vector_store_identifier` but received ''" - ): - await async_client.vector_stores.files.with_raw_response.list( - vector_store_identifier="", - ) - @parametrize async def test_method_delete(self, async_client: AsyncMixedbread) -> None: file = await async_client.vector_stores.files.delete( From d1f5698d4ba5825cfaa50261b5b2731c89e176e3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 11 Aug 2025 14:52:55 +0000 Subject: [PATCH 3/3] release: 0.25.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ pyproject.toml | 2 +- src/mixedbread/_version.py | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d2d60a3d..a36746b8 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.24.0" + ".": "0.25.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e73688f4..6255bdc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 0.25.0 (2025-08-11) + +Full Changelog: [v0.24.0...v0.25.0](https://github.com/mixedbread-ai/mixedbread-python/compare/v0.24.0...v0.25.0) + +### Features + +* **api:** api update ([0fe5e39](https://github.com/mixedbread-ai/mixedbread-python/commit/0fe5e399cfd281bd969d1b7a7e4cf82b0f7640ca)) +* **api:** update via SDK Studio ([b509fd0](https://github.com/mixedbread-ai/mixedbread-python/commit/b509fd02421db24df2ca65f4016deb7e6752f1c7)) + ## 0.24.0 (2025-08-11) Full Changelog: [v0.23.0...v0.24.0](https://github.com/mixedbread-ai/mixedbread-python/compare/v0.23.0...v0.24.0) diff --git a/pyproject.toml b/pyproject.toml index 02b76f19..666c8a59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "mixedbread" -version = "0.24.0" +version = "0.25.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 d3703aed..8b346a75 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.24.0" # x-release-please-version +__version__ = "0.25.0" # x-release-please-version