From 978bb9051d15f7c45c2e46f9361f9a66704f4160 Mon Sep 17 00:00:00 2001 From: taylor <=> Date: Tue, 12 Nov 2024 10:24:55 +0800 Subject: [PATCH] =?UTF-8?q?update:=20xai=E5=A2=9E=E5=8A=A0max=5Ftokens,max?= =?UTF-8?q?=5Fwords=E7=AD=89=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- maubot_llmplus/thrid_platform.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/maubot_llmplus/thrid_platform.py b/maubot_llmplus/thrid_platform.py index 2c93cc6..3edd9db 100644 --- a/maubot_llmplus/thrid_platform.py +++ b/maubot_llmplus/thrid_platform.py @@ -120,9 +120,13 @@ class Anthropic(Platform): class XAi(Platform): + max_tokens: int + temperature: int def __init__(self, config: BaseProxyConfig, http: ClientSession) -> None: super().__init__(config, http) + self.temperature = self.config['temperature'] + self.max_tokens = self.config['max_tokens'] async def create_chat_completion(self, plugin: AbsExtraConfigPlugin, evt: MessageEvent) -> ChatCompletion: full_context = [] @@ -139,6 +143,9 @@ class XAi(Platform): "stream": False } + if 'max_tokens' in self.config and self.max_tokens: + data["max_tokens"] = self.max_tokens + if 'temperature' in self.config and self.temperature: request_body["temperature"] = self.temperature