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
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jobs:
lint:
name: lint
runs-on: ubuntu-latest


steps:
- uses: actions/checkout@v4
Expand All @@ -30,6 +29,7 @@ jobs:

- name: Run lints
run: ./scripts/lint

test:
name: test
runs-on: ubuntu-latest
Expand All @@ -50,4 +50,3 @@ jobs:

- name: Run tests
run: ./scripts/test

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.1.0-alpha.12"
".": "0.1.0-alpha.13"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-a9b8728ee918c023a0e1458cfab7f26721d4ac851c533c6ce2f53411bc1576d1.yml
configured_endpoints: 32
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-43906e7132098c54e8b761fa3bd67fbd9174894faeb22367a681e92f60f6445f.yml
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## 0.1.0-alpha.13 (2025-01-27)

Full Changelog: [v0.1.0-alpha.12...v0.1.0-alpha.13](https://github.com/mixedbread-ai/mixedbread-python/compare/v0.1.0-alpha.12...v0.1.0-alpha.13)

### Features

* **api:** update via SDK Studio ([#65](https://github.com/mixedbread-ai/mixedbread-python/issues/65)) ([cd92872](https://github.com/mixedbread-ai/mixedbread-python/commit/cd92872a9396d215a8bbafc3bfbd184e4a3ab429))
* **api:** update via SDK Studio ([#67](https://github.com/mixedbread-ai/mixedbread-python/issues/67)) ([8187944](https://github.com/mixedbread-ai/mixedbread-python/commit/818794418c7370c0d548335bdb9281c11b2a5794))
* **api:** update via SDK Studio ([#72](https://github.com/mixedbread-ai/mixedbread-python/issues/72)) ([8535a3a](https://github.com/mixedbread-ai/mixedbread-python/commit/8535a3a1423434482e7fe6b91653995c39839cec))


### Chores

* **internal:** codegen related update ([#66](https://github.com/mixedbread-ai/mixedbread-python/issues/66)) ([df284d3](https://github.com/mixedbread-ai/mixedbread-python/commit/df284d359787501edf6aa4bac56f7fc740ea2464))
* **internal:** codegen related update ([#69](https://github.com/mixedbread-ai/mixedbread-python/issues/69)) ([645d6a2](https://github.com/mixedbread-ai/mixedbread-python/commit/645d6a29692ebad7ea123f7f35f7ceecdb86863c))
* **internal:** codegen related update ([#70](https://github.com/mixedbread-ai/mixedbread-python/issues/70)) ([e167953](https://github.com/mixedbread-ai/mixedbread-python/commit/e1679530da659697a24e1cfb6f22818939662ff4))
* **internal:** minor formatting changes ([#71](https://github.com/mixedbread-ai/mixedbread-python/issues/71)) ([38087e0](https://github.com/mixedbread-ai/mixedbread-python/commit/38087e083a753dbbb6e1ac2dac553481fedc7b9d))

## 0.1.0-alpha.12 (2025-01-13)

Full Changelog: [v0.1.0-alpha.11...v0.1.0-alpha.12](https://github.com/mixedbread-ai/mixedbread-python/compare/v0.1.0-alpha.11...v0.1.0-alpha.12)
Expand Down
66 changes: 65 additions & 1 deletion api.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Shared Types

```python
from mixedbread.types import SearchFilter, SearchFilterCondition
```

# Mixedbread

Types:
Expand Down Expand Up @@ -41,13 +47,15 @@ Methods:
Types:

```python
from mixedbread.types.parsing import ParsingJob
from mixedbread.types.parsing import ParsingJob, JobListResponse, JobCancelResponse
```

Methods:

- <code title="post /v1/parsing/jobs">client.parsing.jobs.<a href="./src/mixedbread/resources/parsing/jobs.py">create</a>(\*\*<a href="src/mixedbread/types/parsing/job_create_params.py">params</a>) -> <a href="./src/mixedbread/types/parsing/parsing_job.py">ParsingJob</a></code>
- <code title="get /v1/parsing/jobs/{job_id}">client.parsing.jobs.<a href="./src/mixedbread/resources/parsing/jobs.py">retrieve</a>(job_id) -> <a href="./src/mixedbread/types/parsing/parsing_job.py">ParsingJob</a></code>
- <code title="get /v1/parsing/jobs">client.parsing.jobs.<a href="./src/mixedbread/resources/parsing/jobs.py">list</a>(\*\*<a href="src/mixedbread/types/parsing/job_list_params.py">params</a>) -> <a href="./src/mixedbread/types/parsing/job_list_response.py">SyncLimitOffset[JobListResponse]</a></code>
- <code title="delete /v1/parsing/jobs/{job_id}">client.parsing.jobs.<a href="./src/mixedbread/resources/parsing/jobs.py">cancel</a>(job_id) -> <a href="./src/mixedbread/types/parsing/job_cancel_response.py">JobCancelResponse</a></code>

# Files

Expand Down Expand Up @@ -76,7 +84,9 @@ from mixedbread.types import (
FileCounts,
ScoredVectorStoreChunk,
VectorStore,
VectorStoreSearchOptions,
VectorStoreDeleteResponse,
VectorStoreQuestionAnsweringResponse,
VectorStoreSearchResponse,
)
```
Expand All @@ -88,6 +98,7 @@ Methods:
- <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">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="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">object</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>

## Files
Expand All @@ -110,3 +121,56 @@ Methods:
- <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/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>

# Completions

Types:

```python
from mixedbread.types import CompletionCreateResponse
```

Methods:

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

# Extractions

## Jobs

Types:

```python
from mixedbread.types.extractions import ExtractionJob
```

Methods:

- <code title="post /v1/extractions/jobs">client.extractions.jobs.<a href="./src/mixedbread/resources/extractions/jobs.py">create</a>(\*\*<a href="src/mixedbread/types/extractions/job_create_params.py">params</a>) -> <a href="./src/mixedbread/types/extractions/extraction_job.py">ExtractionJob</a></code>
- <code title="get /v1/extractions/jobs/{job_id}">client.extractions.jobs.<a href="./src/mixedbread/resources/extractions/jobs.py">retrieve</a>(job_id) -> <a href="./src/mixedbread/types/extractions/extraction_job.py">ExtractionJob</a></code>

## Schema

Types:

```python
from mixedbread.types.extractions import CreatedJsonSchema, EnhancedJsonSchema, ValidatedJsonSchema
```

Methods:

- <code title="post /v1/extractions/schema">client.extractions.schema.<a href="./src/mixedbread/resources/extractions/schema.py">create</a>(\*\*<a href="src/mixedbread/types/extractions/schema_create_params.py">params</a>) -> <a href="./src/mixedbread/types/extractions/created_json_schema.py">CreatedJsonSchema</a></code>
- <code title="post /v1/extractions/schema/enhance">client.extractions.schema.<a href="./src/mixedbread/resources/extractions/schema.py">enhance</a>(\*\*<a href="src/mixedbread/types/extractions/schema_enhance_params.py">params</a>) -> <a href="./src/mixedbread/types/extractions/enhanced_json_schema.py">EnhancedJsonSchema</a></code>
- <code title="post /v1/extractions/schema/validate">client.extractions.schema.<a href="./src/mixedbread/resources/extractions/schema.py">validate</a>(\*\*<a href="src/mixedbread/types/extractions/schema_validate_params.py">params</a>) -> <a href="./src/mixedbread/types/extractions/validated_json_schema.py">ValidatedJsonSchema</a></code>

## Content

Types:

```python
from mixedbread.types.extractions import ExtractionResult
```

Methods:

- <code title="post /v1/extractions/content">client.extractions.content.<a href="./src/mixedbread/resources/extractions/content.py">create</a>(\*\*<a href="src/mixedbread/types/extractions/content_create_params.py">params</a>) -> <a href="./src/mixedbread/types/extractions/extraction_result.py">ExtractionResult</a></code>
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ cache_fine_grained = True
# ```
# Changing this codegen to make mypy happy would increase complexity
# and would not be worth it.
disable_error_code = func-returns-value
disable_error_code = func-returns-value,overload-cannot-match

# https://github.com/python/mypy/issues/12162
[mypy.overrides]
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "mixedbread"
version = "0.1.0-alpha.12"
description = "The official Python library for the mixedbread API"
version = "0.1.0-alpha.13"
description = "The official Python library for the Mixedbread API"
dynamic = ["readme"]
license = "Apache-2.0"
authors = [
Expand Down Expand Up @@ -129,6 +129,7 @@ testpaths = ["tests"]
addopts = "--tb=short"
xfail_strict = true
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "session"
filterwarnings = [
"error"
]
Expand Down
5 changes: 3 additions & 2 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# all-features: true
# with-sources: false
# generate-hashes: false
# universal: false

-e file:.
annotated-types==0.6.0
Expand Down Expand Up @@ -48,7 +49,7 @@ markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
mypy==1.13.0
mypy==1.14.1
mypy-extensions==1.0.0
# via mypy
nest-asyncio==1.6.0
Expand All @@ -68,7 +69,7 @@ pydantic-core==2.27.1
# via pydantic
pygments==2.18.0
# via rich
pyright==1.1.390
pyright==1.1.392.post0
pytest==8.3.3
# via pytest-asyncio
pytest-asyncio==0.24.0
Expand Down
1 change: 1 addition & 0 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# all-features: true
# with-sources: false
# generate-hashes: false
# universal: false

-e file:.
annotated-types==0.6.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" ]; then
if ! command -v rye >/dev/null 2>&1 && [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then
brew bundle check >/dev/null 2>&1 || {
echo "==> Installing Homebrew dependencies…"
brew bundle
Expand Down
1 change: 0 additions & 1 deletion scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ rye run lint

echo "==> Making sure it imports"
rye run python -c 'import mixedbread'

23 changes: 20 additions & 3 deletions src/mixedbread/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from .resources import files, reranking, embeddings
from .resources import files, reranking, embeddings, completions
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
from ._exceptions import APIStatusError, MixedbreadError
from ._base_client import (
Expand All @@ -44,6 +44,7 @@
)
from .resources.parsing import parsing
from .types.info_response import InfoResponse
from .resources.extractions import extractions
from .resources.vector_stores import vector_stores

__all__ = [
Expand All @@ -70,6 +71,8 @@ class Mixedbread(SyncAPIClient):
parsing: parsing.ParsingResource
files: files.FilesResource
vector_stores: vector_stores.VectorStoresResource
completions: completions.CompletionsResource
extractions: extractions.ExtractionsResource
with_raw_response: MixedbreadWithRawResponse
with_streaming_response: MixedbreadWithStreamedResponse

Expand Down Expand Up @@ -102,7 +105,7 @@ def __init__(
# part of our public interface in the future.
_strict_response_validation: bool = False,
) -> None:
"""Construct a new synchronous mixedbread client instance.
"""Construct a new synchronous Mixedbread client instance.

This automatically infers the `api_key` argument from the `MXBAI_API_KEY` environment variable if it is not provided.
"""
Expand Down Expand Up @@ -156,6 +159,8 @@ def __init__(
self.parsing = parsing.ParsingResource(self)
self.files = files.FilesResource(self)
self.vector_stores = vector_stores.VectorStoresResource(self)
self.completions = completions.CompletionsResource(self)
self.extractions = extractions.ExtractionsResource(self)
self.with_raw_response = MixedbreadWithRawResponse(self)
self.with_streaming_response = MixedbreadWithStreamedResponse(self)

Expand Down Expand Up @@ -295,6 +300,8 @@ class AsyncMixedbread(AsyncAPIClient):
parsing: parsing.AsyncParsingResource
files: files.AsyncFilesResource
vector_stores: vector_stores.AsyncVectorStoresResource
completions: completions.AsyncCompletionsResource
extractions: extractions.AsyncExtractionsResource
with_raw_response: AsyncMixedbreadWithRawResponse
with_streaming_response: AsyncMixedbreadWithStreamedResponse

Expand Down Expand Up @@ -327,7 +334,7 @@ def __init__(
# part of our public interface in the future.
_strict_response_validation: bool = False,
) -> None:
"""Construct a new async mixedbread client instance.
"""Construct a new async Mixedbread client instance.

This automatically infers the `api_key` argument from the `MXBAI_API_KEY` environment variable if it is not provided.
"""
Expand Down Expand Up @@ -381,6 +388,8 @@ def __init__(
self.parsing = parsing.AsyncParsingResource(self)
self.files = files.AsyncFilesResource(self)
self.vector_stores = vector_stores.AsyncVectorStoresResource(self)
self.completions = completions.AsyncCompletionsResource(self)
self.extractions = extractions.AsyncExtractionsResource(self)
self.with_raw_response = AsyncMixedbreadWithRawResponse(self)
self.with_streaming_response = AsyncMixedbreadWithStreamedResponse(self)

Expand Down Expand Up @@ -521,6 +530,8 @@ def __init__(self, client: Mixedbread) -> None:
self.parsing = parsing.ParsingResourceWithRawResponse(client.parsing)
self.files = files.FilesResourceWithRawResponse(client.files)
self.vector_stores = vector_stores.VectorStoresResourceWithRawResponse(client.vector_stores)
self.completions = completions.CompletionsResourceWithRawResponse(client.completions)
self.extractions = extractions.ExtractionsResourceWithRawResponse(client.extractions)

self.info = to_raw_response_wrapper(
client.info,
Expand All @@ -534,6 +545,8 @@ def __init__(self, client: AsyncMixedbread) -> None:
self.parsing = parsing.AsyncParsingResourceWithRawResponse(client.parsing)
self.files = files.AsyncFilesResourceWithRawResponse(client.files)
self.vector_stores = vector_stores.AsyncVectorStoresResourceWithRawResponse(client.vector_stores)
self.completions = completions.AsyncCompletionsResourceWithRawResponse(client.completions)
self.extractions = extractions.AsyncExtractionsResourceWithRawResponse(client.extractions)

self.info = async_to_raw_response_wrapper(
client.info,
Expand All @@ -547,6 +560,8 @@ def __init__(self, client: Mixedbread) -> None:
self.parsing = parsing.ParsingResourceWithStreamingResponse(client.parsing)
self.files = files.FilesResourceWithStreamingResponse(client.files)
self.vector_stores = vector_stores.VectorStoresResourceWithStreamingResponse(client.vector_stores)
self.completions = completions.CompletionsResourceWithStreamingResponse(client.completions)
self.extractions = extractions.ExtractionsResourceWithStreamingResponse(client.extractions)

self.info = to_streamed_response_wrapper(
client.info,
Expand All @@ -560,6 +575,8 @@ def __init__(self, client: AsyncMixedbread) -> None:
self.parsing = parsing.AsyncParsingResourceWithStreamingResponse(client.parsing)
self.files = files.AsyncFilesResourceWithStreamingResponse(client.files)
self.vector_stores = vector_stores.AsyncVectorStoresResourceWithStreamingResponse(client.vector_stores)
self.completions = completions.AsyncCompletionsResourceWithStreamingResponse(client.completions)
self.extractions = extractions.AsyncExtractionsResourceWithStreamingResponse(client.extractions)

self.info = async_to_streamed_response_wrapper(
client.info,
Expand Down
12 changes: 9 additions & 3 deletions src/mixedbread/_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
if cast_to and is_annotated_type(cast_to):
cast_to = extract_type_arg(cast_to, 0)

origin = get_origin(cast_to) or cast_to

if self._is_sse_stream:
if to:
if not is_stream_class_type(to):
Expand Down Expand Up @@ -195,8 +197,6 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
if cast_to == bool:
return cast(R, response.text.lower() == "true")

origin = get_origin(cast_to) or cast_to

if origin == APIResponse:
raise RuntimeError("Unexpected state - cast_to is `APIResponse`")

Expand All @@ -210,7 +210,13 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
raise ValueError(f"Subclasses of httpx.Response cannot be passed to `cast_to`")
return cast(R, response)

if inspect.isclass(origin) and not issubclass(origin, BaseModel) and issubclass(origin, pydantic.BaseModel):
if (
inspect.isclass(
origin # pyright: ignore[reportUnknownArgumentType]
)
and not issubclass(origin, BaseModel)
and issubclass(origin, pydantic.BaseModel)
):
raise TypeError(
"Pydantic models must subclass our base model type, e.g. `from mixedbread import BaseModel`"
)
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.1.0-alpha.12" # x-release-please-version
__version__ = "0.1.0-alpha.13" # x-release-please-version
1 change: 0 additions & 1 deletion src/mixedbread/lib/polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def poll(
time.sleep(wait_time)


@staticmethod
async def poll_async(
fn: Callable[[], Awaitable[T]],
condition: Callable[[T], bool],
Expand Down
Loading