You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(datetime): drop format keyword from schema, fix fractional-second warning
Two findings from codex review of the :datetime feature.
[P2] Remove `format: "date-time"` from the JSON Schema for `:datetime`.
OpenAI's strict-mode structured output (the very provider I optimized
for) rejects unsupported keywords including `format`, which would 400
any request that paired `:datetime` with `response_format: {type:
"json_schema", strict: true}` BEFORE local coercion got a chance to
run. Schema is now a plain `{"type": "string"}`. Local coercion still
validates ISO 8601 + offset, and the prompt-side example value
("2026-05-03T09:14:00Z") covers the LLM-guidance role that `format`
would have played.
[P3] Fix the non-UTC warning for fractional-second timestamps. The old
shape check used a binary pattern matching exactly 19 chars before the
offset (`<<_::binary-19, "Z", _::binary>>`). Inputs like
"2026-05-03T09:14:00.123Z" have 23 chars before the Z and were falsely
flagged as non-UTC even though they're valid UTC. Switched to checking
the parsed offset (0 = UTC) returned by `DateTime.from_iso8601/1`,
which is the source of truth and indifferent to fractional seconds.
Tests:
- Updated the schema-shape assertions in signature_test.exs and
text_mode_json_test.exs to expect plain string schema (no format).
- Two new regression tests in coercion_test.exs covering
"...Z" and "...+00:00" with fractional seconds, asserting no
spurious non-UTC warning.
Docs: signature-syntax.md updated to explain why format is omitted
(strict-mode compatibility) instead of overclaiming the server-side
enforcement benefit.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments