Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7d519be
fix: sanitize endpoint path params
stainless-app[bot] Mar 20, 2026
cc454cf
refactor(tests): switch from prism to steady
stainless-app[bot] Mar 20, 2026
d6e32d5
chore(tests): bump steady to v0.19.4
stainless-app[bot] Mar 21, 2026
59351b9
chore(tests): bump steady to v0.19.5
stainless-app[bot] Mar 21, 2026
cf3aa78
chore(internal): update gitignore
stainless-app[bot] Mar 24, 2026
ac0e7ac
chore(tests): bump steady to v0.19.6
stainless-app[bot] Mar 24, 2026
a24ebe9
feat(api): api update
stainless-app[bot] Mar 24, 2026
a3ec133
chore(ci): skip lint on metadata-only changes
stainless-app[bot] Mar 25, 2026
839ee9c
chore(tests): bump steady to v0.19.7
stainless-app[bot] Mar 25, 2026
e52e262
feat(internal): implement indices array format for query and form ser…
stainless-app[bot] Mar 27, 2026
4ad956c
feat(api): api update
stainless-app[bot] Mar 28, 2026
6f2971b
codegen metadata
stainless-app[bot] Mar 31, 2026
31e2274
chore(tests): bump steady to v0.20.1
stainless-app[bot] Apr 1, 2026
6879b15
chore(tests): bump steady to v0.20.2
stainless-app[bot] Apr 1, 2026
34d8ca8
feat(api): api update
stainless-app[bot] Apr 4, 2026
83d3f20
fix(client): preserve hardcoded query params when merging with user p…
stainless-app[bot] Apr 8, 2026
0957f16
fix: ensure file data are only sent as 1 parameter
stainless-app[bot] Apr 11, 2026
c7f1a92
feat(api): api update
stainless-app[bot] Apr 14, 2026
63a2728
perf(client): optimize file structure copying in multipart requests
stainless-app[bot] Apr 23, 2026
3f6450d
chore(tests): bump steady to v0.22.1
stainless-app[bot] Apr 18, 2026
9cb94bc
feat(api): api update
stainless-app[bot] Apr 22, 2026
5b52286
chore(internal): more robust bootstrap script
stainless-app[bot] Apr 23, 2026
40c9165
codegen metadata
stainless-app[bot] Apr 23, 2026
50effb7
codegen metadata
stainless-app[bot] Apr 23, 2026
8df7bb6
codegen metadata
stainless-app[bot] Apr 23, 2026
8bb1069
feat: include results in store search events response
stainless-app[bot] Apr 23, 2026
f727a10
release: 0.50.0
stainless-app[bot] Apr 23, 2026
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/mixedbread-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@v6

Expand All @@ -38,7 +38,7 @@ jobs:
run: ./scripts/lint

build:
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
timeout-minutes: 10
name: build
permissions:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.prism.log
.stdy.log
_dev

__pycache__
Expand Down
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.49.0"
".": "0.50.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 56
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-3daf4d41b24950791a70688527c10dea9e201d304b8d6432b3acfa50e33e0805.yml
openapi_spec_hash: 1ecaa0f38266f1c5d1da8fb2e9ef651a
config_hash: c32ffa6858a02d7f23f6f3dda0b461ed
configured_endpoints: 55
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-ebd391dad1252eb00dd69ac50455b93bcdcd2cf0177d678e160e47f1d017287f.yml
openapi_spec_hash: 3bfd5f9eb34711238caef851aa81f5c0
config_hash: 594a43c9cb8089f079bb9c5442646791
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
# Changelog

## 0.50.0 (2026-04-23)

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

### Features

