binary-husky/gpt_academic · error · ValueError
Endpoint不正确, 请检查AZURE_ENDPOINT的配置! 当前的Endpoint为:
Error message
Endpoint不正确, 请检查AZURE_ENDPOINT的配置! 当前的Endpoint为:
What it means
The Cohere bridge copies the ChatGPT bridge's verify_endpoint guard: an lru_cache function that raises ValueError if the endpoint string still contains the template placeholder '你亲手写的api名称' from config.py's Azure example. It fires before any request when an azure-* model was selected but the endpoint (or AZURE_CFG_ARRAY entry) was never actually filled in. Purpose: fail fast on unfinished Azure configuration rather than getting a confusing 404 later.
Source
Thrown at request_llms/bridge_cohere.py:68
try:
chunkjson = json.loads(chunk_decoded)
has_choices = 'choices' in chunkjson
if has_choices: choice_valid = (len(chunkjson['choices']) > 0)
if has_choices and choice_valid: has_content = ("content" in chunkjson['choices'][0]["delta"])
if has_content: has_content = (chunkjson['choices'][0]["delta"]["content"] is not None)
if has_choices and choice_valid: has_role = "role" in chunkjson['choices'][0]["delta"]
except:
pass
return chunk_decoded, chunkjson, has_choices, choice_valid, has_content, has_role
from functools import lru_cache
@lru_cache(maxsize=32)
def verify_endpoint(endpoint):
"""
检查endpoint是否可用
"""
if "你亲手写的api名称" in endpoint:
raise ValueError("Endpoint不正确, 请检查AZURE_ENDPOINT的配置! 当前的Endpoint为:" + endpoint)
return endpoint
def predict_no_ui_long_connection(inputs:str, llm_kwargs:dict, history:list=[], sys_prompt:str="", observe_window:list=None, console_silence:bool=False):
"""
发送,等待回复,一次性完成,不显示中间过程。但内部用stream的方法避免中途网线被掐。
inputs:
是本次问询的输入
sys_prompt:
系统静默prompt
llm_kwargs:
内部调优参数
history:
是之前的对话列表
observe_window = None:
用于负责跨越线程传递已经输出的部分,大部分时候仅仅为了fancy的视觉效果,留空即可。observe_window[0]:观测窗。observe_window[1]:看门狗
"""
watch_dog_patience = 5 # 看门狗的耐心, 设置5秒即可
headers, payload = generate_payload(inputs, llm_kwargs, history, system_prompt=sys_prompt, stream=True)View on GitHub (pinned to d6bde0fa54)
Solutions
- Fill AZURE_ENDPOINT and the model's AZURE_CFG_ARRAY entry in config_private.py with the real deployment URL.
- Confirm the deployment name and api-version query parameter match your Azure portal deployment.
- Grep your config for the literal placeholder '你亲手写的api名称' to catch every unfilled field.
- Restart gpt_academic so verify_endpoint's lru_cache doesn't serve stale state.
Example fix
# config_private.py — before AZURE_ENDPOINT = "https://你亲手写的api名称.openai.azure.com/..." # after AZURE_ENDPOINT = "https://cohere-resource.openai.azure.com/openai/deployments/cohere/chat/completions?api-version=2023-05-15"
Defensive patterns
Strategy: validation
Validate before calling
endpoint = AZURE_CFG_ARRAY[model]["AZURE_ENDPOINT"] assert "你亲手写的api名称" not in endpoint, "Azure endpoint still contains the template placeholder"
Try / catch
try:
verify_endpoint(endpoint)
except ValueError as e:
fail_fast_with_config_hint(str(e)) Prevention
- Lint all AZURE_CFG_ARRAY entries for placeholder text at startup.
- Copy working Azure endpoint examples rather than editing the template in place.
- Restart after config changes to clear verify_endpoint's lru_cache.
- Keep deployment names consistent between the portal and the URL.
When it happens
Trigger: Selecting an azure- model routed to the Cohere bridge while AZURE_ENDPOINT still contains '你亲手写的api名称'; copying config.py to config_private.py and filling the key but not the endpoint URL; AZURE_CFG_ARRAY retaining placeholder values after a config merge.
Common situations: Incomplete Azure setup for Cohere models via Azure gateways; config template placeholders surviving upgrades; users assuming the key alone is enough for azure- model names.
Related errors
- Endpoint不正确, 请检查AZURE_ENDPOINT的配置! 当前的Endpoint为:
- Endpoint不正确, 请检查AZURE_ENDPOINT的配置! 当前的Endpoint为:{endpoint}
- AZURE_CFG_ARRAY中配置的模型必须以azure开头
- 在线搜索失败,状态码: {response.status_code}\t{response.content.decode
- 用户代理或助理代理未定义
AI-assisted analysis of binary-husky/gpt_academic@d6bde0fa54 (2026-08-14).
Data as JSON: /api/errors/9d3a43701173be78.
Report an issue: GitHub.