feat(sdk): PromptBuilder + model alias constants #70

Merged
timur merged 1 commit from development_sdk_63_prompt_models into development 2026-05-12 15:59:54 +00:00
Owner

Summary

Closes the second slice of #63 — the SDK now has every client-side ergonomic that herolib_ai exposes, so consumer migrations are near-mechanical.

  • models::* constants for every alias in modelsconfig.ymlGPT_5, CLAUDE_OPUS, LLAMA_3_3_70B, GROK_4, embeddings, STT, TTS. Migration table in the module doc maps each herolib_ai::Model::* variant to its new constant.
  • prompt::PromptBuilder — fluent builder with .system / .user / .with_history / .temperature / .max_tokens / .json_mode / .response_format and the verify-retry loop ported verbatim from herolib_ai (.verify / .max_retries / .execute_verified).
  • prompt::chat_simple one-shot helper.
  • client.prompt(model) extension method on the generated typed client.
  • PromptError typed error covering RPC, empty response, and verification-exhausted.

Test plan

  • cargo build -p hero_aibroker_sdk — clean
  • cargo test -p hero_aibroker_sdk --doc — 3 compile-ok, 2 ignored (no_run runtime examples)
  • cargo clippy -p hero_aibroker_sdk --no-deps -- -D warnings — clean
  • First consumer migration — hero_books librarian (next, separate PR in that repo)

🤖 Generated with Claude Code

## Summary Closes the second slice of #63 — the SDK now has every client-side ergonomic that herolib_ai exposes, so consumer migrations are near-mechanical. - `models::*` constants for every alias in `modelsconfig.yml` — `GPT_5`, `CLAUDE_OPUS`, `LLAMA_3_3_70B`, `GROK_4`, embeddings, STT, TTS. Migration table in the module doc maps each `herolib_ai::Model::*` variant to its new constant. - `prompt::PromptBuilder` — fluent builder with `.system` / `.user` / `.with_history` / `.temperature` / `.max_tokens` / `.json_mode` / `.response_format` and the verify-retry loop ported verbatim from `herolib_ai` (`.verify` / `.max_retries` / `.execute_verified`). - `prompt::chat_simple` one-shot helper. - `client.prompt(model)` extension method on the generated typed client. - `PromptError` typed error covering RPC, empty response, and verification-exhausted. ## Test plan - [x] `cargo build -p hero_aibroker_sdk` — clean - [x] `cargo test -p hero_aibroker_sdk --doc` — 3 compile-ok, 2 ignored (no_run runtime examples) - [x] `cargo clippy -p hero_aibroker_sdk --no-deps -- -D warnings` — clean - [ ] First consumer migration — `hero_books` librarian (next, separate PR in that repo) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(sdk): port PromptBuilder + model alias constants (#63)
Some checks failed
Build and Test / build-and-test (pull_request) Failing after 3s
1423d52f86
Closes the second slice of the herolib_ai → hero_aibroker_sdk
consolidation. Brings the missing client-side ergonomics across so
consumer migrations become near-mechanical:

- `models::*` — typed constants for every alias in modelsconfig.yml
  (GPT_5, CLAUDE_OPUS, LLAMA_3_3_70B, GROK_4, …). Migration table in
  the module doc maps each herolib_ai::Model::* to the new constant.
- `prompt::PromptBuilder` — fluent builder with .system / .user /
  .with_history / .temperature / .max_tokens / .json_mode /
  .response_format and the verify-retry loop ported verbatim from
  herolib_ai (.verify / .max_retries / .execute_verified).
- `prompt::chat_simple` — one-shot helper.
- `client.prompt(model)` — extension method on AIBrokerAdminAPIClient.
- `PromptError` — typed error covering RPC, empty response, and
  verification-exhausted cases.

Build clean. Clippy clean. 3 doctests pass + 2 no_run ignored.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
timur merged commit 1bf41a9530 into development 2026-05-12 15:59:54 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_aibroker!70
No description provided.