mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-02-01 02:51:25 +08:00
3.1 KiB
3.1 KiB
title |
---|
models |
Module nonebot_plugin_marshoai.plugin.models
class PluginMetadata(BaseModel)
attr name: str = NO_DEFAULT
attr description: str = ''
attr usage: str = ''
attr author: str = ''
attr homepage: str = ''
attr extra: dict[str, Any] = {}
class Plugin(BaseModel)
func hash self => int
Source code or View on GitHub
def __hash__(self) -> int:
return hash(self.name)
func self == other: Any => bool
Source code or View on GitHub
def __eq__(self, other: Any) -> bool:
return self.name == other.name
attr name: str = NO_DEFAULT
attr module: ModuleType = NO_DEFAULT
attr module_name: str = NO_DEFAULT
attr metadata: PluginMetadata | None = None
class FunctionCallArgument(BaseModel)
func data(self) -> dict[str, Any]
Source code or View on GitHub
def data(self) -> dict[str, Any]:
return {'type': self.type_, 'description': self.description}
attr type_: str = NO_DEFAULT
attr description: str = NO_DEFAULT
attr default: Any = None
class FunctionCall(BaseModel)
func hash self => int
Source code or View on GitHub
def __hash__(self) -> int:
return hash(self.name)
func data(self) -> dict[str, Any]
Description: 生成函数描述信息
Return: dict[str, Any]: 函数描述信息 字典
Source code or View on GitHub
def data(self) -> dict[str, Any]:
return {'type': 'function', 'function': {'name': self.name, 'description': self.description, 'parameters': {'type': 'object', 'properties': {k: v.data() for k, v in self.arguments.items()}}, 'required': [k for k, v in self.arguments.items() if v.default is None]}}