diff --git a/.release-please-manifest.json b/.release-please-manifest.json index cb9d2541..3f63a672 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.22.0" + ".": "0.22.1" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 5b9fef09..c7586392 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-7f00f72937a82d3184ef21bc91c848984d4c3bacf910a671ac2c5736025d862c.yml -openapi_spec_hash: 5c59e45eebcbb99551e308b194ec6243 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-4983c57f5143aaeadfbb4af35595570e613035ae500ff1597fdf600cc2a48959.yml +openapi_spec_hash: ecc0a6cfe61c3c959d034d094f36befe config_hash: 810d9712d3d0d6a1f50d71a25511d8a7 diff --git a/CHANGELOG.md b/CHANGELOG.md index 769210bd..8314ff8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 0.22.1 (2025-08-09) + +Full Changelog: [v0.22.0...v0.22.1](https://github.com/mixedbread-ai/mixedbread-python/compare/v0.22.0...v0.22.1) + +### Features + +* **api:** api update ([71c3ae0](https://github.com/mixedbread-ai/mixedbread-python/commit/71c3ae0def3c67a777c2dfaa7c1fc30c52d694ce)) + + +### Chores + +* **internal:** update comment in script ([03dc4dd](https://github.com/mixedbread-ai/mixedbread-python/commit/03dc4dd1fdc9d385c18cc20ba2f2274345b46721)) +* update @stainless-api/prism-cli to v5.15.0 ([bbb836a](https://github.com/mixedbread-ai/mixedbread-python/commit/bbb836accc961bb5316bb2ecfc5ac0983773c398)) + ## 0.22.0 (2025-08-06) Full Changelog: [v0.21.0...v0.22.0](https://github.com/mixedbread-ai/mixedbread-python/compare/v0.21.0...v0.22.0) diff --git a/api.md b/api.md index 39630d7d..257f5d28 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 diff --git a/pyproject.toml b/pyproject.toml index fc70b2dc..14fac4d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "mixedbread" -version = "0.22.0" +version = "0.22.1" description = "The official Python library for the Mixedbread API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/scripts/mock b/scripts/mock index d2814ae6..0b28f6ea 100755 --- a/scripts/mock +++ b/scripts/mock @@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then - npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & # Wait for server to come online echo -n "Waiting for server" @@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" fi diff --git a/scripts/test b/scripts/test index 2b878456..dbeda2d2 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! prism_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the prism command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}" echo exit 1 diff --git a/src/mixedbread/_version.py b/src/mixedbread/_version.py index fc182220..fc0f2056 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.22.0" # x-release-please-version +__version__ = "0.22.1" # x-release-please-version diff --git a/src/mixedbread/resources/vector_stores/files.py b/src/mixedbread/resources/vector_stores/files.py index 38f7bebe..44d28868 100644 --- a/src/mixedbread/resources/vector_stores/files.py +++ b/src/mixedbread/resources/vector_stores/files.py @@ -171,7 +171,6 @@ def list( 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, @@ -202,8 +201,6 @@ def list( 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 @@ -231,7 +228,6 @@ def list( "before": before, "include_total": include_total, "statuses": statuses, - "metadata_filter": metadata_filter, }, file_list_params.FileListParams, ), @@ -613,7 +609,6 @@ def list( 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, @@ -644,8 +639,6 @@ def list( 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 @@ -673,7 +666,6 @@ def list( "before": before, "include_total": include_total, "statuses": statuses, - "metadata_filter": metadata_filter, }, file_list_params.FileListParams, ), 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/file_list_params.py b/src/mixedbread/types/vector_stores/file_list_params.py index 3041af3a..49fe0c08 100644 --- a/src/mixedbread/types/vector_stores/file_list_params.py +++ b/src/mixedbread/types/vector_stores/file_list_params.py @@ -2,25 +2,12 @@ from __future__ import annotations -from typing import List, Union, Iterable, Optional -from typing_extensions import TypeAlias, TypedDict +from typing import List, Optional +from typing_extensions import TypedDict from .vector_store_file_status import VectorStoreFileStatus -from ..shared_params.search_filter_condition import SearchFilterCondition -__all__ = [ - "FileListParams", - "MetadataFilter", - "MetadataFilterMxbaiOmniCoreVectorStoreModelsSearchFilter2", - "MetadataFilterMxbaiOmniCoreVectorStoreModelsSearchFilter2All", - "MetadataFilterMxbaiOmniCoreVectorStoreModelsSearchFilter2Any", - "MetadataFilterMxbaiOmniCoreVectorStoreModelsSearchFilter2None", - "MetadataFilterUnionMember2", - "MetadataFilterUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter2", - "MetadataFilterUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter2All", - "MetadataFilterUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter2Any", - "MetadataFilterUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter2None", -] +__all__ = ["FileListParams"] class FileListParams(TypedDict, total=False): @@ -44,59 +31,3 @@ class FileListParams(TypedDict, total=False): statuses: Optional[List[VectorStoreFileStatus]] """Status to filter by""" - - metadata_filter: Optional[MetadataFilter] - """Metadata filter to apply to the query""" - - -MetadataFilterMxbaiOmniCoreVectorStoreModelsSearchFilter2All: TypeAlias = Union[SearchFilterCondition, object] - -MetadataFilterMxbaiOmniCoreVectorStoreModelsSearchFilter2Any: TypeAlias = Union[SearchFilterCondition, object] - -MetadataFilterMxbaiOmniCoreVectorStoreModelsSearchFilter2None: TypeAlias = Union[SearchFilterCondition, object] - - -class MetadataFilterMxbaiOmniCoreVectorStoreModelsSearchFilter2(TypedDict, total=False): - all: Optional[Iterable[MetadataFilterMxbaiOmniCoreVectorStoreModelsSearchFilter2All]] - """List of conditions or filters to be ANDed together""" - - any: Optional[Iterable[MetadataFilterMxbaiOmniCoreVectorStoreModelsSearchFilter2Any]] - """List of conditions or filters to be ORed together""" - - none: Optional[Iterable[MetadataFilterMxbaiOmniCoreVectorStoreModelsSearchFilter2None]] - """List of conditions or filters to be NOTed""" - - -MetadataFilterUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter2All: TypeAlias = Union[ - SearchFilterCondition, object -] - -MetadataFilterUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter2Any: TypeAlias = Union[ - SearchFilterCondition, object -] - -MetadataFilterUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter2None: TypeAlias = Union[ - SearchFilterCondition, object -] - - -class MetadataFilterUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter2(TypedDict, total=False): - all: Optional[Iterable[MetadataFilterUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter2All]] - """List of conditions or filters to be ANDed together""" - - any: Optional[Iterable[MetadataFilterUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter2Any]] - """List of conditions or filters to be ORed together""" - - none: Optional[Iterable[MetadataFilterUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter2None]] - """List of conditions or filters to be NOTed""" - - -MetadataFilterUnionMember2: TypeAlias = Union[ - MetadataFilterUnionMember2MxbaiOmniCoreVectorStoreModelsSearchFilter2, SearchFilterCondition -] - -MetadataFilter: TypeAlias = Union[ - MetadataFilterMxbaiOmniCoreVectorStoreModelsSearchFilter2, - SearchFilterCondition, - Iterable[MetadataFilterUnionMember2], -] 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 17014537..13922a78 100644 --- a/tests/api_resources/vector_stores/test_files.py +++ b/tests/api_resources/vector_stores/test_files.py @@ -154,44 +154,6 @@ def test_method_list_with_all_params(self, client: Mixedbread) -> None: before="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", include_total=False, statuses=["pending", "in_progress"], - metadata_filter={ - "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", - }, - ], - }, ) assert_matches_type(SyncCursor[VectorStoreFile], file, path=["response"]) @@ -293,42 +255,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={ @@ -505,44 +434,6 @@ async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) before="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", include_total=False, statuses=["pending", "in_progress"], - metadata_filter={ - "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", - }, - ], - }, ) assert_matches_type(AsyncCursor[VectorStoreFile], file, path=["response"]) @@ -644,42 +535,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={