| 146 | 146 | cachingAtDepth += convertedPrompt.messages[messageCount - 1].role === 'assistant' ? 1 : 0; |
| 147 | 147 | |
| 148 | 148 | if (messageCount - 1 - cachingAtDepth >= 0) { |
| 149 | 149 | const contentCount = convertedPrompt.messages[messageCount - 1 - cachingAtDepth]['cache_control'] = { type: 'ephemeral' }.content.length; |
| 150 | + convertedPrompt.messages[messageCount - 1 - cachingAtDepth].content[contentCount - 1]['cache_control'] = { type: 'ephemeral' }; |
| 150 | 151 | } |
| 151 | 152 | |
| 152 | 153 | if (messageCount - 1 - cachingAtDepth - 2 >= 0) { |
| 153 | 154 | const contentCount = convertedPrompt.messages[messageCount - 1 - cachingAtDepth - 2]['cache_control'] = { type: 'ephemeral' }.content.length; |
| 155 | + convertedPrompt.messages[messageCount - 1 - cachingAtDepth - 2].content[contentCount - 1]['cache_control'] = { type: 'ephemeral' }; |
| 154 | 156 | } |
| 155 | 157 | } |
| 156 | 158 | |