UNPKG

@juspay/neurolink

Version:

The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002

26 lines (25 loc) • 860 B
/** * Safe metadata filtering for observability exporters. * * Only these attribute keys are forwarded to third-party backends as trace * metadata. User prompts (input), LLM responses (output), error stacks, and * any other potentially sensitive data are excluded to prevent PII leaks. */ // Only ai.* keys are forwarded as metadata. Stream metrics (chunk_count, // content_length) should be accessed via span attributes directly, not via // metadata sent to third-party backends. export const SAFE_METADATA_KEYS = new Set([ "ai.provider", "ai.model", "ai.temperature", "ai.max_tokens", ]); export function filterSafeMetadata(attributes) { const filtered = {}; for (const key of SAFE_METADATA_KEYS) { if (attributes[key] !== undefined) { filtered[key] = attributes[key]; } } return filtered; }