diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0c41cec4..0f02ea1c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.38" + ".": "0.1.0-alpha.39" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index dfdb2a8c..7ce94546 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 32 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-82c2c1c322149cd73b2e8e45f475919b941752a89e74464ccecd1aee9352e9be.yml openapi_spec_hash: dbd7616a32c90fd25b32994830fb12f6 -config_hash: d4b3b47ba72c8829d6b804dd74b079c2 +config_hash: 564cc8bc5835fe03496be6aab6d4dc42 diff --git a/CHANGELOG.md b/CHANGELOG.md index fc424f40..4b66aca9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.1.0-alpha.39 (2025-04-03) + +Full Changelog: [v0.1.0-alpha.38...v0.1.0-alpha.39](https://github.com/mixedbread-ai/mixedbread-python/compare/v0.1.0-alpha.38...v0.1.0-alpha.39) + +### Features + +* **api:** update via SDK Studio ([#172](https://github.com/mixedbread-ai/mixedbread-python/issues/172)) ([4d49f3b](https://github.com/mixedbread-ai/mixedbread-python/commit/4d49f3b68fb2f71fc0f6577bb3195a5b44e7e7d9)) + ## 0.1.0-alpha.38 (2025-04-03) Full Changelog: [v0.1.0-alpha.37...v0.1.0-alpha.38](https://github.com/mixedbread-ai/mixedbread-python/compare/v0.1.0-alpha.37...v0.1.0-alpha.38) diff --git a/api.md b/api.md index c88b1319..c2a19d86 100644 --- a/api.md +++ b/api.md @@ -9,12 +9,12 @@ from mixedbread.types import SearchFilter, SearchFilterCondition Types: ```python -from mixedbread.types import EmbedResponse, InfoResponse, RerankResponse +from mixedbread.types import Embedding, EmbeddingCreateResponse, InfoResponse, RerankResponse ``` Methods: -- client.embed(\*\*params) -> EmbedResponse +- client.embed(\*\*params) -> EmbeddingCreateResponse - client.info() -> InfoResponse - client.rerank(\*\*params) -> RerankResponse @@ -145,12 +145,6 @@ Methods: # Embeddings -Types: - -```python -from mixedbread.types import EmbeddingCreateResponse -``` - Methods: - client.embeddings.create(\*\*params) -> EmbeddingCreateResponse diff --git a/pyproject.toml b/pyproject.toml index 4a2c8f3d..6b961a75 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "mixedbread" -version = "0.1.0-alpha.38" +version = "0.1.0-alpha.39" description = "The official Python library for the Mixedbread API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/mixedbread/_client.py b/src/mixedbread/_client.py index b9996076..30ff9cca 100644 --- a/src/mixedbread/_client.py +++ b/src/mixedbread/_client.py @@ -47,10 +47,10 @@ ) from .resources.parsing import parsing from .types.info_response import InfoResponse -from .types.embed_response import EmbedResponse from .resources.extractions import extractions from .types.rerank_response import RerankResponse from .resources.vector_stores import vector_stores +from .types.embedding_create_response import EmbeddingCreateResponse __all__ = [ "ENVIRONMENTS", @@ -257,7 +257,7 @@ def embed( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmbedResponse: + ) -> EmbeddingCreateResponse: """ Create embeddings for text or images using the specified model, encoding format, and normalization. @@ -304,7 +304,7 @@ def embed( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=EmbedResponse, + cast_to=EmbeddingCreateResponse, ) def info( @@ -614,7 +614,7 @@ async def embed( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmbedResponse: + ) -> EmbeddingCreateResponse: """ Create embeddings for text or images using the specified model, encoding format, and normalization. @@ -661,7 +661,7 @@ async def embed( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=EmbedResponse, + cast_to=EmbeddingCreateResponse, ) async def info( diff --git a/src/mixedbread/_version.py b/src/mixedbread/_version.py index 5a6196cd..5ce0d007 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.1.0-alpha.38" # x-release-please-version +__version__ = "0.1.0-alpha.39" # x-release-please-version diff --git a/src/mixedbread/types/__init__.py b/src/mixedbread/types/__init__.py index cdda6dd8..18991940 100644 --- a/src/mixedbread/types/__init__.py +++ b/src/mixedbread/types/__init__.py @@ -3,12 +3,12 @@ from __future__ import annotations from .shared import SearchFilter as SearchFilter, SearchFilterCondition as SearchFilterCondition +from .embedding import Embedding as Embedding from .file_counts import FileCounts as FileCounts from .file_object import FileObject as FileObject from .vector_store import VectorStore as VectorStore from .expires_after import ExpiresAfter as ExpiresAfter from .info_response import InfoResponse as InfoResponse -from .embed_response import EmbedResponse as EmbedResponse from .rerank_response import RerankResponse as RerankResponse from .file_list_params import FileListParams as FileListParams from .file_create_params import FileCreateParams as FileCreateParams diff --git a/src/mixedbread/types/embed_response.py b/src/mixedbread/types/embed_response.py deleted file mode 100644 index 75183ce0..00000000 --- a/src/mixedbread/types/embed_response.py +++ /dev/null @@ -1,98 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import builtins -from typing import List, Union, Optional -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["EmbedResponse", "Usage", "DataUnionMember0", "DataUnionMember1", "DataUnionMember1Embedding"] - - -class Usage(BaseModel): - prompt_tokens: int - """The number of tokens used for the prompt""" - - total_tokens: int - """The total number of tokens used""" - - completion_tokens: Optional[int] = None - """The number of tokens used for the completion""" - - -class DataUnionMember0(BaseModel): - embedding: Union[List[float], List[int], str] - """The encoded embedding.""" - - index: int - """The index of the embedding.""" - - object: Optional[Literal["embedding"]] = None - """The object type of the embedding.""" - - -class DataUnionMember1Embedding(BaseModel): - float: Optional[List[builtins.float]] = None - - int8: Optional[List[int]] = None - - uint8: Optional[List[int]] = None - - binary: Optional[List[int]] = None - - ubinary: Optional[List[int]] = None - - base64: Optional[str] = None - - -class DataUnionMember1(BaseModel): - embedding: DataUnionMember1Embedding - """ - The encoded embedding data by encoding format.Returned, if more than one - encoding format is used. - """ - - index: int - """The index of the embedding.""" - - object: Optional[Literal["embedding_dict"]] = None - """The object type of the embedding.""" - - -class EmbedResponse(BaseModel): - usage: Usage - """The usage of the model""" - - model: str - """The model used""" - - data: Union[List[DataUnionMember0], List[DataUnionMember1]] - """The created embeddings.""" - - object: Optional[ - Literal[ - "list", - "parsing_job", - "job", - "embedding", - "embedding_dict", - "rank_result", - "file", - "vector_store", - "vector_store.file", - "api_key", - ] - ] = None - """The object type of the response""" - - normalized: bool - """Whether the embeddings are normalized.""" - - encoding_format: Union[ - Literal["float", "float16", "base64", "binary", "ubinary", "int8", "uint8"], - List[Literal["float", "float16", "base64", "binary", "ubinary", "int8", "uint8"]], - ] - """The encoding formats of the embeddings.""" - - dimensions: Optional[int] = None - """The number of dimensions used for the embeddings.""" diff --git a/src/mixedbread/types/embedding.py b/src/mixedbread/types/embedding.py new file mode 100644 index 00000000..19fd8136 --- /dev/null +++ b/src/mixedbread/types/embedding.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["Embedding"] + + +class Embedding(BaseModel): + embedding: Union[List[float], List[int], str] + """The encoded embedding.""" + + index: int + """The index of the embedding.""" + + object: Optional[Literal["embedding"]] = None + """The object type of the embedding.""" diff --git a/src/mixedbread/types/embedding_create_response.py b/src/mixedbread/types/embedding_create_response.py index e95bf75a..c72e68cb 100644 --- a/src/mixedbread/types/embedding_create_response.py +++ b/src/mixedbread/types/embedding_create_response.py @@ -5,8 +5,9 @@ from typing_extensions import Literal from .._models import BaseModel +from .embedding import Embedding -__all__ = ["EmbeddingCreateResponse", "Usage", "DataUnionMember0", "DataUnionMember1", "DataUnionMember1Embedding"] +__all__ = ["EmbeddingCreateResponse", "Usage", "DataUnionMember1", "DataUnionMember1Embedding"] class Usage(BaseModel): @@ -20,17 +21,6 @@ class Usage(BaseModel): """The number of tokens used for the completion""" -class DataUnionMember0(BaseModel): - embedding: Union[List[float], List[int], str] - """The encoded embedding.""" - - index: int - """The index of the embedding.""" - - object: Optional[Literal["embedding"]] = None - """The object type of the embedding.""" - - class DataUnionMember1Embedding(BaseModel): float: Optional[List[builtins.float]] = None @@ -66,7 +56,7 @@ class EmbeddingCreateResponse(BaseModel): model: str """The model used""" - data: Union[List[DataUnionMember0], List[DataUnionMember1]] + data: Union[List[Embedding], List[DataUnionMember1]] """The created embeddings.""" object: Optional[ diff --git a/tests/api_resources/test_client.py b/tests/api_resources/test_client.py index 1d143378..1c38d8ba 100644 --- a/tests/api_resources/test_client.py +++ b/tests/api_resources/test_client.py @@ -9,7 +9,11 @@ from mixedbread import Mixedbread, AsyncMixedbread from tests.utils import assert_matches_type -from mixedbread.types import InfoResponse, EmbedResponse, RerankResponse +from mixedbread.types import ( + InfoResponse, + RerankResponse, + EmbeddingCreateResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +27,7 @@ def test_method_embed(self, client: Mixedbread) -> None: model="mixedbread-ai/mxbai-embed-large-v1", input=["string"], ) - assert_matches_type(EmbedResponse, client_, path=["response"]) + assert_matches_type(EmbeddingCreateResponse, client_, path=["response"]) @parametrize def test_method_embed_with_all_params(self, client: Mixedbread) -> None: @@ -35,7 +39,7 @@ def test_method_embed_with_all_params(self, client: Mixedbread) -> None: normalized=True, encoding_format="float", ) - assert_matches_type(EmbedResponse, client_, path=["response"]) + assert_matches_type(EmbeddingCreateResponse, client_, path=["response"]) @parametrize def test_raw_response_embed(self, client: Mixedbread) -> None: @@ -47,7 +51,7 @@ def test_raw_response_embed(self, client: Mixedbread) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" client_ = response.parse() - assert_matches_type(EmbedResponse, client_, path=["response"]) + assert_matches_type(EmbeddingCreateResponse, client_, path=["response"]) @parametrize def test_streaming_response_embed(self, client: Mixedbread) -> None: @@ -59,7 +63,7 @@ def test_streaming_response_embed(self, client: Mixedbread) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" client_ = response.parse() - assert_matches_type(EmbedResponse, client_, path=["response"]) + assert_matches_type(EmbeddingCreateResponse, client_, path=["response"]) assert cast(Any, response.is_closed) is True @@ -144,7 +148,7 @@ async def test_method_embed(self, async_client: AsyncMixedbread) -> None: model="mixedbread-ai/mxbai-embed-large-v1", input=["string"], ) - assert_matches_type(EmbedResponse, client, path=["response"]) + assert_matches_type(EmbeddingCreateResponse, client, path=["response"]) @parametrize async def test_method_embed_with_all_params(self, async_client: AsyncMixedbread) -> None: @@ -156,7 +160,7 @@ async def test_method_embed_with_all_params(self, async_client: AsyncMixedbread) normalized=True, encoding_format="float", ) - assert_matches_type(EmbedResponse, client, path=["response"]) + assert_matches_type(EmbeddingCreateResponse, client, path=["response"]) @parametrize async def test_raw_response_embed(self, async_client: AsyncMixedbread) -> None: @@ -168,7 +172,7 @@ async def test_raw_response_embed(self, async_client: AsyncMixedbread) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" client = await response.parse() - assert_matches_type(EmbedResponse, client, path=["response"]) + assert_matches_type(EmbeddingCreateResponse, client, path=["response"]) @parametrize async def test_streaming_response_embed(self, async_client: AsyncMixedbread) -> None: @@ -180,7 +184,7 @@ async def test_streaming_response_embed(self, async_client: AsyncMixedbread) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" client = await response.parse() - assert_matches_type(EmbedResponse, client, path=["response"]) + assert_matches_type(EmbeddingCreateResponse, client, path=["response"]) assert cast(Any, response.is_closed) is True