Migration 0.22x–0.23x¶
Use when upgrading from a version older than these releases: 0.234.0, 0.233.0 and 0.229.0.
Part of the Migration guide.
0.234.0 — a generated model is built with its Python names, and the type-checker agrees¶
Nothing changes at runtime. What changes is what pyright accepts.
Construct with the field name, not the alias¶
Fields carrying a wire name moved from Field(alias=...) to
Field(validation_alias=..., serialization_alias=...). Runtime is identical —
the models already set populate_by_name=True, so both spellings always
validated. What changes is the parameter a type-checker sees:
from tempest_fastapi_sdk.integrations.payment.openpix import ChargePayload
# before: it ran, but pyright reported "No parameter named correlation_id"
# now: both accept it
payload = ChargePayload(correlation_id="order-1", value=1990)
If your code used the alias purely to silence the checker
(ChargePayload(correlationID="order-1")), it still runs — validation takes
the alias — but the checker now objects. Switch to the Python name.
Reading and writing are unchanged: model_validate({"correlationID": ...})
still accepts the provider's spelling, and model_dump(by_alias=True) still
emits it.
0.233.0 — two generated OpenPix enums were renamed¶
One change, and it only breaks code importing the two payment enums by name.
PaymentType and PaymentDestinationAliasType were renamed¶
The generator now emits the variants of PaymentCreatePayload (a oneOf with four shapes: Pix key, QR Code, Manual, Boleto), and those are what register the enums first. The name now comes from the variant:
| Before | Now |
|---|---|
PaymentType |
PaymentCreatePayloadPixKeyType |
PaymentDestinationAliasType |
PaymentCreatePayloadPixKeyDestinationAliasType |
Same members, same values — only the class name changed:
from tempest_fastapi_sdk.integrations.payment.openpix import (
PaymentCreatePayloadPixKeyType,
)
assert PaymentCreatePayloadPixKeyType.PIX_KEY.value == "PIX_KEY"
If you compared the value instead of importing the class (payment.type == "PIX_KEY"), there is nothing to do.
What did not break¶
PaymentCreatePayload and PostApiV1PaymentBody are still importable: they became union aliases over the variants, so an annotation like body: PostApiV1PaymentBody stays valid. What changed is that they now carry the payment's fields — before they were models with no properties at all, and extra="ignore" silently dropped everything you passed.
0.229.0 — Ollama structured output moves from /api/generate to /api/chat¶
One change, and it only breaks tests, not runtime.
generate_structured now talks to /api/chat¶
OllamaGenerator.generate_structured posted to /api/generate with the schema in the format field. That is broken on a reasoning model: against gpt-oss:20b the daemon answers 200 OK with a non-zero eval_count and an empty response, because the reply lands in a channel that endpoint does not surface. On /api/chat the JSON arrives in message.content, and a non-reasoning model behaves identically on either.
There is nothing to adjust at runtime — the call that returned junk (or nothing) now returns the instance. What breaks is a test whose mock is pinned to the old endpoint:
import httpx
from pydantic import BaseModel
from tempest_fastapi_sdk.genai import OllamaGenerator
from tempest_fastapi_sdk.utils import HTTPClient
class Person(BaseModel):
name: str
async def before() -> Person:
"""A mock that matched /api/generate — it stops matching."""
def handler(request: httpx.Request) -> httpx.Response:
return httpx.Response(200, json={"response": '{"name": "Ana"}', "done": True})
client = HTTPClient(transport=httpx.MockTransport(handler))
gen = OllamaGenerator("llama3.2", http_client=client)
return await gen.generate_structured("Any person.", Person)
async def after() -> Person:
"""The reply now comes in message.content."""
def handler(request: httpx.Request) -> httpx.Response:
return httpx.Response(
200,
json={"message": {"content": '{"name": "Ana"}'}, "done": True},
)
client = HTTPClient(transport=httpx.MockTransport(handler))
gen = OllamaGenerator("llama3.2", http_client=client)
return await gen.generate_structured("Any person.", Person)
Two behaviour changes come with it:
- Empty content raises
ValueErrorinstead of returning nothing. If you had atry/excepttreating an empty result as "the model said nothing", switch it toexcept ValueError. system=is a new optional parameter. Use it for the instruction whenpromptis a long document: an instruction glued above the document is ignored — measured, 0 items extracted against 20 with the instruction in its ownsystemturn.