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 .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.8.1"
".": "0.9.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 49
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-258cd9419639d2d3d821e9c63a336fb7fecc362f376a7f606868445bcef995cd.yml
openapi_spec_hash: e2c4cf1543194f94f3b0baad6a5735ba
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-e3a6c9f052ee6bdfe6eb3db18628fd95c5c9bf18a656089f5f0add0490b90763.yml
openapi_spec_hash: d3c1aa7b05aa7395dc80a2a72cbbbd84
config_hash: ca0dfb431a44ea42464c42b224addf36
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 0.9.0 (2025-06-25)

Full Changelog: [v0.8.1...v0.9.0](https://github.com/mixedbread-ai/mixedbread-python/compare/v0.8.1...v0.9.0)

### Features

* **api:** api update ([d6af863](https://github.com/mixedbread-ai/mixedbread-python/commit/d6af863ca9125062cb4b13172781499c987a8685))
* **client:** add support for aiohttp ([94e0fc5](https://github.com/mixedbread-ai/mixedbread-python/commit/94e0fc58df85c64265612832cefa956c7723a79c))


### Chores

* **tests:** skip some failing tests on the latest python versions ([d2bb62a](https://github.com/mixedbread-ai/mixedbread-python/commit/d2bb62a9bbf7f10ee048b0f21d49841b1e1ed1a0))


### Documentation

* **client:** fix httpx.Timeout documentation reference ([855e94a](https://github.com/mixedbread-ai/mixedbread-python/commit/855e94ac632b0da2a8460af1964bb50b3ee37edb))

## 0.8.1 (2025-06-18)

Full Changelog: [v0.8.0...v0.8.1](https://github.com/mixedbread-ai/mixedbread-python/compare/v0.8.0...v0.8.1)
Expand Down
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,38 @@ asyncio.run(main())

Functionality between the synchronous and asynchronous clients is otherwise identical.

### With aiohttp

By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.

You can enable this by installing `aiohttp`:

```sh
# install from PyPI
pip install mixedbread[aiohttp]
```

Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:

```python
import os
import asyncio
from mixedbread import DefaultAioHttpClient
from mixedbread import AsyncMixedbread


async def main() -> None:
async with AsyncMixedbread(
api_key=os.environ.get("MXBAI_API_KEY"), # This is the default and can be omitted
http_client=DefaultAioHttpClient(),
) as client:
vector_store = await client.vector_stores.create()
print(vector_store.id)


asyncio.run(main())
```

## Using types

Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
Expand Down Expand Up @@ -239,7 +271,7 @@ client.with_options(max_retries=5).vector_stores.create()
### Timeouts

By default requests time out after 1 minute. You can configure this with a `timeout` option,
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:

```python
from mixedbread import Mixedbread
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "mixedbread"
version = "0.8.1"
version = "0.9.0"
description = "The official Python library for the Mixedbread API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -37,6 +37,8 @@ classifiers = [
Homepage = "https://github.com/mixedbread-ai/mixedbread-python"
Repository = "https://github.com/mixedbread-ai/mixedbread-python"

[project.optional-dependencies]
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.6"]

[tool.rye]
managed = true
Expand Down
27 changes: 27 additions & 0 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,24 @@
# universal: false

-e file:.
aiohappyeyeballs==2.6.1
# via aiohttp
aiohttp==3.12.8
# via httpx-aiohttp
# via mixedbread
aiosignal==1.3.2
# via aiohttp
annotated-types==0.6.0
# via pydantic
anyio==4.4.0
# via httpx
# via mixedbread
argcomplete==3.1.2
# via nox
async-timeout==5.0.1
# via aiohttp
attrs==25.3.0
# via aiohttp
certifi==2023.7.22
# via httpcore
# via httpx
Expand All @@ -34,23 +45,33 @@ execnet==2.1.1
# via pytest-xdist
filelock==3.12.4
# via virtualenv
frozenlist==1.6.2
# via aiohttp
# via aiosignal
h11==0.14.0
# via httpcore
httpcore==1.0.2
# via httpx
httpx==0.28.1
# via httpx-aiohttp
# via mixedbread
# via respx
httpx-aiohttp==0.1.6
# via mixedbread
idna==3.4
# via anyio
# via httpx
# via yarl
importlib-metadata==7.0.0
iniconfig==2.0.0
# via pytest
markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
multidict==6.4.4
# via aiohttp
# via yarl
mypy==1.14.1
mypy-extensions==1.0.0
# via mypy
Expand All @@ -65,6 +86,9 @@ platformdirs==3.11.0
# via virtualenv
pluggy==1.5.0
# via pytest
propcache==0.3.1
# via aiohttp
# via yarl
pydantic==2.10.3
# via mixedbread
pydantic-core==2.27.1
Expand Down Expand Up @@ -98,11 +122,14 @@ tomli==2.0.2
typing-extensions==4.12.2
# via anyio
# via mixedbread
# via multidict
# via mypy
# via pydantic
# via pydantic-core
# via pyright
virtualenv==20.24.5
# via nox
yarl==1.20.0
# via aiohttp
zipp==3.17.0
# via importlib-metadata
27 changes: 27 additions & 0 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,51 @@
# universal: false

-e file:.
aiohappyeyeballs==2.6.1
# via aiohttp
aiohttp==3.12.8
# via httpx-aiohttp
# via mixedbread
aiosignal==1.3.2
# via aiohttp
annotated-types==0.6.0
# via pydantic
anyio==4.4.0
# via httpx
# via mixedbread
async-timeout==5.0.1
# via aiohttp
attrs==25.3.0
# via aiohttp
certifi==2023.7.22
# via httpcore
# via httpx
distro==1.8.0
# via mixedbread
exceptiongroup==1.2.2
# via anyio
frozenlist==1.6.2
# via aiohttp
# via aiosignal
h11==0.14.0
# via httpcore
httpcore==1.0.2
# via httpx
httpx==0.28.1
# via httpx-aiohttp
# via mixedbread
httpx-aiohttp==0.1.6
# via mixedbread
idna==3.4
# via anyio
# via httpx
# via yarl
multidict==6.4.4
# via aiohttp
# via yarl
propcache==0.3.1
# via aiohttp
# via yarl
pydantic==2.10.3
# via mixedbread
pydantic-core==2.27.1
Expand All @@ -41,5 +65,8 @@ sniffio==1.3.0
typing-extensions==4.12.2
# via anyio
# via mixedbread
# via multidict
# via pydantic
# via pydantic-core
yarl==1.20.0
# via aiohttp
3 changes: 2 additions & 1 deletion src/mixedbread/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
UnprocessableEntityError,
APIResponseValidationError,
)
from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient
from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient
from ._utils._logs import setup_logging as _setup_logging

__all__ = [
Expand Down Expand Up @@ -80,6 +80,7 @@
"DEFAULT_CONNECTION_LIMITS",
"DefaultHttpxClient",
"DefaultAsyncHttpxClient",
"DefaultAioHttpClient",
]

if not _t.TYPE_CHECKING:
Expand Down
22 changes: 22 additions & 0 deletions src/mixedbread/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,24 @@ def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


try:
import httpx_aiohttp
except ImportError:

class _DefaultAioHttpClient(httpx.AsyncClient):
def __init__(self, **_kwargs: Any) -> None:
raise RuntimeError("To use the aiohttp client you must have installed the package with the `aiohttp` extra")
else:

class _DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore
def __init__(self, **kwargs: Any) -> None:
kwargs.setdefault("timeout", DEFAULT_TIMEOUT)
kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS)
kwargs.setdefault("follow_redirects", True)

super().__init__(**kwargs)


if TYPE_CHECKING:
DefaultAsyncHttpxClient = httpx.AsyncClient
"""An alias to `httpx.AsyncClient` that provides the same defaults that this SDK
Expand All @@ -1297,8 +1315,12 @@ def __init__(self, **kwargs: Any) -> None:
This is useful because overriding the `http_client` with your own instance of
`httpx.AsyncClient` will result in httpx's defaults being used, not ours.
"""

DefaultAioHttpClient = httpx.AsyncClient
"""An alias to `httpx.AsyncClient` that changes the default HTTP transport to `aiohttp`."""
else:
DefaultAsyncHttpxClient = _DefaultAsyncHttpxClient
DefaultAioHttpClient = _DefaultAioHttpClient


class AsyncHttpxClientWrapper(DefaultAsyncHttpxClient):
Expand Down
2 changes: 1 addition & 1 deletion src/mixedbread/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "mixedbread"
__version__ = "0.8.1" # x-release-please-version
__version__ = "0.9.0" # x-release-please-version
4 changes: 2 additions & 2 deletions src/mixedbread/types/data_sources/data_source_connector.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing import Dict, Optional
from datetime import datetime
from typing_extensions import Literal

Expand Down Expand Up @@ -46,7 +46,7 @@ class DataSourceConnector(BaseModel):
status: Literal["idle", "pending", "in_progress", "cancelled", "completed", "failed"]
"""The sync status of the connector"""

error: Optional[str] = None
error: Optional[Dict[str, object]] = None
"""The sync error of the connector"""

object: Optional[Literal["data_source.connector"]] = None
Expand Down
5 changes: 4 additions & 1 deletion src/mixedbread/types/scored_audio_url_input_chunk.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing import Dict, Optional
from typing_extensions import Literal

from .._models import BaseModel
Expand All @@ -20,6 +20,9 @@ class ScoredAudioURLInputChunk(BaseModel):
mime_type: Optional[str] = None
"""mime type of the chunk"""

generated_metadata: Optional[Dict[str, object]] = None
"""metadata of the chunk"""

model: Optional[str] = None
"""model used for this chunk"""

Expand Down
5 changes: 4 additions & 1 deletion src/mixedbread/types/scored_image_url_input_chunk.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing import Dict, Optional
from typing_extensions import Literal

from .._models import BaseModel
Expand All @@ -23,6 +23,9 @@ class ScoredImageURLInputChunk(BaseModel):
mime_type: Optional[str] = None
"""mime type of the chunk"""

generated_metadata: Optional[Dict[str, object]] = None
"""metadata of the chunk"""

model: Optional[str] = None
"""model used for this chunk"""

Expand Down
5 changes: 4 additions & 1 deletion src/mixedbread/types/scored_text_input_chunk.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing import Dict, Optional
from typing_extensions import Literal

from .._models import BaseModel
Expand All @@ -15,6 +15,9 @@ class ScoredTextInputChunk(BaseModel):
mime_type: Optional[str] = None
"""mime type of the chunk"""

generated_metadata: Optional[Dict[str, object]] = None
"""metadata of the chunk"""

model: Optional[str] = None
"""model used for this chunk"""

Expand Down
5 changes: 4 additions & 1 deletion src/mixedbread/types/scored_video_url_input_chunk.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing import Dict, Optional
from typing_extensions import Literal

from .._models import BaseModel
Expand All @@ -20,6 +20,9 @@ class ScoredVideoURLInputChunk(BaseModel):
mime_type: Optional[str] = None
"""mime type of the chunk"""

generated_metadata: Optional[Dict[str, object]] = None
"""metadata of the chunk"""

model: Optional[str] = None
"""model used for this chunk"""

Expand Down
Loading