Skip to content

Type llm messages with ChatCompletionMessageParam instead of suppressing#161

Merged
alexkroman merged 2 commits into
mainfrom
claude/wizardly-ramanujan-pnl9k8
Jun 13, 2026
Merged

Type llm messages with ChatCompletionMessageParam instead of suppressing#161
alexkroman merged 2 commits into
mainfrom
claude/wizardly-ramanujan-pnl9k8

Conversation

@alexkroman

Copy link
Copy Markdown
Collaborator

The gateway complete() call carried a bare # type: ignore[arg-type]
because build_messages returned list[dict[str, str]], which isn't
assignable to the OpenAI SDK's Iterable[ChatCompletionMessageParam].
Type the messages list and both function boundaries with the SDK's own
param type so the create() call type-checks without the suppression.
Tighten one build_messages test to compare the whole dict (matching its
siblings), avoiding a not-required-key subscript on the now-typed union.

claude added 2 commits June 13, 2026 22:39
The gateway `complete()` call carried a bare `# type: ignore[arg-type]`
because `build_messages` returned `list[dict[str, str]]`, which isn't
assignable to the OpenAI SDK's `Iterable[ChatCompletionMessageParam]`.
Type the messages list and both function boundaries with the SDK's own
param type so the `create()` call type-checks without the suppression.
Tighten one build_messages test to compare the whole dict (matching its
siblings), avoiding a not-required-key subscript on the now-typed union.
The token-usage block is only ever emitted as JSON, so its return type
need not be dict[str, Any] — dict[str, object] matches the JSON-payload
convention used throughout the codebase and drops the module's last Any
(and the now-unused typing import).
@alexkroman alexkroman enabled auto-merge June 13, 2026 23:04
@alexkroman alexkroman added this pull request to the merge queue Jun 13, 2026
Merged via the queue into main with commit 4bc28ea Jun 13, 2026
16 checks passed
@alexkroman alexkroman deleted the claude/wizardly-ramanujan-pnl9k8 branch June 13, 2026 23:10
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.

2 participants