Multi-LLM: consult Claude / GPT / Z.ai GLM (Assistant + hrp consult) - #60
Merged
Conversation
Adds a shared hrp/llm provider registry so the Vault Assistant, a new /api/consult endpoint, and `hrp consult` can use any configured model — not just Anthropic. Also the deeper fix for ad-hoc Anthropic clients scattered across the codebase: one complete() entry point. - hrp/llm: registry of model specs (claude=anthropic, gpt=openai, glm=Z.ai via the OpenAI SDK with a custom base_url). Model ids / endpoints / keys / default are all HRP_LLM_* env-overridable. complete()/list_models()/is_available(). - Assistant: POST /api/assistant/query takes an optional `model`; new GET /api/assistant/models lists providers + availability; answer reports which model replied. 400 unknown model, 503 provider not configured. - Consult (ungrounded): POST /api/consult + GET /api/consult/models, and a `hrp consult "..." [--model gpt] [--list-models]` CLI. - deps: openai>=1.30; .env.example documents OPENAI_API_KEY / ZAI_API_KEY + HRP_LLM_* overrides. - Tests: hrp/llm registry unit tests + assistant model-selection + consult tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011BFeBAuxWTFRayNGMD7VDn
The Assistant now lets you choose which LLM answers. Fetches GET /api/assistant/models on mount, renders a compact MODEL select in the input row (unavailable providers disabled + "(no key)"), defaults to the first available model, sends the chosen model with each query, and shows "via <label>" under each answer. Existing 503/429/loading states preserved. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011BFeBAuxWTFRayNGMD7VDn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the ability to consult multiple LLM providers, not only Anthropic.
Shared provider layer (
hrp/llm)complete()entry point — used by the Vault Assistant, the new/api/consultendpoint, andhrp consult. Also the deeper fix for ad-hoc Anthropic clients scattered across the codebase.base_url).HRP_LLM_*env-overridable.Surfaces
POST /api/assistant/querytakes an optionalmodel; newGET /api/assistant/modelslists providers + availability; the answer reports which model replied. Web app gains a MODEL selector (unavailable providers disabled).POST /api/consult+GET /api/consult/models, and ahrp consult "..." [--model gpt] [--list-models]CLI.Config
openai>=1.30..env.exampledocumentsOPENAI_API_KEY/ZAI_API_KEY+HRP_LLM_*overrides. Keep the keys you want; others stay disabled.Verification
hrp/llmregistry unit tests + assistant model-selection + consult tests; 45 API/LLM tests pass; ruff/black clean./api/assistant/modelslists all 3 (Claude available, GPT/GLM need keys); selector renders and defaults to the available provider; consult 503s without a key.🤖 Generated with Claude Code
https://claude.ai/code/session_011BFeBAuxWTFRayNGMD7VDn
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.