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.5.0"
".": "0.6.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: 49
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-82c2c1c322149cd73b2e8e45f475919b941752a89e74464ccecd1aee9352e9be.yml
openapi_spec_hash: 07482ed86f5ccf7b480c514d6d5ebb15
config_hash: 167171738605c297aa5e8bc73abc66e3
configured_endpoints: 48
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-a331b701867ba3d3dd907c8389fde663be4fda24c91e23f54f4dde8a6ade683f.yml
openapi_spec_hash: 95587d9746abb97d5b294bfedf86b782
config_hash: 8545159b6ba2d638b8a2e7bbed6f04e7
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Changelog

## 0.6.0 (2025-06-13)

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

### Features

* **api:** api update ([8ada0ea](https://github.com/mixedbread-ai/mixedbread-python/commit/8ada0eaeeed29b8ee2a08cf436077ee2f729794a))
* **api:** api update ([22e5269](https://github.com/mixedbread-ai/mixedbread-python/commit/22e52693cb2f02fb20c0f7ca8f97d572a1091f6f))
* **api:** api update ([eec921b](https://github.com/mixedbread-ai/mixedbread-python/commit/eec921b939205565f11790b08458f3e74df6e8a3))
* **api:** api update ([0296d95](https://github.com/mixedbread-ai/mixedbread-python/commit/0296d958b5d8e82e2626fc04f9618a6423803515))
* **api:** update via SDK Studio ([56f4e89](https://github.com/mixedbread-ai/mixedbread-python/commit/56f4e890d75c0cc54898f65f4087a828fe4bcc4e))
* **api:** update via SDK Studio ([ed99b06](https://github.com/mixedbread-ai/mixedbread-python/commit/ed99b067eba308da0bb4ff24623d32b3339563a1))
* **client:** add follow_redirects request option ([5f0a4ab](https://github.com/mixedbread-ai/mixedbread-python/commit/5f0a4abbecd635ad655480514685281891fd8699))


### Bug Fixes

* **client:** correctly parse binary response | stream ([786bd6a](https://github.com/mixedbread-ai/mixedbread-python/commit/786bd6aeeac6fb7af0ffb1f00b6485dd253bd8fa))
* **docs/api:** remove references to nonexistent types ([43c342b](https://github.com/mixedbread-ai/mixedbread-python/commit/43c342bb106371ea6057969578dc55af713f225e))


### Chores

* **docs:** remove reference to rye shell ([c0c8bfd](https://github.com/mixedbread-ai/mixedbread-python/commit/c0c8bfdeac4c2ed4b7d381a9faef43485e5904de))
* **docs:** remove unnecessary param examples ([54ef7c7](https://github.com/mixedbread-ai/mixedbread-python/commit/54ef7c77e392577a3038552a4a859b6351c6ddf4))
* **tests:** run tests in parallel ([064a793](https://github.com/mixedbread-ai/mixedbread-python/commit/064a793c8269a6e3a30a1c84e6d7a3a783ffa31f))

## 0.5.0 (2025-05-26)

Full Changelog: [v0.4.0...v0.5.0](https://github.com/mixedbread-ai/mixedbread-python/compare/v0.4.0...v0.5.0)
Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ $ rye sync --all-features
You can then run scripts using `rye run python script.py` or by activating the virtual environment:

```sh
$ rye shell
# or manually activate - https://docs.python.org/3/library/venv.html#how-venvs-work
# Activate the virtual environment - https://docs.python.org/3/library/venv.html#how-venvs-work
$ source .venv/bin/activate

# now you can omit the `rye run` prefix
Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,7 @@ from mixedbread import Mixedbread
client = Mixedbread()

vector_store = client.vector_stores.create(
expires_after={
"anchor": "last_active_at",
"days": 0,
},
expires_after={},
)
print(vector_store.expires_after)
```
Expand Down
26 changes: 7 additions & 19 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ from mixedbread.types import (
Methods:

- <code title="post /v1/vector_stores">client.vector_stores.<a href="./src/mixedbread/resources/vector_stores/vector_stores.py">create</a>(\*\*<a href="src/mixedbread/types/vector_store_create_params.py">params</a>) -> <a href="./src/mixedbread/types/vector_store.py">VectorStore</a></code>
- <code title="get /v1/vector_stores/{vector_store_id}">client.vector_stores.<a href="./src/mixedbread/resources/vector_stores/vector_stores.py">retrieve</a>(vector_store_id) -> <a href="./src/mixedbread/types/vector_store.py">VectorStore</a></code>
- <code title="put /v1/vector_stores/{vector_store_id}">client.vector_stores.<a href="./src/mixedbread/resources/vector_stores/vector_stores.py">update</a>(vector_store_id, \*\*<a href="src/mixedbread/types/vector_store_update_params.py">params</a>) -> <a href="./src/mixedbread/types/vector_store.py">VectorStore</a></code>
- <code title="get /v1/vector_stores/{vector_store_identifier}">client.vector_stores.<a href="./src/mixedbread/resources/vector_stores/vector_stores.py">retrieve</a>(vector_store_identifier) -> <a href="./src/mixedbread/types/vector_store.py">VectorStore</a></code>
- <code title="put /v1/vector_stores/{vector_store_identifier}">client.vector_stores.<a href="./src/mixedbread/resources/vector_stores/vector_stores.py">update</a>(vector_store_identifier, \*\*<a href="src/mixedbread/types/vector_store_update_params.py">params</a>) -> <a href="./src/mixedbread/types/vector_store.py">VectorStore</a></code>
- <code title="get /v1/vector_stores">client.vector_stores.<a href="./src/mixedbread/resources/vector_stores/vector_stores.py">list</a>(\*\*<a href="src/mixedbread/types/vector_store_list_params.py">params</a>) -> <a href="./src/mixedbread/types/vector_store.py">SyncLimitOffset[VectorStore]</a></code>
- <code title="delete /v1/vector_stores/{vector_store_id}">client.vector_stores.<a href="./src/mixedbread/resources/vector_stores/vector_stores.py">delete</a>(vector_store_id) -> <a href="./src/mixedbread/types/vector_store_delete_response.py">VectorStoreDeleteResponse</a></code>
- <code title="delete /v1/vector_stores/{vector_store_identifier}">client.vector_stores.<a href="./src/mixedbread/resources/vector_stores/vector_stores.py">delete</a>(vector_store_identifier) -> <a href="./src/mixedbread/types/vector_store_delete_response.py">VectorStoreDeleteResponse</a></code>
- <code title="post /v1/vector_stores/question-answering">client.vector_stores.<a href="./src/mixedbread/resources/vector_stores/vector_stores.py">question_answering</a>(\*\*<a href="src/mixedbread/types/vector_store_question_answering_params.py">params</a>) -> <a href="./src/mixedbread/types/vector_store_question_answering_response.py">VectorStoreQuestionAnsweringResponse</a></code>
- <code title="post /v1/vector_stores/search">client.vector_stores.<a href="./src/mixedbread/resources/vector_stores/vector_stores.py">search</a>(\*\*<a href="src/mixedbread/types/vector_store_search_params.py">params</a>) -> <a href="./src/mixedbread/types/vector_store_search_response.py">VectorStoreSearchResponse</a></code>

Expand All @@ -68,10 +68,10 @@ from mixedbread.types.vector_stores import (

Methods:

- <code title="post /v1/vector_stores/{vector_store_id}/files">client.vector_stores.files.<a href="./src/mixedbread/resources/vector_stores/files.py">create</a>(vector_store_id, \*\*<a href="src/mixedbread/types/vector_stores/file_create_params.py">params</a>) -> <a href="./src/mixedbread/types/vector_stores/vector_store_file.py">VectorStoreFile</a></code>
- <code title="get /v1/vector_stores/{vector_store_id}/files/{file_id}">client.vector_stores.files.<a href="./src/mixedbread/resources/vector_stores/files.py">retrieve</a>(file_id, \*, vector_store_id) -> <a href="./src/mixedbread/types/vector_stores/vector_store_file.py">VectorStoreFile</a></code>
- <code title="get /v1/vector_stores/{vector_store_id}/files">client.vector_stores.files.<a href="./src/mixedbread/resources/vector_stores/files.py">list</a>(vector_store_id, \*\*<a href="src/mixedbread/types/vector_stores/file_list_params.py">params</a>) -> <a href="./src/mixedbread/types/vector_stores/vector_store_file.py">SyncLimitOffset[VectorStoreFile]</a></code>
- <code title="delete /v1/vector_stores/{vector_store_id}/files/{file_id}">client.vector_stores.files.<a href="./src/mixedbread/resources/vector_stores/files.py">delete</a>(file_id, \*, vector_store_id) -> <a href="./src/mixedbread/types/vector_stores/file_delete_response.py">FileDeleteResponse</a></code>
- <code title="post /v1/vector_stores/{vector_store_identifier}/files">client.vector_stores.files.<a href="./src/mixedbread/resources/vector_stores/files.py">create</a>(vector_store_identifier, \*\*<a href="src/mixedbread/types/vector_stores/file_create_params.py">params</a>) -> <a href="./src/mixedbread/types/vector_stores/vector_store_file.py">VectorStoreFile</a></code>
- <code title="get /v1/vector_stores/{vector_store_identifier}/files/{file_id}">client.vector_stores.files.<a href="./src/mixedbread/resources/vector_stores/files.py">retrieve</a>(file_id, \*, vector_store_identifier) -> <a href="./src/mixedbread/types/vector_stores/vector_store_file.py">VectorStoreFile</a></code>
- <code title="get /v1/vector_stores/{vector_store_identifier}/files">client.vector_stores.files.<a href="./src/mixedbread/resources/vector_stores/files.py">list</a>(vector_store_identifier, \*\*<a href="src/mixedbread/types/vector_stores/file_list_params.py">params</a>) -> <a href="./src/mixedbread/types/vector_stores/vector_store_file.py">SyncLimitOffset[VectorStoreFile]</a></code>
- <code title="delete /v1/vector_stores/{vector_store_identifier}/files/{file_id}">client.vector_stores.files.<a href="./src/mixedbread/resources/vector_stores/files.py">delete</a>(file_id, \*, vector_store_identifier) -> <a href="./src/mixedbread/types/vector_stores/file_delete_response.py">FileDeleteResponse</a></code>
- <code title="post /v1/vector_stores/files/search">client.vector_stores.files.<a href="./src/mixedbread/resources/vector_stores/files.py">search</a>(\*\*<a href="src/mixedbread/types/vector_stores/file_search_params.py">params</a>) -> <a href="./src/mixedbread/types/vector_stores/file_search_response.py">FileSearchResponse</a></code>

# Parsing
Expand Down Expand Up @@ -170,18 +170,6 @@ 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>

# Chat

Types:

```python
from mixedbread.types import ChatCreateCompletionResponse
```

Methods:

- <code title="post /v1/chat/completions">client.chat.<a href="./src/mixedbread/resources/chat.py">create_completion</a>() -> <a href="./src/mixedbread/types/chat_create_completion_response.py">object</a></code>

# DataSources

Types:
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "mixedbread"
version = "0.5.0"
version = "0.6.0"
description = "The official Python library for the Mixedbread API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -54,6 +54,7 @@ dev-dependencies = [
"importlib-metadata>=6.7.0",
"rich>=13.7.1",
"nest_asyncio==1.6.0",
"pytest-xdist>=3.6.1",
]

[tool.rye.scripts]
Expand Down Expand Up @@ -125,7 +126,7 @@ replacement = '[\1](https://github.com/mixedbread-ai/mixedbread-python/tree/main

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--tb=short"
addopts = "--tb=short -n auto"
xfail_strict = true
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "session"
Expand Down
4 changes: 4 additions & 0 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ distro==1.8.0
exceptiongroup==1.2.2
# via anyio
# via pytest
execnet==2.1.1
# via pytest-xdist
filelock==3.12.4
# via virtualenv
h11==0.14.0
Expand Down Expand Up @@ -72,7 +74,9 @@ pygments==2.18.0
pyright==1.1.399
pytest==8.3.3
# via pytest-asyncio
# via pytest-xdist
pytest-asyncio==0.24.0
pytest-xdist==3.7.0
python-dateutil==2.8.2
# via time-machine
pytz==2023.3.post1
Expand Down
24 changes: 22 additions & 2 deletions src/mixedbread/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,9 @@ def request(
if self.custom_auth is not None:
kwargs["auth"] = self.custom_auth

if options.follow_redirects is not None:
kwargs["follow_redirects"] = options.follow_redirects

log.debug("Sending HTTP Request: %s %s", request.method, request.url)

response = None
Expand Down Expand Up @@ -1068,7 +1071,14 @@ def _process_response(
) -> ResponseT:
origin = get_origin(cast_to) or cast_to

if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse):
if (
inspect.isclass(origin)
and issubclass(origin, BaseAPIResponse)
# we only want to actually return the custom BaseAPIResponse class if we're
# returning the raw response, or if we're not streaming SSE, as if we're streaming
# SSE then `cast_to` doesn't actively reflect the type we need to parse into
and (not stream or bool(response.request.headers.get(RAW_RESPONSE_HEADER)))
):
if not issubclass(origin, APIResponse):
raise TypeError(f"API Response types must subclass {APIResponse}; Received {origin}")

Expand Down Expand Up @@ -1460,6 +1470,9 @@ async def request(
if self.custom_auth is not None:
kwargs["auth"] = self.custom_auth

if options.follow_redirects is not None:
kwargs["follow_redirects"] = options.follow_redirects

log.debug("Sending HTTP Request: %s %s", request.method, request.url)

response = None
Expand Down Expand Up @@ -1568,7 +1581,14 @@ async def _process_response(
) -> ResponseT:
origin = get_origin(cast_to) or cast_to

if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse):
if (
inspect.isclass(origin)
and issubclass(origin, BaseAPIResponse)
# we only want to actually return the custom BaseAPIResponse class if we're
# returning the raw response, or if we're not streaming SSE, as if we're streaming
# SSE then `cast_to` doesn't actively reflect the type we need to parse into
and (not stream or bool(response.request.headers.get(RAW_RESPONSE_HEADER)))
):
if not issubclass(origin, AsyncAPIResponse):
raise TypeError(f"API Response types must subclass {AsyncAPIResponse}; Received {origin}")

Expand Down
10 changes: 1 addition & 9 deletions src/mixedbread/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from .resources import chat, files, api_keys, embeddings
from .resources import files, api_keys, embeddings
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
from ._exceptions import APIStatusError, MixedbreadError
from ._base_client import (
Expand Down Expand Up @@ -78,7 +78,6 @@ class Mixedbread(SyncAPIClient):
files: files.FilesResource
extractions: extractions.ExtractionsResource
embeddings: embeddings.EmbeddingsResource
chat: chat.ChatResource
data_sources: data_sources.DataSourcesResource
api_keys: api_keys.APIKeysResource
with_raw_response: MixedbreadWithRawResponse
Expand Down Expand Up @@ -167,7 +166,6 @@ def __init__(
self.files = files.FilesResource(self)
self.extractions = extractions.ExtractionsResource(self)
self.embeddings = embeddings.EmbeddingsResource(self)
self.chat = chat.ChatResource(self)
self.data_sources = data_sources.DataSourcesResource(self)
self.api_keys = api_keys.APIKeysResource(self)
self.with_raw_response = MixedbreadWithRawResponse(self)
Expand Down Expand Up @@ -441,7 +439,6 @@ class AsyncMixedbread(AsyncAPIClient):
files: files.AsyncFilesResource
extractions: extractions.AsyncExtractionsResource
embeddings: embeddings.AsyncEmbeddingsResource
chat: chat.AsyncChatResource
data_sources: data_sources.AsyncDataSourcesResource
api_keys: api_keys.AsyncAPIKeysResource
with_raw_response: AsyncMixedbreadWithRawResponse
Expand Down Expand Up @@ -530,7 +527,6 @@ def __init__(
self.files = files.AsyncFilesResource(self)
self.extractions = extractions.AsyncExtractionsResource(self)
self.embeddings = embeddings.AsyncEmbeddingsResource(self)
self.chat = chat.AsyncChatResource(self)
self.data_sources = data_sources.AsyncDataSourcesResource(self)
self.api_keys = api_keys.AsyncAPIKeysResource(self)
self.with_raw_response = AsyncMixedbreadWithRawResponse(self)
Expand Down Expand Up @@ -805,7 +801,6 @@ def __init__(self, client: Mixedbread) -> None:
self.files = files.FilesResourceWithRawResponse(client.files)
self.extractions = extractions.ExtractionsResourceWithRawResponse(client.extractions)
self.embeddings = embeddings.EmbeddingsResourceWithRawResponse(client.embeddings)
self.chat = chat.ChatResourceWithRawResponse(client.chat)
self.data_sources = data_sources.DataSourcesResourceWithRawResponse(client.data_sources)
self.api_keys = api_keys.APIKeysResourceWithRawResponse(client.api_keys)

Expand All @@ -827,7 +822,6 @@ def __init__(self, client: AsyncMixedbread) -> None:
self.files = files.AsyncFilesResourceWithRawResponse(client.files)
self.extractions = extractions.AsyncExtractionsResourceWithRawResponse(client.extractions)
self.embeddings = embeddings.AsyncEmbeddingsResourceWithRawResponse(client.embeddings)
self.chat = chat.AsyncChatResourceWithRawResponse(client.chat)
self.data_sources = data_sources.AsyncDataSourcesResourceWithRawResponse(client.data_sources)
self.api_keys = api_keys.AsyncAPIKeysResourceWithRawResponse(client.api_keys)

Expand All @@ -849,7 +843,6 @@ def __init__(self, client: Mixedbread) -> None:
self.files = files.FilesResourceWithStreamingResponse(client.files)
self.extractions = extractions.ExtractionsResourceWithStreamingResponse(client.extractions)
self.embeddings = embeddings.EmbeddingsResourceWithStreamingResponse(client.embeddings)
self.chat = chat.ChatResourceWithStreamingResponse(client.chat)
self.data_sources = data_sources.DataSourcesResourceWithStreamingResponse(client.data_sources)
self.api_keys = api_keys.APIKeysResourceWithStreamingResponse(client.api_keys)

Expand All @@ -871,7 +864,6 @@ def __init__(self, client: AsyncMixedbread) -> None:
self.files = files.AsyncFilesResourceWithStreamingResponse(client.files)
self.extractions = extractions.AsyncExtractionsResourceWithStreamingResponse(client.extractions)
self.embeddings = embeddings.AsyncEmbeddingsResourceWithStreamingResponse(client.embeddings)
self.chat = chat.AsyncChatResourceWithStreamingResponse(client.chat)
self.data_sources = data_sources.AsyncDataSourcesResourceWithStreamingResponse(client.data_sources)
self.api_keys = api_keys.AsyncAPIKeysResourceWithStreamingResponse(client.api_keys)

Expand Down
2 changes: 2 additions & 0 deletions src/mixedbread/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@ class FinalRequestOptionsInput(TypedDict, total=False):
idempotency_key: str
json_data: Body
extra_json: AnyMapping
follow_redirects: bool


@final
Expand All @@ -750,6 +751,7 @@ class FinalRequestOptions(pydantic.BaseModel):
files: Union[HttpxRequestFiles, None] = None
idempotency_key: Union[str, None] = None
post_parser: Union[Callable[[Any], Any], NotGiven] = NotGiven()
follow_redirects: Union[bool, None] = None

# It should be noted that we cannot use `json` here as that would override
# a BaseModel method in an incompatible fashion.
Expand Down
2 changes: 2 additions & 0 deletions src/mixedbread/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class RequestOptions(TypedDict, total=False):
params: Query
extra_json: AnyMapping
idempotency_key: str
follow_redirects: bool


# Sentinel class used until PEP 0661 is accepted
Expand Down Expand Up @@ -215,3 +216,4 @@ class _GenericAlias(Protocol):

class HttpxSendArgs(TypedDict, total=False):
auth: httpx.Auth
follow_redirects: bool
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.5.0" # x-release-please-version
__version__ = "0.6.0" # x-release-please-version
Loading
Loading