binary-husky/gpt_academic · error · ValueError

模型覆盖参数 '{model_override}' 指向一个暂不支持的模型,请检查配置文件。

Error message

模型覆盖参数 '{model_override}' 指向一个暂不支持的模型,请检查配置文件。

What it means

execute_model_override looks up the 'ModelOverride' value of the selected core function (additional_fn) inside model_info; if that model name is not a registered model, it raises ValueError pointing at the config. model_info is the full registry built at import of bridge_all (built-in providers plus AZURE_CFG_ARRAY entries), so this error means the override target is unknown to that registry.

Source

Thrown at request_llms/bridge_all.py:1532

        window_mutex[-1] = False # stop mutex thread
        res = '<br/><br/>\n\n---\n\n'.join(return_string_collect)
        return res

# 根据基础功能区 ModelOverride 参数调整模型类型,用于 `predict` 中
import importlib
import core_functional
from shared_utils.doc_loader_dynamic import start_with_url, load_web_content, contain_uploaded_files, load_uploaded_files

def execute_model_override(llm_kwargs, additional_fn, method):
    functional = core_functional.get_core_functions()
    if (additional_fn in functional) and 'ModelOverride' in functional[additional_fn]:
        # 热更新Prompt & ModelOverride
        importlib.reload(core_functional)
        functional = core_functional.get_core_functions()
        model_override = functional[additional_fn]['ModelOverride']
        if model_override not in model_info:
            raise ValueError(f"模型覆盖参数 '{model_override}' 指向一个暂不支持的模型,请检查配置文件。")
        method = model_info[model_override]["fn_with_ui"]
        llm_kwargs['llm_model'] = model_override
        return llm_kwargs, additional_fn, method
    # 默认返回原参数
    return llm_kwargs, additional_fn, method

def predict(inputs:str, llm_kwargs:dict, plugin_kwargs:dict, chatbot,
            history:list=[], system_prompt:str='', stream:bool=True, additional_fn:str=None):
    """
    发送至LLM,流式获取输出。
    用于基础的对话功能。

    完整参数列表:
        predict(
            inputs:str,                     # 是本次问询的输入
            llm_kwargs:dict,                # 是LLM的内部调优参数
            plugin_kwargs:dict,             # 是插件的内部参数
            chatbot:ChatBotWithCookies,     # 原样传递,负责向用户前端展示对话,兼顾前端状态的功能

View on GitHub (pinned to d6bde0fa54)

Solutions

  1. Print/inspect the valid names: from request_llms.bridge_all import model_info; print(list(model_info)) and pick one of those for ModelOverride.
  2. Fix the ModelOverride string in the core function config (exact name, watch case and hyphens).
  3. If the target is an Azure model, ensure AZURE_CFG_ARRAY defines it (with the azure- prefix, see error 97) on this machine.
  4. Remove the ModelOverride key entirely if the default model should be used.

Example fix

# before (core_functional config)
'翻译': {'ModelOverride': 'GPT4-32k', ...}

# after
from request_llms.bridge_all import model_info
assert 'gpt-4-32k' in model_info  # pick a name from this list
'翻译': {'ModelOverride': 'gpt-4-32k', ...}
Defensive patterns

Strategy: validation

Validate before calling

from request_llms.bridge_all import model_info

def override_ok(fn_cfg: dict) -> bool:
    mo = fn_cfg.get('ModelOverride')
    return mo is None or mo in model_info

for name, cfg in core_functional.get_core_functions().items():
    if not override_ok(cfg):
        raise SystemExit(f'{name}: ModelOverride {cfg["ModelOverride"]!r} is not a known model')

Try / catch

try:
    predict(inputs, llm_kwargs, plugin_kwargs, chatbot, additional_fn=fn)
except ValueError as e:
    if 'ModelOverride' in str(e):
        chatbot.append(['Model override misconfigured', str(e)])
        return  # keep chat alive, skip this generation
    raise

Prevention

When it happens

Trigger: core_functional config defines a function (e.g. a '翻译' button) with ModelOverride: 'gpt-4-something' while model_info only knows names like 'gpt-3.5-turbo', 'azure-...', etc.; triggered on the first predict() call that uses that additional_fn. Also occurs if the override names an AZURE_CFG_ARRAY model on a host where the Azure config block is empty.

Common situations: See trigger scenarios.

Related errors


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