* **api:** api update ([9cb94bc](https://github.com/mixedbread-ai/mixedbread-python/commit/9cb94bcfc4cf74adfd82b1ff6e8166d5bf597bf7))
* **api:** api update ([c7f1a92](https://github.com/mixedbread-ai/mixedbread-python/commit/c7f1a92a897408fe54d22ae773e617c0eb9be584))
* **api:** api update ([34d8ca8](https://github.com/mixedbread-ai/mixedbread-python/commit/34d8ca84c2ed2fd3a7bf77a84047741b537a178a))
* **api:** api update ([4ad956c](https://github.com/mixedbread-ai/mixedbread-python/commit/4ad956c1b52e6a08dc44958cb331451f5bec75af))
* **api:** api update ([a24ebe9](https://github.com/mixedbread-ai/mixedbread-python/commit/a24ebe9e241e075c2958cefecfe9e972a5bcd55f))
* include results in store search events response ([8bb1069](https://github.com/mixedbread-ai/mixedbread-python/commit/8bb1069f016d97cf24bf4f7031c180ca3752e07d))
* **internal:** implement indices array format for query and form serialization ([e52e262](https://github.com/mixedbread-ai/mixedbread-python/commit/e52e262bd9acd3caa49cf9ba08a29b260b722bf0))


### Bug Fixes

* **client:** preserve hardcoded query params when merging with user params ([83d3f20](https://github.com/mixedbread-ai/mixedbread-python/commit/83d3f201d14edd8afa08a6046c2315097d6509d4))
* ensure file data are only sent as 1 parameter ([0957f16](https://github.com/mixedbread-ai/mixedbread-python/commit/0957f16bb9a20c72499ae6ee86b9494c1e1ee5c8))
* sanitize endpoint path params ([7d519be](https://github.com/mixedbread-ai/mixedbread-python/commit/7d519be7f4ea6b2ce11c9915ee1ac903ebb97cea))


### Performance Improvements

* **client:** optimize file structure copying in multipart requests ([63a2728](https://github.com/mixedbread-ai/mixedbread-python/commit/63a272878dc28300f5169d38cb523cc641498fed))


### Chores

* **ci:** skip lint on metadata-only changes ([a3ec133](https://github.com/mixedbread-ai/mixedbread-python/commit/a3ec133b88d1a70a066c17e29dd2ebd5decffb25))
* **internal:** more robust bootstrap script ([5b52286](https://github.com/mixedbread-ai/mixedbread-python/commit/5b5228640759a7bf277d9478f10eeca3d358e10f))
* **internal:** update gitignore ([cf3aa78](https://github.com/mixedbread-ai/mixedbread-python/commit/cf3aa78ec44036bbedce95735ee7ab43cc4d566a))
* **tests:** bump steady to v0.19.4 ([d6e32d5](https://github.com/mixedbread-ai/mixedbread-python/commit/d6e32d5abe0e137375ea79373033c07057b22c83))
* **tests:** bump steady to v0.19.5 ([59351b9](https://github.com/mixedbread-ai/mixedbread-python/commit/59351b9dcb0eaf2578c985c80a0501d610ff357d))
* **tests:** bump steady to v0.19.6 ([ac0e7ac](https://github.com/mixedbread-ai/mixedbread-python/commit/ac0e7acc35384a0ae9f78040b60bce03f8258d81))
* **tests:** bump steady to v0.19.7 ([839ee9c](https://github.com/mixedbread-ai/mixedbread-python/commit/839ee9c7c60749ae03a125f84e87a7be9365daac))
* **tests:** bump steady to v0.20.1 ([31e2274](https://github.com/mixedbread-ai/mixedbread-python/commit/31e2274bfe265fbebae02c86beae2f575f9b7b18))
* **tests:** bump steady to v0.20.2 ([6879b15](https://github.com/mixedbread-ai/mixedbread-python/commit/6879b159d830df5df58696899c7551c709595ed4))
* **tests:** bump steady to v0.22.1 ([3f6450d](https://github.com/mixedbread-ai/mixedbread-python/commit/3f6450dbda2fe9baeee031495fd10f4d87fa815a))


### Refactors

* **tests:** switch from prism to steady ([cc454cf](https://github.com/mixedbread-ai/mixedbread-python/commit/cc454cfbe5752c8e439361c52fb31d2d2b14180d))

## 0.49.0 (2026-03-19)

Full Changelog: [v0.48.0...v0.49.0](https://github.com/mixedbread-ai/mixedbread-python/compare/v0.48.0...v0.49.0)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ $ pip install ./path-to-wheel-file.whl

## Running tests

Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
Most tests require you to [set up a mock server](https://github.com/dgellow/steady) against the OpenAPI spec to run the tests.

```sh
$ ./scripts/mock
Expand Down
35 changes: 29 additions & 6 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,29 @@ Types:

```python
from mixedbread.types import (
AgenticSearchConfig,
AudioChunkGeneratedMetadata,
AudioURL,
CodeChunkGeneratedMetadata,
ContextualizationConfig,
ExpiresAfter,
FileCounts,
ImageChunkGeneratedMetadata,
ImageURLOutput,
MarkdownChunkGeneratedMetadata,
MarkdownHeading,
PdfChunkGeneratedMetadata,
RerankConfig,
ScoredAudioURLInputChunk,
ScoredImageURLInputChunk,
ScoredTextInputChunk,
ScoredVideoURLInputChunk,
Store,
StoreChunkSearchOptions,
StoreConfig,
TextChunkGeneratedMetadata,
VideoChunkGeneratedMetadata,
VideoURL,
StoreDeleteResponse,
StoreMetadataFacetsResponse,
StoreQuestionAnsweringResponse,
Expand All @@ -61,12 +77,15 @@ Types:

```python
from mixedbread.types.stores import (
ScoredStoreFile,
StoreFileStatus,
AudioURLInputChunk,
ImageURLInputChunk,
StoreFile,
StoreFileConfig,
StoreFileStatus,
TextInputChunk,
VideoURLInputChunk,
FileListResponse,
FileDeleteResponse,
FileSearchResponse,
)
```

Expand All @@ -77,7 +96,6 @@ Methods:
- <code title="patch /v1/stores/{store_identifier}/files/{file_identifier}">client.stores.files.<a href="./src/mixedbread/resources/stores/files.py">update</a>(file_identifier, \*, store_identifier, \*\*<a href="src/mixedbread/types/stores/file_update_params.py">params</a>) -> <a href="./src/mixedbread/types/stores/store_file.py">StoreFile</a></code>
- <code title="post /v1/stores/{store_identifier}/files/list">client.stores.files.<a href="./src/mixedbread/resources/stores/files.py">list</a>(store_identifier, \*\*<a href="src/mixedbread/types/stores/file_list_params.py">params</a>) -> <a href="./src/mixedbread/types/stores/file_list_response.py">FileListResponse</a></code>
- <code title="delete /v1/stores/{store_identifier}/files/{file_identifier}">client.stores.files.<a href="./src/mixedbread/resources/stores/files.py">delete</a>(file_identifier, \*, store_identifier) -> <a href="./src/mixedbread/types/stores/file_delete_response.py">FileDeleteResponse</a></code>
- <code title="post /v1/stores/files/search">client.stores.files.<a href="./src/mixedbread/resources/stores/files.py">search</a>(\*\*<a href="src/mixedbread/types/stores/file_search_params.py">params</a>) -> <a href="./src/mixedbread/types/stores/file_search_response.py">FileSearchResponse</a></code>

# Parsing

Expand All @@ -87,10 +105,13 @@ Types:

```python
from mixedbread.types.parsing import (
Chunk,
ChunkElement,
ChunkingStrategy,
DocumentParserResult,
ElementType,
ParsingJobStatus,
ParsingJob,
ParsingJobStatus,
ReturnFormat,
JobListResponse,
JobDeleteResponse,
Expand Down Expand Up @@ -204,7 +225,9 @@ Types:

```python
from mixedbread.types import (
APIKeyCreateOrUpdateParams,
DataSource,
DataSourceAPIKeyParams,
DataSourceOauth2Params,
DataSourceType,
LinearDataSource,
Expand Down Expand Up @@ -243,7 +266,7 @@ Methods:
Types:

```python
from mixedbread.types import APIKey, APIKeyCreated, APIKeyDeleteResponse
from mixedbread.types import APIKey, APIKeyCreated, Scope, APIKeyDeleteResponse
```

Methods:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "mixedbread"
version = "0.49.0"
version = "0.50.0"
description = "The official Python library for the Mixedbread API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion scripts/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

cd "$(dirname "$0")/.."

if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then
if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "${SKIP_BREW:-}" != "1" ] && [ -t 0 ]; then
brew bundle check >/dev/null 2>&1 || {
echo -n "==> Install Homebrew dependencies? (y/N): "
read -r response
Expand Down
26 changes: 13 additions & 13 deletions scripts/mock
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,34 @@ fi

echo "==> Starting mock server with URL ${URL}"

# Run prism mock on the given spec
# Run steady mock on the given spec
if [ "$1" == "--daemon" ]; then
# Pre-install the package so the download doesn't eat into the startup timeout
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism --version
npm exec --package=@stdy/cli@0.22.1 -- steady --version

npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log &
npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log &

# Wait for server to come online (max 30s)
# Wait for server to come online via health endpoint (max 30s)
echo -n "Waiting for server"
attempts=0
while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do
while ! curl --silent --fail "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1; do
if ! kill -0 $! 2>/dev/null; then
echo
cat .stdy.log
exit 1
fi
attempts=$((attempts + 1))
if [ "$attempts" -ge 300 ]; then
echo
echo "Timed out waiting for Prism server to start"
cat .prism.log
echo "Timed out waiting for Steady server to start"
cat .stdy.log
exit 1
fi
echo -n "."
sleep 0.1
done

if grep -q "✖ fatal" ".prism.log"; then
cat .prism.log
exit 1
fi

echo
else
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL"
npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL"
fi
16 changes: 8 additions & 8 deletions scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color

function prism_is_running() {
curl --silent "http://localhost:4010" >/dev/null 2>&1
function steady_is_running() {
curl --silent "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1
}

kill_server_on_port() {
Expand All @@ -25,7 +25,7 @@ function is_overriding_api_base_url() {
[ -n "$TEST_API_BASE_URL" ]
}

if ! is_overriding_api_base_url && ! prism_is_running ; then
if ! is_overriding_api_base_url && ! steady_is_running ; then
# When we exit this script, make sure to kill the background mock server process
trap 'kill_server_on_port 4010' EXIT

Expand All @@ -36,19 +36,19 @@ fi
if is_overriding_api_base_url ; then
echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}"
echo
elif ! prism_is_running ; then
echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server"
elif ! steady_is_running ; then
echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Steady server"
echo -e "running against your OpenAPI spec."
echo
echo -e "To run the server, pass in the path or url of your OpenAPI"
echo -e "spec to the prism command:"
echo -e "spec to the steady command:"
echo
echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}"
echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.22.1 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}"
echo

exit 1
else
echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}"
echo -e "${GREEN}✔ Mock steady server is running with your OpenAPI spec${NC}"
echo
fi

Expand Down
4 changes: 4 additions & 0 deletions src/mixedbread/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,10 @@ def _build_request(
files = cast(HttpxRequestFiles, ForceMultipartDict())

prepared_url = self._prepare_url(options.url)
# preserve hard-coded query params from the url
if params and prepared_url.query:
params = {**dict(prepared_url.params.items()), **params}
prepared_url = prepared_url.copy_with(raw_path=prepared_url.raw_path.split(b"?", 1)[0])
if "_" in prepared_url.host:
# work around https://github.com/encode/httpx/discussions/2880
kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")}
Expand Down
56 changes: 53 additions & 3 deletions src/mixedbread/_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import io
import os
import pathlib
from typing import overload
from typing_extensions import TypeGuard
from typing import Sequence, cast, overload
from typing_extensions import TypeVar, TypeGuard

import anyio

Expand All @@ -17,7 +17,9 @@
HttpxFileContent,
HttpxRequestFiles,
)
from ._utils import is_tuple_t, is_mapping_t, is_sequence_t
from ._utils import is_list, is_mapping, is_tuple_t, is_mapping_t, is_sequence_t

_T = TypeVar("_T")


def is_base64_file_input(obj: object) -> TypeGuard[Base64FileInput]:
Expand Down Expand Up @@ -121,3 +123,51 @@ async def async_read_file_content(file: FileContent) -> HttpxFileContent:
return await anyio.Path(file).read_bytes()

return file


def deepcopy_with_paths(item: _T, paths: Sequence[Sequence[str]]) -> _T:
"""Copy only the containers along the given paths.

Used to guard against mutation by extract_files without copying the entire structure.
Only dicts and lists that lie on a path are copied; everything else
is returned by reference.

For example, given paths=[["foo", "files", "file"]] and the structure:
{
"foo": {
"bar": {"baz": {}},
"files": {"file": <content>}
}
}
The root dict, "foo", and "files" are copied (they lie on the path).
"bar" and "baz" are returned by reference (off the path).
"""
return _deepcopy_with_paths(item, paths, 0)


def _deepcopy_with_paths(item: _T, paths: Sequence[Sequence[str]], index: int) -> _T:
if not paths:
return item
if is_mapping(item):
key_to_paths: dict[str, list[Sequence[str]]] = {}
for path in paths:
if index < len(path):
key_to_paths.setdefault(path[index], []).append(path)

# if no path continues through this mapping, it won't be mutated and copying it is redundant
if not key_to_paths:
return item

result = dict(item)
for key, subpaths in key_to_paths.items():
if key in result:
result[key] = _deepcopy_with_paths(result[key], subpaths, index + 1)
return cast(_T, result)
if is_list(item):
array_paths = [path for path in paths if index < len(path) and path[index] == "<array>"]

# if no path expects a list here, nothing will be mutated inside it - return by reference
if not array_paths:
return cast(_T, item)
return cast(_T, [_deepcopy_with_paths(entry, array_paths, index + 1) for entry in item])
return item
5 changes: 4 additions & 1 deletion src/mixedbread/_qs.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ def _stringify_item(
items.extend(self._stringify_item(key, item, opts))
return items
elif array_format == "indices":
raise NotImplementedError("The array indices format is not supported yet")
items = []
for i, item in enumerate(value):
items.extend(self._stringify_item(f"{key}[{i}]", item, opts))
return items
elif array_format == "brackets":
items = []
key = key + "[]"
Expand Down
Loading
Loading