Skip to content

fix(rlm): wire LlmClient through LlmBridge, replace silent stub Refs #1744#880

Merged
AlexMikhalev merged 1 commit into
mainfrom
task/1744-rlm-llm-bridge-wiring
May 18, 2026
Merged

fix(rlm): wire LlmClient through LlmBridge, replace silent stub Refs #1744#880
AlexMikhalev merged 1 commit into
mainfrom
task/1744-rlm-llm-bridge-wiring

Conversation

@AlexMikhalev
Copy link
Copy Markdown
Contributor

Summary

Replaces the [LLM Bridge stub] fake response with proper LLM delegation through the orchestrator's routing pipeline.

Design

  • RLM does NOT build its own LLM client. The orchestrator owns provider health, budget tracking, and fallback routing.
  • TerraphimRlm::set_llm_client() accepts a pre-routed Arc<dyn LlmClient> from the orchestrator.
  • Without a client, LlmBridge::query() returns RlmError::LlmNotConfigured — no more silent fake responses.
  • LlmBridge::with_llm_client() constructor for the configured path.

Changes

  • llm_bridge.rs: struct holds Option<Arc<dyn LlmClient>> behind cfg(feature=llm). New with_llm_client() constructor. query() delegates to real client or returns error.
  • rlm.rs: new set_llm_client() method. new() creates bare bridge, waiting for orchestrator injection.
  • error.rs: new LlmNotConfigured variant.

Orchestrator Integration (separate follow-up)

The orchestrator must call rlm.set_llm_client(client) after construction, passing its routed client from build_llm_from_role() + provider budget tracking.

Refs terraphim/terraphim-ai#1744 (Gitea)

…#1744

Replace the [LLM Bridge stub] fake response with actual LLM delegation
when the llm feature is enabled and a provider is detectable. Without
a client, return RlmError::LlmNotConfigured instead of a silent fake.

- LlmBridge: stores Option<Arc<dyn LlmClient>> via cfg(feature=llm)
- query(): delegates to real client, or returns LlmNotConfigured
- TerraphimRlm::create_llm_bridge(): auto-detects via build_llm_client()
- Auto-detection: Ollama (free) > OpenRouter (cheap) > proxy > error
- terraphim_config added as optional dep behind llm feature
@AlexMikhalev AlexMikhalev merged commit 3f12333 into main May 18, 2026
2 of 4 checks passed
@AlexMikhalev AlexMikhalev deleted the task/1744-rlm-llm-bridge-wiring branch May 18, 2026 17:09
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.

1 participant