Tongyi adapts deepseek. (#5285)
### What problem does this PR solve? ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
4d22daefa7
commit
ec96426c00
@ -258,8 +258,13 @@ class QWenChat(Base):
|
|||||||
import dashscope
|
import dashscope
|
||||||
dashscope.api_key = key
|
dashscope.api_key = key
|
||||||
self.model_name = model_name
|
self.model_name = model_name
|
||||||
|
if model_name.lower().find("deepseek") >= 0:
|
||||||
|
super().__init__(key, model_name)
|
||||||
|
|
||||||
def chat(self, system, history, gen_conf):
|
def chat(self, system, history, gen_conf):
|
||||||
|
if self.model_name.lower().find("deepseek") >= 0:
|
||||||
|
return super.chat(system, history, gen_conf)
|
||||||
|
|
||||||
stream_flag = str(os.environ.get('QWEN_CHAT_BY_STREAM', 'true')).lower() == 'true'
|
stream_flag = str(os.environ.get('QWEN_CHAT_BY_STREAM', 'true')).lower() == 'true'
|
||||||
if not stream_flag:
|
if not stream_flag:
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
@ -327,6 +332,9 @@ class QWenChat(Base):
|
|||||||
yield tk_count
|
yield tk_count
|
||||||
|
|
||||||
def chat_streamly(self, system, history, gen_conf):
|
def chat_streamly(self, system, history, gen_conf):
|
||||||
|
if self.model_name.lower().find("deepseek") >= 0:
|
||||||
|
return super.chat_streamly(system, history, gen_conf)
|
||||||
|
|
||||||
return self._chat_streamly(system, history, gen_conf)
|
return self._chat_streamly(system, history, gen_conf)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user