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.34.0"
".": "0.35.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: 61
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-a14d1b895964291692e90504f3db6d263a4a8d9cca6f1137548ceae0fdc5d82e.yml
openapi_spec_hash: 0608955c434731be0e392470f511e026
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-d4c4a6e0d99b371dc5e84a63cf447770fc684d6a0650b2e36013404245a5876b.yml
openapi_spec_hash: 9d377ce6164438d3207d8a50c954a9cd
config_hash: 2de40c343cf7b242d5925e3405ee8908
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 0.35.0 (2025-10-30)

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

### Features

* **api:** api update ([26a066f](https://github.com/mixedbread-ai/mixedbread-python/commit/26a066f062d33164f0105c470c3fbfd3a1e0d3e1))


### Bug Fixes

* **client:** close streams without requiring full consumption ([c348610](https://github.com/mixedbread-ai/mixedbread-python/commit/c34861040d2cd5944b48f11703cd3c3f9da350a5))


### Chores

* bump `httpx-aiohttp` version to 0.1.9 ([305ea76](https://github.com/mixedbread-ai/mixedbread-python/commit/305ea7688a2e04ffef03dabd815e0a0c28613b5e))
* **internal:** detect missing future annotations with ruff ([7683f5b](https://github.com/mixedbread-ai/mixedbread-python/commit/7683f5b7fc7aa498218782ef170645d2484f655c))

## 0.34.0 (2025-10-08)

Full Changelog: [v0.33.0...v0.34.0](https://github.com/mixedbread-ai/mixedbread-python/compare/v0.33.0...v0.34.0)
Expand Down
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "mixedbread"
version = "0.34.0"
version = "0.35.0"
description = "The official Python library for the Mixedbread API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -39,7 +39,7 @@ 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.8"]
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.9"]

[tool.rye]
managed = true
Expand Down Expand Up @@ -224,6 +224,8 @@ select = [
"B",
# remove unused imports
"F401",
# check for missing future annotations
"FA102",
# bare except statements
"E722",
# unused arguments
Expand All @@ -246,6 +248,8 @@ unfixable = [
"T203",
]

extend-safe-fixes = ["FA102"]

[tool.ruff.lint.flake8-tidy-imports.banned-api]
"functools.lru_cache".msg = "This function does not retain type information for the wrapped function's arguments; The `lru_cache` function from `_utils` should be used instead"

Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ httpx==0.28.1
# via httpx-aiohttp
# via mixedbread
# via respx
httpx-aiohttp==0.1.8
httpx-aiohttp==0.1.9
# via mixedbread
idna==3.4
# via anyio
Expand Down
2 changes: 1 addition & 1 deletion requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ httpcore==1.0.9
httpx==0.28.1
# via httpx-aiohttp
# via mixedbread
httpx-aiohttp==0.1.8
httpx-aiohttp==0.1.9
# via mixedbread
idna==3.4
# via anyio
Expand Down
10 changes: 4 additions & 6 deletions src/mixedbread/_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ def __stream__(self) -> Iterator[_T]:
for sse in iterator:
yield process_data(data=sse.json(), cast_to=cast_to, response=response)

# Ensure the entire stream is consumed
for _sse in iterator:
...
# As we might not fully consume the response stream, we need to close it explicitly
response.close()

def __enter__(self) -> Self:
return self
Expand Down Expand Up @@ -121,9 +120,8 @@ async def __stream__(self) -> AsyncIterator[_T]:
async for sse in iterator:
yield process_data(data=sse.json(), cast_to=cast_to, response=response)

# Ensure the entire stream is consumed
async for _sse in iterator:
...
# As we might not fully consume the response stream, we need to close it explicitly
await response.aclose()

async def __aenter__(self) -> Self:
return self
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.34.0" # x-release-please-version
__version__ = "0.35.0" # x-release-please-version
10 changes: 9 additions & 1 deletion src/mixedbread/resources/api_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Union
from typing import Union, Iterable, Optional
from datetime import datetime

import httpx
Expand Down Expand Up @@ -51,6 +51,7 @@ def create(
self,
*,
name: str | Omit = omit,
scope: Optional[Iterable[api_key_create_params.Scope]] | Omit = omit,
expires_at: Union[str, datetime, None] | Omit = omit,
# 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.
Expand All @@ -70,6 +71,8 @@ def create(
Args:
name: A name/description for the API key

scope: The scope of the API key

expires_at: Optional expiration datetime

extra_headers: Send extra headers
Expand All @@ -85,6 +88,7 @@ def create(
body=maybe_transform(
{
"name": name,
"scope": scope,
"expires_at": expires_at,
},
api_key_create_params.APIKeyCreateParams,
Expand Down Expand Up @@ -331,6 +335,7 @@ async def create(
self,
*,
name: str | Omit = omit,
scope: Optional[Iterable[api_key_create_params.Scope]] | Omit = omit,
expires_at: Union[str, datetime, None] | Omit = omit,
# 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.
Expand All @@ -350,6 +355,8 @@ async def create(
Args:
name: A name/description for the API key

scope: The scope of the API key

expires_at: Optional expiration datetime

extra_headers: Send extra headers
Expand All @@ -365,6 +372,7 @@ async def create(
body=await async_maybe_transform(
{
"name": name,
"scope": scope,
"expires_at": expires_at,
},
api_key_create_params.APIKeyCreateParams,
Expand Down
15 changes: 13 additions & 2 deletions src/mixedbread/types/api_key.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

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

from .._models import BaseModel

__all__ = ["APIKey"]
__all__ = ["APIKey", "Scope"]


class Scope(BaseModel):
method: Literal["read", "write", "delete", "list", "create"]

resource_type: Optional[Literal["store"]] = None

resource_id: Optional[str] = None


class APIKey(BaseModel):
Expand All @@ -33,3 +41,6 @@ class APIKey(BaseModel):

object: Optional[Literal["api_key"]] = None
"""The type of the object"""

scope: Optional[List[Scope]] = None
"""The scope of the API key"""
17 changes: 14 additions & 3 deletions src/mixedbread/types/api_key_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,29 @@

from __future__ import annotations

from typing import Union
from typing import Union, Iterable, Optional
from datetime import datetime
from typing_extensions import Annotated, TypedDict
from typing_extensions import Literal, Required, Annotated, TypedDict

from .._utils import PropertyInfo

__all__ = ["APIKeyCreateParams"]
__all__ = ["APIKeyCreateParams", "Scope"]


class APIKeyCreateParams(TypedDict, total=False):
name: str
"""A name/description for the API key"""

scope: Optional[Iterable[Scope]]
"""The scope of the API key"""

expires_at: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
"""Optional expiration datetime"""


class Scope(TypedDict, total=False):
method: Required[Literal["read", "write", "delete", "list", "create"]]

resource_type: Optional[Literal["store"]]

resource_id: Optional[str]
15 changes: 13 additions & 2 deletions src/mixedbread/types/api_key_created.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

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

from .._models import BaseModel

__all__ = ["APIKeyCreated"]
__all__ = ["APIKeyCreated", "Scope"]


class Scope(BaseModel):
method: Literal["read", "write", "delete", "list", "create"]

resource_type: Optional[Literal["store"]] = None

resource_id: Optional[str] = None


class APIKeyCreated(BaseModel):
Expand Down Expand Up @@ -34,5 +42,8 @@ class APIKeyCreated(BaseModel):
object: Optional[Literal["api_key"]] = None
"""The type of the object"""

scope: Optional[List[Scope]] = None
"""The scope of the API key"""

value: str
"""The value of the API key"""
14 changes: 14 additions & 0 deletions tests/api_resources/test_api_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ def test_method_create(self, client: Mixedbread) -> None:
def test_method_create_with_all_params(self, client: Mixedbread) -> None:
api_key = client.api_keys.create(
name="name",
scope=[
{
"method": "read",
"resource_type": "store",
"resource_id": "resource_id",
}
],
expires_at=parse_datetime("2019-12-27T18:11:19.117Z"),
)
assert_matches_type(APIKeyCreated, api_key, path=["response"])
Expand Down Expand Up @@ -252,6 +259,13 @@ async def test_method_create(self, async_client: AsyncMixedbread) -> None:
async def test_method_create_with_all_params(self, async_client: AsyncMixedbread) -> None:
api_key = await async_client.api_keys.create(
name="name",
scope=[
{
"method": "read",
"resource_type": "store",
"resource_id": "resource_id",
}
],
expires_at=parse_datetime("2019-12-27T18:11:19.117Z"),
)
assert_matches_type(APIKeyCreated, api_key, path=["response"])
Expand Down
Loading