@openai/agents-openai
Version:
The OpenAI Agents SDK is a lightweight yet powerful framework for building multi-agent workflows.
24 lines (23 loc) • 1.56 kB
TypeScript
import type { GenerationSpanData } from '@openai/agents-core';
type GenerationUsageData = NonNullable<GenerationSpanData['usage']>;
type JsonCompatibleValue = null | string | number | boolean | JsonCompatibleValue[] | {
[key: string]: JsonCompatibleValue;
};
type TruncationWork = {
remainingBytes: number;
};
declare function valueJsonSizeBytes(value: unknown, work?: TruncationWork): number;
declare function truncateJsonValueForLimit(value: JsonCompatibleValue, maxBytes: number, depth?: number, work?: TruncationWork): JsonCompatibleValue;
declare function truncateMappingForJsonLimit(value: Record<string, JsonCompatibleValue>, maxBytes: number, depth?: number, work?: TruncationWork): Record<string, JsonCompatibleValue>;
declare function truncateListForJsonLimit(value: JsonCompatibleValue[], maxBytes: number, depth?: number, work?: TruncationWork): JsonCompatibleValue[];
/** Limit one export field without mutating the original span value. */
export declare function truncateSpanFieldValue(value: unknown): unknown;
export declare const _tracingFieldProcessingTestUtils: {
valueJsonSizeBytes: typeof valueJsonSizeBytes;
truncateJsonValueForLimit: typeof truncateJsonValueForLimit;
truncateMappingForJsonLimit: typeof truncateMappingForJsonLimit;
truncateListForJsonLimit: typeof truncateListForJsonLimit;
};
/** Normalize usage details with the same JSON sanitization as trace fields. */
export declare function sanitizeGenerationUsageForTracesIngest(usage: GenerationUsageData): GenerationUsageData | undefined;
export {};