binary-husky/gpt_academic · error · RuntimeError

请配置YUNQUE_SECRET_KEY

Error message

请配置YUNQUE_SECRET_KEY

What it means

RuntimeError from bridge_skylark2.predict_no_ui_long_connection: validate_key() returned False, meaning the YUNQUE_SECRET_KEY configuration (Volcano Engine / Doubao Skylark2 credentials) is missing or empty. The check runs before YUNQUERequestInstance is created, so no network call is made - this is a fail-fast configuration guard.

Source

Thrown at request_llms/bridge_skylark2.py:22

model_name = '云雀大模型'

def validate_key():
    YUNQUE_SECRET_KEY = get_conf("YUNQUE_SECRET_KEY")
    if YUNQUE_SECRET_KEY == '': return False
    return True

def predict_no_ui_long_connection(inputs:str, llm_kwargs:dict, history:list=[], sys_prompt:str="",
                                  observe_window:list=[], console_silence:bool=False):
    """
        ⭐ 多线程方法
        函数的说明请见 request_llms/bridge_all.py
    """
    watch_dog_patience = 5
    response = ""

    if validate_key() is False:
        raise RuntimeError('请配置YUNQUE_SECRET_KEY')

    from .com_skylark2api import YUNQUERequestInstance
    sri = YUNQUERequestInstance()
    for response in sri.generate(inputs, llm_kwargs, history, sys_prompt):
        if len(observe_window) >= 1:
            observe_window[0] = response
        if len(observe_window) >= 2:
            if (time.time()-observe_window[1]) > watch_dog_patience: raise RuntimeError("程序终止。")
    return response

def predict(inputs, llm_kwargs, plugin_kwargs, chatbot, history=[], system_prompt='', stream = True, additional_fn=None):
    """
        ⭐ 单线程方法
        函数的说明请见 request_llms/bridge_all.py
    """
    chatbot.append((inputs, ""))
    yield from update_ui(chatbot=chatbot, history=history)

View on GitHub (pinned to d6bde0fa54)

Solutions

  1. Set YUNQUE_SECRET_KEY in config_private.py with your Volcano Engine Skylark2 secret key and restart
  2. Verify the variable name matches exactly what get_conf reads
  3. If Skylark was not intended, switch the model selection to a configured provider

Example fix

# config_private.py
# before
YUNQUE_SECRET_KEY = ""

# after
YUNQUE_SECRET_KEY = "your-skylark2-secret"
Defensive patterns

Strategy: validation

Validate before calling

from shared_utils.config_loader import get_conf
secret = get_conf('YUNQUE_SECRET_KEY')
assert secret and len(secret) > 0, 'skylark2 model selected but YUNQUE_SECRET_KEY is unset'

Type guard

def skylark2_configured() -> bool:
    return len(get_conf('YUNQUE_SECRET_KEY')) > 0

Try / catch

try:
    result = predict_no_ui_long_connection(...)
except RuntimeError as e:
    if 'YUNQUE_SECRET_KEY' in str(e):
        raise SystemExit('Set YUNQUE_SECRET_KEY in config_private.py to use skylark2 models') from e

Prevention

When it happens

Trigger: Selecting a skylark2 model without setting YUNQUE_SECRET_KEY in config_private.py; key set under a different name or in the wrong file; deployment env missing the variable.

Common situations: Trying Doubao/Skylark models after seeing them in the model list but never configuring Volcano Engine credentials; config typo (YUNQUE_SECRET_KEY vs Skylark API key naming).

Related errors


AI-assisted analysis of binary-husky/gpt_academic@d6bde0fa54 (2026-08-14). Data as JSON: /api/errors/6fe9bccc978f962e. Report an issue: GitHub.