v2.0.1 — messages= now type-checks with plain dicts
Unofficial, community-maintained SDK for Venice.ai. Requires Python 3.13+.
Patch release on top of v2.0.0.
pip install --upgrade 'venice-ai>=2'Fixed
messages= now type-checks with plain dicts. The annotation was narrower than what
the code actually accepted: OpenAI-wire-shape mappings like {"role": "user", "content": "hi"}
have always been validated and coerced, but type checkers rejected them
(error: List item 0 has incompatible type "dict[str, str]"). The annotation is now the
public ChatMessageParam union, so both forms check cleanly on create(), stream(),
parse(), estimate_cost(), and run_with_tools().
The typed message models remain the documented idiom — they give you completion and
validation at construction — and malformed mappings still raise ValidationError before
the request is sent.
estimate_cost() and run_with_tools() accept mapping messages. Both read the
message list before it reaches the request model, so dict input previously raised
AttributeError on .content (estimate_cost) or left raw dicts in the returned
ToolLoopResult.messages history (run_with_tools). Messages are now normalized at the
method boundary.
Reported in #1 — thanks for the report.
Added
ChatMessageParam, exported from venice_ai.types — the union describing what
messages= accepts: any of the five message models, or a plain Mapping[str, Any]. Use
it to annotate your own message-building helpers.