Skip to content

V0.12.7

Choose a tag to compare

@JohnRichard4096 JohnRichard4096 released this 26 Jul 02:46
· 18 commits to main since this release
dcc1b82

Release v0.12.7

New Feature – Literal Type Support in Tools

The @simple_tool decorator now understands Python’s Literal type hints.
Literal["a", "b"], Literal[1, 2, 3] (and homogeneous float / bool literals) are automatically converted to JSON Schema with an enum constraint, making it easy to define allowed values for LLM function calling.

Mixed‑type literals (e.g., Literal["a", 1]) raise a clear TypeError at registration time.

Documentation

  • English and Chinese guides have been updated to cover the new Literal support and constraints.

Internal Improvements

  • Added Ruff PERF rule and ignored RUF036 (preview) to maintain code quality.
  • Several type annotations were refined (e.g., get_current_datetime_timestamp, get_tool_meta, get_tool_func, MCPProperty).
  • Imports were re‑sorted (isort) and a few formatting inconsistencies fixed.

PRs

  • feat(tools): add Literal type support to @simple_tool and update docs by @JohnRichard4096 in #131
  • Build(deps): Bump dompurify from 3.4.11 to 3.4.12 in /docs by @dependabot[bot] in #129
  • Build(deps): Bump linkify-it from 5.0.1 to 5.0.2 in /docs by @dependabot[bot] in #130

Full Changelog: 0.12.6...0.12.7