Skip to content

Commit

Permalink
perf: siliconcloud 不支持 tool 的模型
Browse files Browse the repository at this point in the history
  • Loading branch information
Soulter committed Feb 2, 2025
1 parent c75aeea commit 180b45f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion astrbot/core/provider/sources/openai_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ async def _query(self, payloads: dict, tools: FuncCall) -> LLMResponse:
stream=False
)
except BaseException as e:
# 处理不支持 Function Calling 的模型
if 'does not support Function Calling' in str(e) \
or 'does not support tools' in str(e): # ollama
or 'does not support tools' in str(e) \
or 'Function call is not supported' in str(e): # siliconcloud
del payloads['tools']
logger.debug(f"模型 {self.model_name} 不支持 tools,已自动移除")
completion = await self.client.chat.completions.create(
Expand Down

0 comments on commit 180b45f

Please sign in to comment.