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.39.0"
".": "0.40.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: 62
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-c53a9b02bf4bd345435a03b4178aed1b7c8ac04a2508f370b5361bf305a3f803.yml
openapi_spec_hash: f05a6df876280efad08ed2f0ab78d5fc
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-636ffd012f5b88d33c33cd0de8290a01564009f31d8004a87a2d516435c03868.yml
openapi_spec_hash: 91c662ed12c45e766bc325d47fd6e285
config_hash: 6fa04d08d4e1a3a45f562e37fab0ea71
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 0.40.0 (2025-11-11)

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

### Features

* **api:** api update ([93c24d4](https://github.com/mixedbread-ai/mixedbread-python/commit/93c24d40549f6e7d1cb881313a40bcdd19fed4ab))
* **api:** api update ([478b973](https://github.com/mixedbread-ai/mixedbread-python/commit/478b9736d4da0411c814620a61b2675faed9173c))


### Bug Fixes

* compat with Python 3.14 ([99a4c1c](https://github.com/mixedbread-ai/mixedbread-python/commit/99a4c1c553bd638b2d7e2f050ca33824623c93e8))


### Chores

* **package:** drop Python 3.8 support ([54a77eb](https://github.com/mixedbread-ai/mixedbread-python/commit/54a77eb9af52ced156a07b0d524068cb5337dd8f))

## 0.39.0 (2025-11-07)

Full Changelog: [v0.38.0...v0.39.0](https://github.com/mixedbread-ai/mixedbread-python/compare/v0.38.0...v0.39.0)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- prettier-ignore -->
[![PyPI version](https://img.shields.io/pypi/v/mixedbread.svg?label=pypi%20(stable))](https://pypi.org/project/mixedbread/)

The Mixedbread API Python SDK library provides convenient access to the Mixedbread REST API from any Python 3.8+
The Mixedbread API Python SDK library provides convenient access to the Mixedbread REST API from any Python 3.9+
application. The library includes type definitions for all request params and response fields,
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).

Expand Down Expand Up @@ -455,7 +455,7 @@ print(mixedbread.__version__)

## Requirements

Python 3.8 or higher.
Python 3.9 or higher.

## Contributing

Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "mixedbread"
version = "0.39.0"
version = "0.40.0"
description = "The official Python library for the Mixedbread API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand All @@ -15,11 +15,10 @@ dependencies = [
"distro>=1.7.0, <2",
"sniffio",
]
requires-python = ">= 3.8"
requires-python = ">= 3.9"
classifiers = [
"Typing :: Typed",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down Expand Up @@ -141,7 +140,7 @@ filterwarnings = [
# there are a couple of flags that are still disabled by
# default in strict mode as they are experimental and niche.
typeCheckingMode = "strict"
pythonVersion = "3.8"
pythonVersion = "3.9"

exclude = [
"_dev",
Expand Down
11 changes: 8 additions & 3 deletions src/mixedbread/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
import inspect
import weakref
from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast
from datetime import date, datetime
from typing_extensions import (
Expand Down Expand Up @@ -573,6 +574,9 @@ class CachedDiscriminatorType(Protocol):
__discriminator__: DiscriminatorDetails


DISCRIMINATOR_CACHE: weakref.WeakKeyDictionary[type, DiscriminatorDetails] = weakref.WeakKeyDictionary()


class DiscriminatorDetails:
field_name: str
"""The name of the discriminator field in the variant class, e.g.
Expand Down Expand Up @@ -615,8 +619,9 @@ def __init__(


def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, ...]) -> DiscriminatorDetails | None:
if isinstance(union, CachedDiscriminatorType):
return union.__discriminator__
cached = DISCRIMINATOR_CACHE.get(union)
if cached is not None:
return cached

discriminator_field_name: str | None = None

Expand Down Expand Up @@ -669,7 +674,7 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,
discriminator_field=discriminator_field_name,
discriminator_alias=discriminator_alias,
)
cast(CachedDiscriminatorType, union).__discriminator__ = details
DISCRIMINATOR_CACHE.setdefault(union, details)
return details


Expand Down
34 changes: 3 additions & 31 deletions src/mixedbread/_utils/_sync.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from __future__ import annotations

import sys
import asyncio
import functools
import contextvars
from typing import Any, TypeVar, Callable, Awaitable
from typing import TypeVar, Callable, Awaitable
from typing_extensions import ParamSpec

import anyio
Expand All @@ -15,34 +13,11 @@
T_ParamSpec = ParamSpec("T_ParamSpec")


if sys.version_info >= (3, 9):
_asyncio_to_thread = asyncio.to_thread
else:
# backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread
# for Python 3.8 support
async def _asyncio_to_thread(
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
) -> Any:
"""Asynchronously run function *func* in a separate thread.

Any *args and **kwargs supplied for this function are directly passed
to *func*. Also, the current :class:`contextvars.Context` is propagated,
allowing context variables from the main thread to be accessed in the
separate thread.

Returns a coroutine that can be awaited to get the eventual result of *func*.
"""
loop = asyncio.events.get_running_loop()
ctx = contextvars.copy_context()
func_call = functools.partial(ctx.run, func, *args, **kwargs)
return await loop.run_in_executor(None, func_call)


async def to_thread(
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
) -> T_Retval:
if sniffio.current_async_library() == "asyncio":
return await _asyncio_to_thread(func, *args, **kwargs)
return await asyncio.to_thread(func, *args, **kwargs)

return await anyio.to_thread.run_sync(
functools.partial(func, *args, **kwargs),
Expand All @@ -53,10 +28,7 @@ async def to_thread(
def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]:
"""
Take a blocking function and create an async one that receives the same
positional and keyword arguments. For python version 3.9 and above, it uses
asyncio.to_thread to run the function in a separate thread. For python version
3.8, it uses locally defined copy of the asyncio.to_thread function which was
introduced in python 3.9.
positional and keyword arguments.

Usage:

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.39.0" # x-release-please-version
__version__ = "0.40.0" # x-release-please-version
2 changes: 1 addition & 1 deletion src/mixedbread/types/parsing/parsing_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ResultChunkElement(BaseModel):


class ResultChunk(BaseModel):
content: str
content: Optional[str] = None
"""The full content of the chunk"""

content_to_embed: str
Expand Down
12 changes: 12 additions & 0 deletions src/mixedbread/types/scored_audio_url_input_chunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class GeneratedMetadataMarkdownChunkGeneratedMetadata(BaseModel):

heading_context: Optional[List[GeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext]] = None

start_line: Optional[int] = None

num_lines: Optional[int] = None

if TYPE_CHECKING:
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
# value to this field, so for compatibility we avoid doing it at runtime.
Expand All @@ -73,6 +77,10 @@ class GeneratedMetadataTextChunkGeneratedMetadata(BaseModel):

file_size: int

start_line: Optional[int] = None

num_lines: Optional[int] = None

if TYPE_CHECKING:
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
# value to this field, so for compatibility we avoid doing it at runtime.
Expand Down Expand Up @@ -119,6 +127,10 @@ class GeneratedMetadataCodeChunkGeneratedMetadata(BaseModel):

file_size: int

start_line: Optional[int] = None

num_lines: Optional[int] = None

if TYPE_CHECKING:
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
# value to this field, so for compatibility we avoid doing it at runtime.
Expand Down
12 changes: 12 additions & 0 deletions src/mixedbread/types/scored_image_url_input_chunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class GeneratedMetadataMarkdownChunkGeneratedMetadata(BaseModel):

heading_context: Optional[List[GeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext]] = None

start_line: Optional[int] = None

num_lines: Optional[int] = None

if TYPE_CHECKING:
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
# value to this field, so for compatibility we avoid doing it at runtime.
Expand All @@ -73,6 +77,10 @@ class GeneratedMetadataTextChunkGeneratedMetadata(BaseModel):

file_size: int

start_line: Optional[int] = None

num_lines: Optional[int] = None

if TYPE_CHECKING:
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
# value to this field, so for compatibility we avoid doing it at runtime.
Expand Down Expand Up @@ -119,6 +127,10 @@ class GeneratedMetadataCodeChunkGeneratedMetadata(BaseModel):

file_size: int

start_line: Optional[int] = None

num_lines: Optional[int] = None

if TYPE_CHECKING:
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
# value to this field, so for compatibility we avoid doing it at runtime.
Expand Down
12 changes: 12 additions & 0 deletions src/mixedbread/types/scored_text_input_chunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ class GeneratedMetadataMarkdownChunkGeneratedMetadata(BaseModel):

heading_context: Optional[List[GeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext]] = None

start_line: Optional[int] = None

num_lines: Optional[int] = None

if TYPE_CHECKING:
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
# value to this field, so for compatibility we avoid doing it at runtime.
Expand All @@ -72,6 +76,10 @@ class GeneratedMetadataTextChunkGeneratedMetadata(BaseModel):

file_size: int

start_line: Optional[int] = None

num_lines: Optional[int] = None

if TYPE_CHECKING:
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
# value to this field, so for compatibility we avoid doing it at runtime.
Expand Down Expand Up @@ -118,6 +126,10 @@ class GeneratedMetadataCodeChunkGeneratedMetadata(BaseModel):

file_size: int

start_line: Optional[int] = None

num_lines: Optional[int] = None

if TYPE_CHECKING:
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
# value to this field, so for compatibility we avoid doing it at runtime.
Expand Down
12 changes: 12 additions & 0 deletions src/mixedbread/types/scored_video_url_input_chunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class GeneratedMetadataMarkdownChunkGeneratedMetadata(BaseModel):

heading_context: Optional[List[GeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext]] = None

start_line: Optional[int] = None

num_lines: Optional[int] = None

if TYPE_CHECKING:
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
# value to this field, so for compatibility we avoid doing it at runtime.
Expand All @@ -73,6 +77,10 @@ class GeneratedMetadataTextChunkGeneratedMetadata(BaseModel):

file_size: int

start_line: Optional[int] = None

num_lines: Optional[int] = None

if TYPE_CHECKING:
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
# value to this field, so for compatibility we avoid doing it at runtime.
Expand Down Expand Up @@ -119,6 +127,10 @@ class GeneratedMetadataCodeChunkGeneratedMetadata(BaseModel):

file_size: int

start_line: Optional[int] = None

num_lines: Optional[int] = None

if TYPE_CHECKING:
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
# value to this field, so for compatibility we avoid doing it at runtime.
Expand Down
Loading
Loading