mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-20 19:36:08 +00:00
feat: new llm initialization logic
This commit is contained in:
@@ -17,8 +17,16 @@ class LLMAPIRequester(metaclass=abc.ABCMeta):
|
||||
|
||||
ap: app.Application
|
||||
|
||||
def __init__(self, ap: app.Application):
|
||||
default_config: dict[str, typing.Any] = {}
|
||||
|
||||
requester_cfg: dict[str, typing.Any] = {}
|
||||
|
||||
def __init__(self, ap: app.Application, config: dict[str, typing.Any]):
|
||||
self.ap = ap
|
||||
self.requester_cfg = {
|
||||
**self.default_config
|
||||
}
|
||||
self.requester_cfg.update(config)
|
||||
|
||||
async def initialize(self):
|
||||
pass
|
||||
@@ -40,6 +48,7 @@ class LLMAPIRequester(metaclass=abc.ABCMeta):
|
||||
model: modelmgr_entities.LLMModelInfo,
|
||||
messages: typing.List[llm_entities.Message],
|
||||
funcs: typing.List[tools_entities.LLMFunction] = None,
|
||||
extra_args: dict[str, typing.Any] = {},
|
||||
) -> llm_entities.Message:
|
||||
"""调用API
|
||||
|
||||
@@ -47,6 +56,7 @@ class LLMAPIRequester(metaclass=abc.ABCMeta):
|
||||
model (modelmgr_entities.LLMModelInfo): 使用的模型信息
|
||||
messages (typing.List[llm_entities.Message]): 消息对象列表
|
||||
funcs (typing.List[tools_entities.LLMFunction], optional): 使用的工具函数列表. Defaults to None.
|
||||
extra_args (dict[str, typing.Any], optional): 额外的参数. Defaults to {}.
|
||||
|
||||
Returns:
|
||||
llm_entities.Message: 返回消息对象
|
||||
|
||||
Reference in New Issue
Block a user