(error: unknown)
| 191 | } |
| 192 | |
| 193 | function isContextLengthError(error: unknown): boolean { |
| 194 | const message = getErrorMessage(error).toLowerCase(); |
| 195 | return message.includes("input length exceeds context length") |
| 196 | || (message.includes("context") && message.includes("exceed")) |
| 197 | || message.includes("maximum context length"); |
| 198 | } |
| 199 | |
| 200 | function shrinkEmbeddingInput(input: string): string { |
| 201 | if (input.length <= MIN_EMBED_INPUT_CHARS) return input; |
no test coverage detected