MCPcopy Index your code
hub / github.com/forloopcodes/contextplus / isContextLengthError

Function isContextLengthError

src/core/embeddings.ts:193–198  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

191}
192
193function 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
200function shrinkEmbeddingInput(input: string): string {
201 if (input.length <= MIN_EMBED_INPUT_CHARS) return input;

Callers 3

embedSingleAdaptiveFunction · 0.85
embedBatchAdaptiveFunction · 0.85
indexMethod · 0.85

Calls 1

getErrorMessageFunction · 0.85

Tested by

no test coverage detected