Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 2 additions & 8 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

- <code title="post /v1/embeddings">client.<a href="./src/mixedbread/_client.py">embed</a>(\*\*<a href="src/mixedbread/types/client_embed_params.py">params</a>) -> <a href="./src/mixedbread/types/embed_response.py">EmbedResponse</a></code>
- <code title="post /v1/embeddings">client.<a href="./src/mixedbread/_client.py">embed</a>(\*\*<a href="src/mixedbread/types/client_embed_params.py">params</a>) -> <a href="./src/mixedbread/types/embedding_create_response.py">EmbeddingCreateResponse</a></code>
- <code title="get /">client.<a href="./src/mixedbread/_client.py">info</a>() -> <a href="./src/mixedbread/types/info_response.py">InfoResponse</a></code>
- <code title="post /v1/reranking">client.<a href="./src/mixedbread/_client.py">rerank</a>(\*\*<a href="src/mixedbread/types/client_rerank_params.py">params</a>) -> <a href="./src/mixedbread/types/rerank_response.py">RerankResponse</a></code>

Expand Down Expand Up @@ -145,12 +145,6 @@ Methods:

# Embeddings

Types:

```python
from mixedbread.types import EmbeddingCreateResponse
```

Methods:

- <code title="post /v1/embeddings">client.embeddings.<a href="./src/mixedbread/resources/embeddings.py">create</a>(\*\*<a href="src/mixedbread/types/embedding_create_params.py">params</a>) -> <a href="./src/mixedbread/types/embedding_create_response.py">EmbeddingCreateResponse</a></code>
10 changes: 5 additions & 5 deletions src/mixedbread/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/mixedbread/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
98 changes: 0 additions & 98 deletions src/mixedbread/types/embed_response.py

This file was deleted.

19 changes: 19 additions & 0 deletions src/mixedbread/types/embedding.py
Original file line number Diff line number Diff line change
@@ -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."""
16 changes: 3 additions & 13 deletions src/mixedbread/types/embedding_create_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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

Expand Down Expand Up @@ -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[
Expand Down
22 changes: 13 additions & 9 deletions tests/api_resources/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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

Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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

Expand Down