From c4f78a16fe81ab9360bb57fb3c868beea322f2c8 Mon Sep 17 00:00:00 2001 From: Smillence Date: Sat, 9 Nov 2024 11:10:40 +0800 Subject: [PATCH] fix temperature bug --- .env.template | 3 --- dbgpt/_private/config.py | 17 ++++++----------- dbgpt/app/scene/base_chat.py | 2 +- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/.env.template b/.env.template index a4f03eea6..792a0c49b 100644 --- a/.env.template +++ b/.env.template @@ -243,9 +243,6 @@ TONGYI_PROXY_API_KEY={your-tongyi-sk} # Xunfei Spark #XUNFEI_SPARK_API_PASSWORD={your_api_password} #XUNFEI_SPARK_API_MODEL={version} -#XUNFEI_SPARK_APPID={your_app_id} -#XUNFEI_SPARK_API_KEY={your_api_key} -#XUNFEI_SPARK_API_SECRET={your_api_secret} ## Yi Proxyllm, https://platform.lingyiwanwu.com/docs #YI_MODEL_VERSION=yi-34b-chat-0205 diff --git a/dbgpt/_private/config.py b/dbgpt/_private/config.py index 99eb0e2eb..ee5b97eae 100644 --- a/dbgpt/_private/config.py +++ b/dbgpt/_private/config.py @@ -78,17 +78,12 @@ def __init__(self) -> None: ) # xunfei spark - self.spark_api_version = os.getenv("XUNFEI_SPARK_API_VERSION") - self.spark_proxy_api_key = os.getenv("XUNFEI_SPARK_API_KEY") - self.spark_proxy_api_secret = os.getenv("XUNFEI_SPARK_API_SECRET") - self.spark_proxy_api_appid = os.getenv("XUNFEI_SPARK_APPID") - if self.spark_proxy_api_key and self.spark_proxy_api_secret: - os.environ["spark_proxyllm_proxy_api_key"] = self.spark_proxy_api_key - os.environ["spark_proxyllm_proxy_api_secret"] = self.spark_proxy_api_secret - os.environ["spark_proxyllm_proxyllm_backend"] = self.spark_api_version or "" - os.environ["spark_proxyllm_proxy_api_app_id"] = ( - self.spark_proxy_api_appid or "" - ) + self.spark_proxy_api_password = os.getenv("XUNFEI_SPARK_API_PASSWORD") + self.spark_proxy_api_model = os.getenv("XUNFEI_SPARK_API_MODEL") + if self.spark_proxy_api_model and self.spark_proxy_api_password: + os.environ["spark_proxyllm_proxy_api_password"] = self.spark_proxy_api_password + os.environ["spark_proxyllm_proxy_api_model"] = self.spark_proxy_api_model + # baichuan proxy self.bc_proxy_api_key = os.getenv("BAICHUAN_PROXY_API_KEY") diff --git a/dbgpt/app/scene/base_chat.py b/dbgpt/app/scene/base_chat.py index 9e9a7896e..5f60c3cd5 100644 --- a/dbgpt/app/scene/base_chat.py +++ b/dbgpt/app/scene/base_chat.py @@ -232,7 +232,7 @@ async def _build_model_request(self) -> ModelRequest: ) node = AppChatComposerOperator( model=self.llm_model, - temperature=float(self.prompt_template.temperature), + temperature=self._chat_param.get("temperature") or float(self.prompt_template.temperature), max_new_tokens=int(self.prompt_template.max_new_tokens), prompt=self.prompt_template.prompt, message_version=self._message_version,