|
|
|
@ -2,6 +2,7 @@ from config.logger import setup_logging
|
|
|
|
|
from http import HTTPStatus
|
|
|
|
|
import dashscope
|
|
|
|
|
from core.providers.llm.base import LLMProviderBase
|
|
|
|
|
from plugins_func.functions.get_weather import GET_WEATHER_FUNCTION_DESC
|
|
|
|
|
|
|
|
|
|
TAG = __name__
|
|
|
|
|
logger = setup_logging()
|
|
|
|
@ -36,6 +37,17 @@ class LLMProvider(LLMProviderBase):
|
|
|
|
|
call_params["prompt"] = prompt
|
|
|
|
|
logger.bind(tag=TAG).debug(f"【阿里百练API服务】处理后的prompt: {prompt}")
|
|
|
|
|
|
|
|
|
|
# response = dashscope.Generation.call(
|
|
|
|
|
# # 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx",
|
|
|
|
|
# api_key='sk-01d13a39e09844038322108ecdbd1bbc',
|
|
|
|
|
# model="qwen-plus",
|
|
|
|
|
# # 此处以qwen-plus为例,可按需更换模型名称。模型列表:https://help.aliyun.com/zh/model-studio/getting-started/models
|
|
|
|
|
# messages=dialogue,
|
|
|
|
|
# result_format='message',
|
|
|
|
|
# tools=[GET_WEATHER_FUNCTION_DESC]
|
|
|
|
|
# )
|
|
|
|
|
# print(response)
|
|
|
|
|
|
|
|
|
|
responses = dashscope.Generation.call(**call_params)
|
|
|
|
|
if responses.status_code != HTTPStatus.OK:
|
|
|
|
|
logger.bind(tag=TAG).error(
|
|
|
|
|