diff --git a/go/qianfan/chat_completion.go b/go/qianfan/chat_completion.go index 3dcda470..0483b510 100644 --- a/go/qianfan/chat_completion.go +++ b/go/qianfan/chat_completion.go @@ -83,6 +83,9 @@ type ChatCompletionRequest struct { // 内置 chat 模型的 endpoint var ChatModelEndpoint = map[string]string{ + "ERNIE-4.0-8K-Latest": "/chat/ernie-4.0-8k-latest", + "ERNIE-4.0-8K-0613": "/chat/ernie-4.0-8k-0613", + "ERNIE-3.5-8K-0613": "/chat/ernie-3.5-8k-0613", "ERNIE-Bot-turbo": "/chat/eb-instant", "ERNIE-Lite-8K-0922": "/chat/eb-instant", "ERNIE-Lite-8K": "/chat/ernie-lite-8k", @@ -139,6 +142,9 @@ type inputLimitInfo struct { // 定义包含所需信息的 map var limitMapInModelName = map[string]inputLimitInfo{ + "ERNIE-4.0-8K-Latest": {MaxInputChars: 20000, MaxInputTokens: 5120}, + "ERNIE-4.0-8K-0613": {MaxInputChars: 20000, MaxInputTokens: 5120}, + "ERNIE-3.5-8K-0613": {MaxInputChars: 20000, MaxInputTokens: 5120}, "ERNIE-Lite-8K-0922": {MaxInputChars: 11200, MaxInputTokens: 7168}, "ERNIE-Lite-8K": {MaxInputChars: 11200, MaxInputTokens: 7168}, "ERNIE-Lite-8K-0308": {MaxInputChars: 11200, MaxInputTokens: 7168}, @@ -184,6 +190,9 @@ var limitMapInModelName = map[string]inputLimitInfo{ } var limitMapInEndpoint = map[string]inputLimitInfo{ + "/chat/ernie-4.0-8k-latest": {MaxInputChars: 20000, MaxInputTokens: 5120}, + "/chat/ernie-4.0-8k-0613": {MaxInputChars: 20000, MaxInputTokens: 5120}, + "/chat/ernie-3.5-8k-0613": {MaxInputChars: 20000, MaxInputTokens: 5120}, "/chat/eb-instant": {MaxInputChars: 11200, MaxInputTokens: 7168}, "/chat/ernie-lite-8k": {MaxInputChars: 11200, MaxInputTokens: 7168}, "/chat/completions": {MaxInputChars: 20000, MaxInputTokens: 5120}, diff --git a/java/src/main/java/com/baidubce/qianfan/core/ModelEndpointRetriever.java b/java/src/main/java/com/baidubce/qianfan/core/ModelEndpointRetriever.java index 6899a85b..cb443691 100644 --- a/java/src/main/java/com/baidubce/qianfan/core/ModelEndpointRetriever.java +++ b/java/src/main/java/com/baidubce/qianfan/core/ModelEndpointRetriever.java @@ -74,6 +74,9 @@ public ModelEndpointRetriever(IAuth auth) { dynamicTypeModelEndpointMap.put(type, new HashMap<>()); } + typeModelEndpointMap.get(ModelType.CHAT).put("ernie-4.0-8k-latest", "ernie-4.0-8k-latest"); + typeModelEndpointMap.get(ModelType.CHAT).put("ernie-4.0-8k-0613", "ernie-4.0-8k-0613"); + typeModelEndpointMap.get(ModelType.CHAT).put("ernie-3.5-8k-0613", "ernie-3.5-8k-0613"); typeModelEndpointMap.get(ModelType.CHAT).put("ernie-4.0-8k", "completions_pro"); typeModelEndpointMap.get(ModelType.CHAT).put("ernie-4.0-8k-preemptible", "completions_pro_preemptible"); typeModelEndpointMap.get(ModelType.CHAT).put("ernie-4.0-8k-preview", "ernie-4.0-8k-preview"); diff --git a/javascript/src/ChatCompletion/utils.ts b/javascript/src/ChatCompletion/utils.ts index ae5102c6..cf555a9e 100644 --- a/javascript/src/ChatCompletion/utils.ts +++ b/javascript/src/ChatCompletion/utils.ts @@ -18,6 +18,9 @@ import {QfLLMInfoMap} from '../interface'; * 对话请求公共服务模型列表 */ export type ChatModel = + | 'ERNIE-4.0-8K-Latest' + | 'ERNIE-4.0-8K-0613' + | 'ERNIE-3.5-8K-0613' | 'ERNIE-4.0-8K' | 'ERNIE-3.5-8K' | 'ERNIE-3.5-8K-0205' @@ -51,6 +54,68 @@ export type ChatModel = | 'Yi-34B-Chat' export const modelInfoMap: QfLLMInfoMap = { + "ERNIE-4.0-8K-Latest": { + endpoint: "/chat/ernie-4.0-8k-latest", + required_keys: ["messages"], + optional_keys: [ + "stream", + "temperature", + "top_p", + "penalty_score", + "user_id", + "system", + "stop", + "enable_system_memory", + "system_memory_id", + "disable_search", + "enable_citation", + "enable_trace", + "max_output_tokens", + "response_format", + ], + }, + "ERNIE-4.0-8K-0613": { + endpoint: "/chat/ernie-4.0-8k-0613", + required_keys: ["messages"], + optional_keys: [ + "stream", + "temperature", + "top_p", + "penalty_score", + "user_id", + "system", + "stop", + "enable_system_memory", + "system_memory_id", + "disable_search", + "enable_citation", + "enable_trace", + "max_output_tokens", + "response_format", + ], + }, + "ERNIE-3.5-8K-0613": { + endpoint: "/chat/ernie-3.5-8k-0613", + required_keys: ["messages"], + optional_keys: [ + "stream", + "temperature", + "top_p", + "penalty_score", + "user_id", + "system", + "stop", + "enable_system_memory", + "system_memory_id", + "disable_search", + "enable_citation", + "enable_trace", + "max_output_tokens", + "response_format", + "functions", + "tool_choice", + ], + }, 'ERNIE-4.0-8K': { endpoint: '/chat/completions_pro', required_keys: ['messages'], diff --git a/javascript/src/DynamicModelEndpoint/utils.ts b/javascript/src/DynamicModelEndpoint/utils.ts index accda3a8..bca5f263 100644 --- a/javascript/src/DynamicModelEndpoint/utils.ts +++ b/javascript/src/DynamicModelEndpoint/utils.ts @@ -20,6 +20,9 @@ const typeModelEndpointMap: ModelEndpointMap = new Map(); // 定义 "CHAT" 类型的模型及其 endpoints const chatModelEndpoints = new Map([ + ['ernie-4.0-8k-latest', 'ernie-4.0-8k-latest'], + ['ernie-4.0-8k-0613', 'ernie-4.0-8k-0613'], + ['ernie-3.5-8k-0613', 'ernie-3.5-8k-0613'], ['ernie-4.0-8k', 'completions_pro'], ['ernie-4.0-8k-preemptible', 'completions_pro_preemptible'], ['ernie-4.0-8k-preview', 'ernie-4.0-8k-preview'], diff --git a/python/qianfan/resources/llm/chat_completion.py b/python/qianfan/resources/llm/chat_completion.py index e702e5f6..dda5c634 100644 --- a/python/qianfan/resources/llm/chat_completion.py +++ b/python/qianfan/resources/llm/chat_completion.py @@ -57,6 +57,80 @@ def _supported_models(cls) -> Dict[str, QfLLMInfo]: """ info_list = { + "ERNIE-4.0-8K-Latest": QfLLMInfo( + endpoint="/chat/ernie-4.0-8k-latest", + required_keys={"messages"}, + optional_keys={ + "stream", + "temperature", + "top_p", + "penalty_score", + "user_id", + "system", + "stop", + "enable_system_memory", + "system_memory_id", + "disable_search", + "enable_citation", + "enable_trace", + "max_output_tokens", + "response_format", + }, + max_input_chars=20000, + max_input_tokens=5120, + input_price_per_1k_tokens=0.12, + output_price_per_1k_tokens=0.12, + ), + "ERNIE-4.0-8K-0613": QfLLMInfo( + endpoint="/chat/ernie-4.0-8k-0613", + required_keys={"messages"}, + optional_keys={ + "stream", + "temperature", + "top_p", + "penalty_score", + "user_id", + "system", + "stop", + "enable_system_memory", + "system_memory_id", + "disable_search", + "enable_citation", + "enable_trace", + "max_output_tokens", + "response_format", + }, + max_input_chars=20000, + max_input_tokens=5120, + input_price_per_1k_tokens=0.12, + output_price_per_1k_tokens=0.12, + ), + "ERNIE-3.5-8K-0613": QfLLMInfo( + endpoint="/chat/ernie-3.5-8k-0613", + required_keys={"messages"}, + optional_keys={ + "stream", + "temperature", + "top_p", + "penalty_score", + "user_id", + "system", + "stop", + "enable_system_memory", + "system_memory_id", + "disable_search", + "enable_citation", + "enable_trace", + "max_output_tokens", + "response_format", + "functions", + "tool_choice", + }, + max_input_chars=20000, + max_input_tokens=5120, + input_price_per_1k_tokens=0.012, + output_price_per_1k_tokens=0.012, + ), "ERNIE-Lite-8K-0922": QfLLMInfo( endpoint="/chat/eb-instant", required_keys={"messages"},