Skip to content

fix(types): EmbeddingResponse all-defaulted fields (v0.4.2)#8

Merged
vitalii-dynamiq merged 1 commit into
mainfrom
fix/embeddingresponse-optional-defaults
May 6, 2026
Merged

fix(types): EmbeddingResponse all-defaulted fields (v0.4.2)#8
vitalii-dynamiq merged 1 commit into
mainfrom
fix/embeddingresponse-optional-defaults

Conversation

@vitalii-dynamiq

@vitalii-dynamiq vitalii-dynamiq commented May 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Patch release. End-to-end validation of arcllm-sdk in dynamiq's unit-test suite surfaced 10 failures from test fixtures doing `EmbeddingResponse()` with no positional args.

Root cause: arcllm 0.4.1's `EmbeddingResponse` (`msgspec.Struct`) required three positional fields (`model`, `data`, `usage`); litellm's Pydantic version is fully optional.

Fix: same pattern arcllm already uses for `ModelResponse` —

```python
class EmbeddingResponse(msgspec.Struct):
model: str = ""
data: list[EmbeddingData] = []
usage: EmbeddingUsage | None = None
object: str = "list"
```

`model_dump` emits `"usage": None` when unset to match litellm's serialised shape. Real provider responses always populate every field — this is purely caller ergonomics for fixtures and ad-hoc construction.

Validation

  • `EmbeddingResponse()` no-args construction works
  • arcllm's own 771 tests still pass
  • mypy --strict + ruff clean
  • After release: 10 dynamiq fixture-based tests previously failing should pass

Bumps to 0.4.2.


Note

Low Risk
Low risk patch that only relaxes EmbeddingResponse construction and tweaks its serialization; behavioral impact should be limited to callers relying on missing usage now serializing as None.

Overview
Makes EmbeddingResponse fields optional by default (matching LiteLLM fixture expectations), and updates model_dump() to emit "usage": None when usage is unset.

Bumps package version from 0.4.1 to 0.4.2 in arcllm/__init__.py and pyproject.toml.

Reviewed by Cursor Bugbot for commit 5ad5e29. Bugbot is set up for automated code reviews on this repo. Configure here.

End-to-end validation of arcllm-sdk in dynamiq's unit-test suite
surfaced 10 failures from test fixtures constructing
``EmbeddingResponse()`` with no positional args. Litellm's
EmbeddingResponse is a Pydantic model where every field is optional;
arcllm 0.4.1's ``msgspec.Struct`` had three required fields (model,
data, usage), so every fixture-style construction blew up with
``TypeError: Missing required argument 'model'``.

Aligned with the same pattern arcllm already uses for ``ModelResponse``:

- ``model: str = ""``
- ``data: list[EmbeddingData] = []``
- ``usage: EmbeddingUsage | None = None``

``model_dump`` now emits ``"usage": None`` when the field is unset,
matching litellm's serialised shape. Real provider responses always
populate every field, so this is purely caller ergonomics.

Bumps to 0.4.2.
@vitalii-dynamiq vitalii-dynamiq merged commit e240bc1 into main May 6, 2026
15 checks passed
@vitalii-dynamiq vitalii-dynamiq deleted the fix/embeddingresponse-optional-defaults branch May 6, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant