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