@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
21 lines (20 loc) • 1.25 kB
TypeScript
import type { LangfuseAttributePolicy, OtlpKeyValue, OtlpSpan, SpanAttributes, SpanData } from "../types/index.js";
/**
* @description Encodes attributes as OTLP/JSON key-values, dropping `undefined` and `null` entries.
* @param attributes {SpanAttributes} - Attribute record to encode.
* @returns {OtlpKeyValue[]} One typed key-value per kept attribute.
*/
export declare function toOtlpAttributes(attributes: SpanAttributes): OtlpKeyValue[];
/**
* @description Encodes one span as OTLP/JSON, applying the exporter's attribute policy to its attributes.
* @param span {SpanData} - Span to encode.
* @param policy {LangfuseAttributePolicy} - Environment, release, redaction and mask settings.
* @returns {OtlpSpan} The span in the shape Langfuse's ingestion endpoint reads.
*/
export declare function toOtlpSpan(span: SpanData, policy: LangfuseAttributePolicy): OtlpSpan;
/**
* @description Splits encoded spans into request-sized batches, bounded by span count and serialized bytes.
* @param spans {OtlpSpan[]} - Encoded spans, in export order.
* @returns {OtlpSpan[][]} Batches that each fit one export request; a single oversized span still gets its own batch.
*/
export declare function chunkOtlpSpans(spans: OtlpSpan[]): OtlpSpan[][];