mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-07 22:36:02 +00:00
feat: chat_completion的函数开关支持
This commit is contained in:
@@ -69,12 +69,20 @@ class ChatCompletionRequest(RequestBase):
|
||||
|
||||
if self.pending_func_call is None: # 没有待处理的函数调用请求
|
||||
|
||||
resp = self._req(
|
||||
model=self.model,
|
||||
messages=self.messages,
|
||||
functions=get_func_schema_list(),
|
||||
**self.kwargs
|
||||
)
|
||||
args = {
|
||||
"model": self.model,
|
||||
"messages": self.messages,
|
||||
}
|
||||
|
||||
funcs = get_func_schema_list()
|
||||
|
||||
if len(funcs) > 0:
|
||||
args['functions'] = funcs
|
||||
|
||||
# 拼接kwargs
|
||||
args = {**args, **self.kwargs}
|
||||
|
||||
resp = self._req(**args)
|
||||
|
||||
choice0 = resp["choices"][0]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user