From 6edf7001d649ad2a0fb86cc87598c62c8079211a Mon Sep 17 00:00:00 2001 From: shenchucheng Date: Mon, 15 Jul 2024 19:52:17 +0800 Subject: [PATCH] Support configuration of QianFan API base_url to fix #1392 --- metagpt/provider/qianfan_api.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/metagpt/provider/qianfan_api.py b/metagpt/provider/qianfan_api.py index 3d78c8bfc..04334f305 100644 --- a/metagpt/provider/qianfan_api.py +++ b/metagpt/provider/qianfan_api.py @@ -50,6 +50,9 @@ class QianFanLLM(BaseLLM): else: raise ValueError("Set the `access_key`&`secret_key` or `api_key`&`secret_key` first") + if self.config.base_url: + os.environ.setdefault("QIANFAN_BASE_URL", self.config.base_url) + support_system_pairs = [ ("ERNIE-Bot-4", "completions_pro"), # (model, corresponding-endpoint) ("ERNIE-Bot-8k", "ernie_bot_8k"),