* 将项目内部的 ToolDefinition 转换为 OpenAI Functions 格式(旧版)
(toolDefinitions: ToolDefinition[])
| 48 | * 将项目内部的 ToolDefinition 转换为 OpenAI Functions 格式(旧版) |
| 49 | */ |
| 50 | static toOpenAIFunctions(toolDefinitions: ToolDefinition[]): OpenAIFunction[] { |
| 51 | return toolDefinitions.map(tool => ({ |
| 52 | name: tool.name, |
| 53 | description: tool.description, |
| 54 | parameters: { |
| 55 | type: 'object', |
| 56 | properties: tool.parameters, |
| 57 | required: tool.required || [], |
| 58 | }, |
| 59 | })); |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * 将 OpenAI Tools 格式转换为 Functions 格式 |
no outgoing calls
no test coverage detected