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

Function isValidAPIMessage

src/services/api/errors.ts:436–447  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

434 * Type guard to check if a value is a valid Message response from the API
435 */
436export function isValidAPIMessage(value: unknown): value is BetaMessage {
437 return (
438 typeof value === 'object' &&
439 value !== null &&
440 'content' in value &&
441 'model' in value &&
442 'usage' in value &&
443 Array.isArray((value as BetaMessage).content) &&
444 typeof (value as BetaMessage).model === 'string' &&
445 typeof (value as BetaMessage).usage === 'object'
446 )
447}
448
449/** Lower-level error that AWS can return. */
450type AmazonError = {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected