|
@@ -121,15 +121,29 @@ class ErnieMessage:
|
|
|
|
|
|
class ErnieBotModel:
|
|
|
api_bases = {
|
|
|
- 'ernie-bot': 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions',
|
|
|
+ 'ernie-bot': 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie-3.5-4k-0205',
|
|
|
'ernie-bot-4': 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions_pro',
|
|
|
- 'ernie-bot-8k': 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie_bot_8k',
|
|
|
+ 'ernie-bot-8k': 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions',
|
|
|
'ernie-bot-turbo': 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/eb-instant',
|
|
|
+ 'ernie-3.5-8k': 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions',
|
|
|
+ 'ernie-3.5-8k-0205': 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie-3.5-8k-0205',
|
|
|
+ 'ernie-3.5-8k-1222': 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie-3.5-8k-1222',
|
|
|
+ 'ernie-3.5-4k-0205': 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie-3.5-4k-0205',
|
|
|
+ 'ernie-4.0-8k': 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions_pro',
|
|
|
+ 'ernie-speed-8k': 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie_speed',
|
|
|
+ 'ernie-speed-128k': 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie-speed-128k',
|
|
|
+ 'ernie-speed-appbuilder': 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ai_apaas',
|
|
|
+ 'ernie-lite-8k-0922': 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/eb-instant',
|
|
|
+ 'ernie-lite-8k-0308': 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie-lite-8k',
|
|
|
}
|
|
|
|
|
|
function_calling_supports = [
|
|
|
'ernie-bot',
|
|
|
'ernie-bot-8k',
|
|
|
+ 'ernie-3.5-8k',
|
|
|
+ 'ernie-3.5-8k-0205',
|
|
|
+ 'ernie-3.5-8k-1222',
|
|
|
+ 'ernie-3.5-4k-0205'
|
|
|
]
|
|
|
|
|
|
api_key: str = ''
|
|
@@ -285,6 +299,12 @@ class ErnieBotModel:
|
|
|
**parameters
|
|
|
}
|
|
|
|
|
|
+ if 'max_tokens' in parameters and type(parameters['max_tokens']) == int:
|
|
|
+ body['max_output_tokens'] = parameters['max_tokens']
|
|
|
+
|
|
|
+ if 'presence_penalty' in parameters and type(parameters['presence_penalty']) == float:
|
|
|
+ body['penalty_score'] = parameters['presence_penalty']
|
|
|
+
|
|
|
if system_message:
|
|
|
body['system'] = system_message
|
|
|
|