refactor(llm,config): extract HTTP error mapper and move embedding helpers#4858
Merged
Conversation
…lpers Extract `map_error_response` to `zeph_llm::http`, replacing 12 duplicate inline error-mapping blocks across claude, openai, gonka, and cocoon backends. Return type is `LlmError` directly, eliminating the prior `Result`-wrapping and `unwrap_err()` call pattern at every call site. Move `effective_embedding_model` and `stable_skill_embedding_model` from `zeph_core::provider_factory` to `LlmConfig` in `zeph_config`, consistent with `stt_provider_entry`. Add `impl Default for LlmConfig` using serde deserialization of an empty TOML string so all existing `#[serde(default)]` fields produce a well-typed default. Update all call sites in src/bootstrap/ and src/runner.rs. Closes #4850 Closes #4840
f40473d to
271405b
Compare
…move to LlmConfig
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.
Summary
map_error_response(status, body, provider) -> LlmErrortozeph-llm::http, replacing 12 duplicate inline error-mapping blocks acrossclaude,openai,gonka, andcocoonbackends. Eliminatesunwrap_err()pattern — return type isLlmErrordirectly.effective_embedding_modelandstable_skill_embedding_modelfromzeph-core::provider_factorytoLlmConfigimpl inzeph-config, consistent with existingstt_provider_entry. Addimpl Default for LlmConfigviatoml::from_str("")leveraging#[serde(default)]. Update all call sites insrc/bootstrap/andsrc/runner.rs.Test plan
cargo +nightly fmt --check— cleancargo clippy --workspace -- -D warnings— 0 warningscargo nextest run --workspace --lib --bins— 10504 passed, 0 failedcargo test --doc -p zeph-llm -p zeph-config -p zeph-core— all passedCHANGELOG.mdresolved (kept both new entries)Closes #4850
Closes #4840