| 17 | |
| 18 | |
| 19 | class Tool(BaseModel): |
| 20 | tool_id: str = Field( |
| 21 | ..., |
| 22 | description="The tool ID.", |
| 23 | examples=["action_1"], |
| 24 | ) |
| 25 | |
| 26 | type: ToolType = Field( |
| 27 | ..., |
| 28 | description="The tool type, which can be `action`, `plugin` or `function`.", |
| 29 | examples=["action", "plugin", "function"], |
| 30 | ) |
| 31 | |
| 32 | function_def: Dict = Field( |
| 33 | ..., |
| 34 | description="The function definition for chat completion function-call.", |
| 35 | ) |
| 36 | |
| 37 | def function_name(self): |
| 38 | return self.function_def["name"] |
| 39 | |
| 40 | |
| 41 | class ToolInput(BaseModel): |