MCPcopy Create free account
hub / github.com/Noumena-Network/code / isPromptTooLongMessage

Function isPromptTooLongMessage

src/services/api/errors.ts:62–75  ·  view source on GitHub ↗
(msg: AssistantMessage)

Source from the content-addressed store, hash-verified

60export const PROMPT_TOO_LONG_ERROR_MESSAGE = 'Prompt is too long'
61
62export function isPromptTooLongMessage(msg: AssistantMessage): boolean {
63 if (!msg.isApiErrorMessage) {
64 return false
65 }
66 const content = msg.message.content
67 if (!Array.isArray(content)) {
68 return false
69 }
70 return content.some(
71 block =>
72 block.type === 'text' &&
73 block.text.startsWith(PROMPT_TOO_LONG_ERROR_MESSAGE),
74 )
75}
76
77/**
78 * Parse actual/limit token counts from a raw prompt-too-long API error

Callers 2

queryLoopFunction · 0.85
getPromptTooLongTokenGapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected