Conversation
Validate all required API keys and config values before making any API calls. Prevents wasted LLM credits when a later step would fail due to missing credentials (e.g. empty niutrans_api_key causes Step 4 auth failure after Steps 1-3 already consumed tokens). Checks: - niutrans_api_key is non-empty - intermediate_lang is a recognized language code Errors are collected and reported together so the operator can fix everything at once.
molly554
added a commit
that referenced
this pull request
Sep 16, 2026
Clean reimplementation of the ideas behind #65 and #64: - _validate_pipeline_config() runs before any API call and reports a missing niutrans_api_key or an unrecognized intermediate_lang together, so a later-step failure no longer wastes LLM credits (resolves #62) - --json emits the full result dict (step traces + timing) as JSON with ensure_ascii=False; plain and --verbose output unchanged (resolves #60) - tests/test_pipeline_features.py — 6 cases (validation + CLI) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Thanks @Grok-King — the pre-flight validation idea is solid and has landed on main in c3c0fd2 (resolves #62). I reimplemented rather than merging because the submitted |
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.
Problem
The pipeline currently validates the LLM API key (via
resolve_llm_config) but not the Niutrans key. Ifniutrans_api_keyis empty inconfig.toml, the pipeline runs Steps 1-3 successfully (consuming LLM tokens and Google Translate quota), then fails at Step 4 with:This wastes real money on LLM calls that produced output nobody will see.
Solution
Add
_validate_pipeline_config()called at the start ofrun_standard_pipeline(), before any API calls. It checks:niutrans_api_keyis non-empty — this is the most common miss since it is separate from the LLM provider keyintermediate_langis a recognized language code — catches typos likeintermediate_lang = "finnish"that would silently fail at the Google Translate stepAll errors are collected and reported together so the operator can fix everything in one pass.
Before
After
Fails immediately, before any API calls.