fix(types): EmbeddingResponse all-defaulted fields (v0.4.2)#8
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Bumps to 0.4.2.
Note
Low Risk
Low risk patch that only relaxes
EmbeddingResponseconstruction and tweaks its serialization; behavioral impact should be limited to callers relying on missingusagenow serializing asNone.Overview
Makes
EmbeddingResponsefields optional by default (matching LiteLLM fixture expectations), and updatesmodel_dump()to emit"usage": Nonewhenusageis unset.Bumps package version from
0.4.1to0.4.2inarcllm/__init__.pyandpyproject.toml.Reviewed by Cursor Bugbot for commit 5ad5e29. Bugbot is set up for automated code reviews on this repo. Configure here.