feat(qianfan): scope vision support to multimodal models

This commit is contained in:
zhayujie
2026-05-06 16:11:10 +08:00
parent 63f99af1e6
commit a5790d82f6
15 changed files with 212 additions and 50 deletions

View File

@@ -17,9 +17,21 @@ DEFAULT_API_BASE = "https://qianfan.baidubce.com/v2"
DEFAULT_MODEL = const.ERNIE_5
DEFAULT_VISION_MODEL = const.ERNIE_45_TURBO_VL
# Qianfan models that natively understand images. Other ERNIE variants
# are text-only and must not receive image payloads.
_VISION_CAPABLE_MODELS = {
const.ERNIE_5,
const.ERNIE_X1_1,
const.ERNIE_45_TURBO_VL,
const.ERNIE_45_TURBO_VL_32K,
}
class QianfanBot(Bot, OpenAICompatibleBot):
supports_vision = True
@property
def supports_vision(self) -> bool:
"""Whether the configured main model is multimodal."""
return (conf().get("model") or "").lower() in _VISION_CAPABLE_MODELS
def __init__(self):
super().__init__()