* 将 OpenAI Functions 格式转换为 Tools 格式
(functions: OpenAIFunction[])
| 74 | * 将 OpenAI Functions 格式转换为 Tools 格式 |
| 75 | */ |
| 76 | static functionsToTools(functions: OpenAIFunction[]): OpenAITool[] { |
| 77 | return functions.map(func => ({ |
| 78 | type: 'function' as const, |
| 79 | function: { |
| 80 | name: func.name, |
| 81 | description: func.description, |
| 82 | parameters: func.parameters, |
| 83 | }, |
| 84 | })); |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * 自动检测格式并转换为 OpenAI Tools 格式 |