( content: ChatCompletionRequestBody['messages'][number]['content'], )
| 182 | } |
| 183 | |
| 184 | function normalizeMoonshotContent( |
| 185 | content: ChatCompletionRequestBody['messages'][number]['content'], |
| 186 | ): ChatCompletionRequestBody['messages'][number]['content'] { |
| 187 | if (!Array.isArray(content)) { |
| 188 | return content |
| 189 | } |
| 190 | |
| 191 | return content.map((part) => { |
| 192 | if (!part || typeof part !== 'object') { |
| 193 | return part |
| 194 | } |
| 195 | const { cache_control: _cacheControl, ...rest } = |
| 196 | part as ChatCompletionContentPart & { |
| 197 | cache_control?: unknown |
| 198 | } |
| 199 | return rest |
| 200 | }) |
| 201 | } |
| 202 | |
| 203 | function normalizeMoonshotTool(tool: ChatCompletionTool): ChatCompletionTool { |
| 204 | const { function: fn, ...rest } = tool |
no outgoing calls
no test coverage detected