Provider-agnostic LLM registry, config check, migration runbook

[llm] assigns the bulk and editor roles by name over a [providers.*]
registry (kind = openai | anthropic, per-provider model, effort, daily
ceiling and price table); DeepseekBackend becomes OpenAiCompatibleBackend
(reasoning_effort passthrough), AnthropicBackend builds from the same
ProviderConfig, meters and provider_costs are keyed by provider name.
Gemini 3.8 Flash is declared via Google's OpenAI-compatible endpoint so
switching the editor is one line (or DAILY_EPUB_LLM__EDITOR=gemini for an
A/B dry run). Stale [deepseek]/[anthropic] tables, the top-level
max_daily_usd and the old key env vars fail loudly.

daily-epub config check validates and prints the resolved roles, models,
key presence and paths without opening the database.

docs/runbooks/curation-v2-migration.md walks the server upgrade from v1.

Registry implemented by a Claude agent from an orchestrator brief;
verified fmt/clippy(-W dead_code)/test green.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A1rCLQeKBgnBo3oTgHuTMe
This commit is contained in:
thalladaandClaude Fable 5.1 committed 2026-09-02 18:44:57 +00:00
1 parent 5edbeb509f
commit 99d1338890
19 files changed
+2136 -620

No files matched your search

+4 -6
View File
@@ -637,7 +637,7 @@ pub fn select_without_llm(
#[cfg(test)]
mod tests {
use super::*;
use crate::config::{AnthropicConfig, CurationConfig, DeepseekConfig};
use crate::config::{CurationConfig, ProviderConfig};
use crate::curate::llm::{ChatBackend, LlmClient, MockBackend, PriceTable, UsageMeter};
use crate::curate::prefilter::tests::article;
use crate::curate::signals::{Neighbour, TopInterest};
@@ -696,9 +696,9 @@ mod tests {
fn mock(provider: &'static str, backend: Arc<MockBackend>, limit: f64) -> LlmClient {
let prices = if provider == "anthropic" {
PriceTable::anthropic(&AnthropicConfig::default())
PriceTable::from(&ProviderConfig::anthropic())
} else {
PriceTable::deepseek(&DeepseekConfig::default())
PriceTable::from(&ProviderConfig::deepseek())
};
LlmClient::with_backend_options(
provider,
@@ -1079,9 +1079,7 @@ mod tests {
#[tokio::test]
async fn refusal_on_the_editor_falls_back_to_bulk_with_the_same_prompt() {
let editor = Arc::new(MockBackend::new());
editor.push_llm_error(LlmError::Refusal {
provider: "anthropic",
});
editor.push_llm_error(LlmError::refusal("anthropic"));
let bulk = Arc::new(MockBackend::new());
bulk.push(picks_json(5), TokenUsage::default());
let llms = editor_and_bulk(Arc::clone(&editor), Arc::clone(&bulk));