import { SpanExporter, SpanProcessor } from '@opentelemetry/sdk-trace-base'; import * as _opentelemetry_api from '@opentelemetry/api'; import { TextMapPropagator, ContextManager, Span } from '@opentelemetry/api'; import * as openai from 'openai'; import * as anthropic from '@anthropic-ai/sdk'; import * as cohere from 'cohere-ai'; import * as bedrock from '@aws-sdk/client-bedrock-runtime'; import * as aiplatform from '@google-cloud/aiplatform'; import * as vertexAI from '@google-cloud/vertexai'; import * as pinecone from '@pinecone-database/pinecone'; import * as together from 'together-ai'; import * as llamaindex from 'llamaindex'; import * as chromadb from 'chromadb'; import * as qdrant from '@qdrant/js-client-rest'; import * as mcp from '@modelcontextprotocol/sdk/client/index.js'; import * as genai from '@google/genai'; import { SpanProcessor as SpanProcessor$1 } from '@opentelemetry/sdk-trace-node'; /** * The severity of an error. */ declare const SEVERITY: { readonly Warning: "Warning"; readonly Error: "Error"; readonly Critical: "Critical"; }; type Severity = (typeof SEVERITY)[keyof typeof SEVERITY]; /** * Base class for all Traceloop errors. */ declare class TraceloopError extends Error { /** * The severity of the error. */ severity: Severity; /** * The underlying cause of the error. */ underlyingCause?: Error; constructor(message: string, severity?: Severity); } declare class NotInitializedError extends TraceloopError { constructor(); } declare class InitializationError extends TraceloopError { constructor(message?: string, cause?: Error); } declare class ArgumentNotProvidedError extends TraceloopError { constructor(argumentName: string); } declare class PromptNotFoundError extends TraceloopError { constructor(key: string); } /** * Options for initializing the Traceloop SDK. */ interface InitializeOptions { /** * The app name to be used when reporting traces. Optional. * Defaults to the package name. */ appName?: string; /** * The API Key for sending traces data. Optional. * Defaults to the TRACELOOP_API_KEY environment variable. */ apiKey?: string; /** * The OTLP endpoint for sending traces data. Optional. * Defaults to TRACELOOP_BASE_URL environment variable or https://api.traceloop.com/ */ baseUrl?: string; /** * Sends traces and spans without batching, for local developement. Optional. * Defaults to false. */ disableBatch?: boolean; /** * Defines default log level for SDK and all instrumentations. Optional. * Defaults to error. */ logLevel?: "debug" | "info" | "warn" | "error"; /** * Whether to log prompts, completions and embeddings on traces. Optional. * Defaults to true. */ traceContent?: boolean; /** * The OpenTelemetry SpanExporter to be used for sending traces data. Optional. * Defaults to the OTLP exporter. */ exporter?: SpanExporter; /** * The headers to be sent with the traces data. Optional. */ headers?: Record; /** * The OpenTelemetry SpanProcessor to be used for processing traces data. Optional. * Defaults to the BatchSpanProcessor. */ processor?: SpanProcessor; /** * The OpenTelemetry Propagator to use. Optional. * Defaults to OpenTelemetry SDK defaults. */ propagator?: TextMapPropagator; /** * The OpenTelemetry ContextManager to use. Optional. * Defaults to OpenTelemetry SDK defaults. */ contextManager?: ContextManager; /** * Explicitly specify modules to instrument. Optional. * This is a workaround specific to Next.js, see https://www.traceloop.com/docs/openllmetry/getting-started-nextjs */ instrumentModules?: { openAI?: typeof openai.OpenAI; anthropic?: typeof anthropic; cohere?: typeof cohere; bedrock?: typeof bedrock; google_vertexai?: typeof vertexAI; google_aiplatform?: typeof aiplatform; pinecone?: typeof pinecone; together?: typeof together.Together; langchain?: boolean; llamaIndex?: typeof llamaindex; /** Only meaningful when `llamaIndex` is also provided. */ llamaIndexOpenAI?: any; chromadb?: typeof chromadb; qdrant?: typeof qdrant; mcp?: typeof mcp; google_genai?: typeof genai; }; /** * Enables sync with Traceloop servers for the prompt registry functionality. Optional. * Defaults to TRACELOOP_SYNC_ENABLED environment variable or true if not set. */ traceloopSyncEnabled?: boolean; /** * Defines the number of retires when fetching prompt data for the registry. Optional. * Defaults to TRACELOOP_SYNC_MAX_RETRIES environment variable or 3 if not set. */ traceloopSyncMaxRetries?: number; /** * Defines the polling interval for the prompt registry. Optional. * Defaults to TRACELOOP_SYNC_POLLING_INTERVAL environment variable or 60 if not set. */ traceloopSyncPollingInterval?: number; /** * Defines the polling interval for the prompt registry. Optional. * Defaults to TRACELOOP_SYNC_DEV_POLLING_INTERVAL environment variable or 5 if not set. */ traceloopSyncDevPollingInterval?: number; /** * Whether to silence the initialization message. Optional. * Defaults to false. */ silenceInitializationMessage?: boolean; /** * Whether to enable tracing. Optional. * Defaults to true. */ tracingEnabled?: boolean; /** * The experiment slug to use when running experiments. Optional. * Defaults to the TRACELOOP_EXP_SLUG environment variable. */ experimentSlug?: string; /** * The Google Cloud Project ID for sending traces data. Optional. * This is used to configure the Google Cloud Trace Exporter. */ gcpProjectId?: string; } /** * Represents an entity in the system that can be annotated. * An entity is typically a unit of content or interaction that needs to be tracked or evaluated. * It is reported as an association property before the annotation is created. */ interface Entity { /** * Unique identifier for the entity. * This could be a user ID, conversation ID, or any other unique identifier in your system. */ id: string; } /** * Configuration options for creating a new annotation. * Annotations are used to attach metadata, feedback, or evaluation results to specific entities. */ interface AnnotationCreateOptions { /** * The identifier of the annotation task. * The ID or slug of the annotation task, Can be found at app.traceloop.com/annotation_tasks/:annotationTaskId */ annotationTask: string; /** * The entity to be annotated. * Contains the entity's identifier and optional type information. * Be sure to report the entity instance ID as the association property before * in order to correctly correlate the annotation to the relevant context. */ entity: Entity; /** * Key-value pairs of annotation data, should match the tags defined in the annotation task */ tags: Record; } type TagValue = string | number | string[]; interface TraceloopClientOptions { apiKey: string; appName: string; baseUrl?: string; experimentSlug?: string; } interface DatasetCreateOptions { name: string; slug?: string; description?: string; } interface DatasetUpdateOptions { name?: string; description?: string; } interface DatasetResponse { id: string; slug: string; name: string; description?: string; version?: string; published?: boolean; createdAt?: string; updatedAt?: string; columns?: Record; rows?: RowResponse[]; } interface ColumnDefinition { name: string; type: "string" | "number" | "boolean" | "date" | "file"; slug?: string; required?: boolean; description?: string; } interface ColumnResponse extends ColumnDefinition { slug: string; datasetId: string; datasetSlug: string; createdAt: string; updatedAt: string; } interface ColumnUpdateOptions { name?: string; type?: "string" | "number" | "boolean" | "date" | "file"; required?: boolean; description?: string; } interface RowData { [key: string]: string | number | boolean | null | object; } interface RowResponse { id: string; datasetId: string; datasetSlug: string; data: RowData; createdAt: string; updatedAt: string; } interface RowUpdateOptions { data: Partial; } interface DatasetListResponse { datasets: DatasetResponse[]; total: number; } interface DatasetPublishOptions { version?: string; description?: string; } interface CSVImportOptions { hasHeader?: boolean; delimiter?: string; encoding?: string; } interface DatasetVersion { version: string; publishedBy: string; publishedAt: string; } interface DatasetVersionsResponse { datasetId: string; datasetSlug: string; versions: DatasetVersion[]; total: number; } type DatasetColumnValue = string | number | boolean | null | undefined; interface StreamEvent { type: "progress" | "result" | "error" | "complete"; data: any; timestamp: string; id?: string; event?: string; } interface EvaluatorRunOptions { experimentId: string; experimentSlug: string; experimentRunId?: string; taskId: string; taskResult: Record; evaluator: EvaluatorDetails; waitForResults?: boolean; timeout?: number; } interface EvaluatorResult { evaluatorName: string; taskId?: string; score?: number; result?: any; metadata?: Record; error?: string; } interface TriggerEvaluatorRequest { experimentId: string; experimentSlug: string; experimentRunId?: string; taskId?: string; evaluator: EvaluatorDetails; taskResult: Record; metadata?: Record; } interface TriggerEvaluatorResponse { executionId: string; streamUrl: string; } interface StreamProgressEvent { type: "progress"; data: { completed: number; total: number; percentage: number; currentTask?: string; }; } interface StreamResultEvent { type: "result"; data: { taskId: string; evaluatorName: string; result: EvaluatorResult; }; } interface StreamErrorEvent { type: "error"; data: { error: string; taskId?: string; evaluatorName?: string; }; } interface StreamCompleteEvent { type: "complete"; data: { executionId: string; totalResults: number; totalErrors: number; duration: number; }; } type SSEStreamEvent = StreamProgressEvent | StreamResultEvent | StreamErrorEvent | StreamCompleteEvent; interface InputExtractor { source: string; } interface InputSchemaMapping { [key: string]: InputExtractor; } interface LLMMessage { role: string; content: string; } interface PropertySchema { name: string; type: string; description?: string; enumValues?: string[]; } interface CreateCustomEvaluatorRequest { name: string; slug?: string; description?: string; messages: LLMMessage[]; provider: string; model: string; inputSchema: PropertySchema[]; outputSchema: PropertySchema[]; temperature?: number; maxTokens?: number; topP?: number; frequencyPenalty?: number; presencePenalty?: number; } interface EvaluatorUpdateRequest { name?: string; description?: string; messages?: LLMMessage[]; provider?: string; model?: string; inputSchema?: PropertySchema[]; outputSchema?: PropertySchema[]; temperature?: number; maxTokens?: number; topP?: number; frequencyPenalty?: number; presencePenalty?: number; } interface EvaluatorExecuteOptions { input: Record; } interface EvaluatorCreateResponse { id: string; slug: string; } interface EvaluatorUpdateResponse { id: string; } interface EvaluatorExecuteResponse { executionId: string; result: unknown; } type EvaluatorSource = "custom" | "prebuilt"; interface EvaluatorCatalogItem { id: string; name: string; slug: string; type: string; description: string; version?: string; source: EvaluatorSource; inputSchema: PropertySchema[]; outputSchema: PropertySchema[]; config?: unknown; createdAt?: string; updatedAt?: string; } interface EvaluatorData extends EvaluatorCatalogItem { messages: LLMMessage[]; provider: string; model: string; temperature?: number; maxTokens?: number; topP?: number; frequencyPenalty?: number; presencePenalty?: number; } type dataValue = string | number | boolean; type TaskInput = Record; type TaskOutput = Record; interface ExperimentTaskFunction { (input: TInput): Promise | TOutput; } type EvaluatorDetails = string | EvaluatorWithVersion | EvaluatorWithConfig; interface EvaluatorWithVersion { name: string; version: string; } /** * Evaluator configuration with optional version and config options. * Used for "Made by Traceloop" (MBT) evaluators that support configuration. */ interface EvaluatorWithConfig { name: string; version?: string; config?: Record; requiredInputFields?: string[]; } interface ExperimentRunOptions { datasetSlug?: string; datasetVersion?: string; evaluators?: EvaluatorDetails[]; experimentSlug?: string; relatedRef?: Record; aux?: Record; stopOnError?: boolean; waitForResults?: boolean; } interface TaskResponse { input: Record; output: Record; metadata?: Record; timestamp?: number; error?: string; input_schema_mapping?: InputSchemaMapping; } interface ExperimentRunResult { taskResults: TaskResponse[]; errors: string[]; experimentId?: string; runId?: string; evaluations?: Record[]; } interface InitExperimentRequest { slug: string; datasetSlug?: string; datasetVersion?: string; evaluatorSlugs?: string[]; experimentMetadata?: Record; experimentRunMetadata?: Record; relatedRef?: Record; aux?: Record; } interface ExperimentResponse { id: string; slug: string; metadata?: Record; created_at: string; updated_at: string; } interface ExperimentRunResponse { id: string; metadata?: Record; dataset_id?: string; dataset_version?: string; evaluator_ids?: string[]; created_at: string; updated_at: string; } interface ExperimentInitResponse { experiment: ExperimentResponse; run: ExperimentRunResponse; } interface ExecutionResponse { executionId: string; result: Record; } interface CreateTaskResponse { id: string; } interface GithubContext { repository: string; prUrl: string; commitHash: string; actor: string; } interface TaskResult { input: Record; output?: Record; error?: string; metadata?: Record; } interface RunInGithubOptions { datasetSlug: string; datasetVersion?: string; evaluators?: EvaluatorDetails[]; experimentSlug?: string; experimentMetadata?: Record; experimentRunMetadata?: Record; relatedRef?: Record; aux?: Record; } interface RunInGithubResponse { experimentId: string; experimentSlug: string; runId: string; } type AnnotationFlow = "user_feedback"; /** * Base class for handling annotation operations with the Traceloop API. * @internal */ declare class BaseAnnotation { protected client: TraceloopClient; protected flow: AnnotationFlow; constructor(client: TraceloopClient, flow: AnnotationFlow); /** * Creates a new annotation. * * @param options - The annotation creation options * @returns Promise resolving to the fetch Response */ create(options: AnnotationCreateOptions): Promise; } /** * Handles user feedback annotations with the Traceloop API. */ declare class UserFeedback extends BaseAnnotation { constructor(client: TraceloopClient); /** * Creates a new annotation for a specific task and entity. * * @param options - The options for creating an annotation * @returns Promise resolving to the fetch Response * * @example * ```typescript * await client.annotation.create({ * annotationTask: 'sample-annotation-task', * entity: { * id: '123456', * }, * tags: { * sentiment: 'positive', * score: 0.85, * tones: ['happy', 'surprised'] * } * }); * ``` */ create(options: AnnotationCreateOptions): Promise; } declare abstract class BaseDatasetEntity { protected client: TraceloopClient; constructor(client: TraceloopClient); protected handleResponse(response: Response): Promise; protected validateDatasetId(id: string): void; protected validateDatasetSlug(slug: string): void; protected validateDatasetName(name: string): void; } type FileCellType = "image" | "video" | "audio" | "file"; type FileStorageType = "internal" | "external"; interface AttachmentMetadata { [key: string]: string | number | boolean; } interface AttachmentOptions { filePath?: string; data?: Buffer | Uint8Array; filename?: string; contentType?: string; fileType?: FileCellType; metadata?: AttachmentMetadata; } declare class Attachment { readonly type: "attachment"; private _filePath?; private _data?; private _filename?; private _contentType?; private _fileType?; private _metadata?; constructor(options: AttachmentOptions); getData(): Promise; getFileName(): string; getContentType(): string; get fileType(): FileCellType; get metadata(): AttachmentMetadata | undefined; } interface ExternalAttachmentOptions { url: string; filename?: string; contentType?: string; fileType?: FileCellType; metadata?: AttachmentMetadata; } declare class ExternalAttachment { readonly type: "external"; private _url; private _filename?; private _contentType?; private _fileType; private _metadata?; constructor(options: ExternalAttachmentOptions); get url(): string; get filename(): string | undefined; get contentType(): string | undefined; get fileType(): FileCellType; get metadata(): AttachmentMetadata | undefined; } declare class AttachmentReference { readonly storageType: FileStorageType; readonly storageKey: string; readonly url: string | undefined; readonly fileType: FileCellType; readonly metadata?: AttachmentMetadata | undefined; constructor(storageType: FileStorageType, storageKey: string, url: string | undefined, fileType: FileCellType, metadata?: AttachmentMetadata | undefined); download(filePath?: string): Promise; getUrl(): string | undefined; toJSON(): Record; } declare function isAttachment(value: unknown): value is Attachment; declare function isExternalAttachment(value: unknown): value is ExternalAttachment; declare function isAttachmentReference(value: unknown): value is AttachmentReference; declare function isAnyAttachment(value: unknown): value is Attachment | ExternalAttachment; declare const attachment: { file: (filePath: string, options?: { filename?: string; contentType?: string; fileType?: FileCellType; metadata?: AttachmentMetadata; }) => Attachment; buffer: (data: Buffer | Uint8Array, filename: string, options?: { contentType?: string; fileType?: FileCellType; metadata?: AttachmentMetadata; }) => Attachment; url: (url: string, options?: { filename?: string; contentType?: string; fileType?: FileCellType; metadata?: AttachmentMetadata; }) => ExternalAttachment; }; declare class Row extends BaseDatasetEntity { private _data; private _deleted; constructor(client: TraceloopClient, data: RowResponse); get id(): string; get datasetId(): string; get datasetSlug(): string; get data(): RowData; get createdAt(): string; get updatedAt(): string; get deleted(): boolean; getValue(columnName: string): string | number | boolean | Date | null | object; hasColumn(columnName: string): boolean; getColumns(): string[]; update(options: RowUpdateOptions): Promise; partialUpdate(updates: Partial): Promise; delete(): Promise; toJSON(): RowData; toCSVRow(columns?: string[], delimiter?: string): string; validate(columnValidators?: { [columnName: string]: (value: any) => boolean; }): { valid: boolean; errors: string[]; }; clone(): Row; /** * Gets an attachment reference from a column * @param columnName The name of the column containing the attachment * @returns AttachmentReference if the column contains an attachment, null otherwise */ getAttachment(columnName: string): AttachmentReference | null; /** * Checks if a column contains an attachment * @param columnName The name of the column to check */ hasAttachment(columnName: string): boolean; /** * Sets/uploads an attachment to a column * @param columnSlug The slug of the column to set the attachment in * @param attachment The attachment to upload (Attachment or ExternalAttachment) * @returns The created AttachmentReference * * @example * // Upload from file * await row.setAttachment("image", new Attachment({ filePath: "./photo.jpg" })); * * @example * // Set external URL * await row.setAttachment("document", new ExternalAttachment({ url: "https://example.com/doc.pdf" })); */ setAttachment(columnSlug: string, attachment: Attachment | ExternalAttachment): Promise; /** * Downloads an attachment from a column * @param columnName The name of the column containing the attachment * @param outputPath Optional file path to save the downloaded file * @returns Buffer if no outputPath provided, void if saved to file * * @example * // Get as buffer * const data = await row.downloadAttachment("image"); * * @example * // Save to file * await row.downloadAttachment("image", "./downloaded-image.png"); */ downloadAttachment(columnName: string, outputPath?: string): Promise; } declare class Column extends BaseDatasetEntity { private _data; private _deleted; constructor(client: TraceloopClient, data: ColumnResponse); get slug(): string; get name(): string; get type(): "string" | "number" | "boolean" | "date" | "file"; get required(): boolean; get description(): string | undefined; get datasetId(): string; get datasetSlug(): string; get createdAt(): string; get updatedAt(): string; get deleted(): boolean; update(options: ColumnUpdateOptions): Promise; delete(): Promise; validateValue(value: DatasetColumnValue): boolean; convertValue(value: unknown): DatasetColumnValue; } declare class Dataset extends BaseDatasetEntity { private _data; private _deleted; private _attachmentUploader; constructor(client: TraceloopClient, data: DatasetResponse); get id(): string; get slug(): string; get name(): string; get description(): string | undefined; get version(): string | undefined; get published(): boolean; get createdAt(): string; get updatedAt(): string; get deleted(): boolean; update(options: DatasetUpdateOptions): Promise; delete(): Promise; publish(options?: DatasetPublishOptions): Promise; addColumn(columns: ColumnDefinition[]): Promise; getColumns(): Promise; addRow(rowData: RowData): Promise; addRows(rows: RowData[]): Promise; /** * Extracts attachments from rows and returns clean rows with null values */ private extractAttachments; /** * Processes attachments for created rows */ private processAttachments; private transformValuesBackToNames; getRows(limit?: number, offset?: number): Promise; fromCSV(csvContent: string, options?: CSVImportOptions): Promise; getVersions(): Promise; getVersion(version: string): Promise; private parseCSV; private parseValue; } declare class Datasets extends BaseDatasetEntity { constructor(client: TraceloopClient); create(options: DatasetCreateOptions): Promise; get(slug: string): Promise; list(): Promise; delete(slug: string): Promise; getVersionCSV(slug: string, version: string): Promise; getVersionAsJsonl(slug: string, version: string): Promise; } declare class Experiment { private client; private evaluator; private datasets; private _lastExperimentSlug?; private _lastRunId?; constructor(client: TraceloopClient); /** * Generate a unique experiment slug */ private generateExperimentSlug; private handleResponse; /** * Run an experiment with the given task function and options */ run(task: ExperimentTaskFunction, options?: ExperimentRunOptions | RunInGithubOptions): Promise; /** * Run an experiment locally (not in GitHub Actions) */ private runLocally; /** * Create a task for the experiment */ createTask(experimentSlug: string, experimentRunId: string, taskInput: Record, taskOutput: Record): Promise; /** * Initialize a new experiment */ initializeExperiment(request: InitExperimentRequest): Promise; /** * Parse JSONL string into list of {col_name: col_value} dictionaries * Skips the first line (columns definition) */ private parseJsonlToRows; /** * Get dataset rows for experiment execution */ private getDatasetRows; /** * Validate experiment run options */ private validateRunOptions; /** * Extract GitHub Actions context from environment variables */ private getGithubContext; /** * Filter evaluators that have required input fields for synonym normalization. */ private getEvaluatorsForFieldsValidation; /** * Execute tasks locally and capture results. */ private executeTasksLocally; /** * Run an experiment in GitHub Actions environment * This method executes tasks locally and submits results to the backend for evaluation */ runInGithub(task: ExperimentTaskFunction, options: RunInGithubOptions): Promise; /** * Resolve export parameters by falling back to last used values */ private resolveExportParams; /** * Export experiment results as CSV string * @param experimentSlug - Optional experiment slug (uses last run if not provided) * @param runId - Optional run ID (uses last run if not provided) * @returns CSV string of experiment results */ toCsvString(experimentSlug?: string, runId?: string): Promise; /** * Export experiment results as JSON string * @param experimentSlug - Optional experiment slug (uses last run if not provided) * @param runId - Optional run ID (uses last run if not provided) * @returns JSON string of experiment results */ toJsonString(experimentSlug?: string, runId?: string): Promise; } declare class Evaluator extends BaseDatasetEntity { constructor(client: TraceloopClient); /** * Creates a new LLM-as-a-judge custom evaluator without binding it to any project or environment. * @param options The evaluator configuration including name, messages, provider, model, and schemas * @returns The created evaluator's ID and slug * @throws Error if the API request fails * * @example * const result = await client.evaluator.create({ * name: "Quality Evaluator", * provider: "openai", * model: "gpt-4o", * messages: [ * { role: "system", content: "You are a strict quality evaluator." }, * { role: "user", content: "Evaluate: {{text}}" }, * ], * inputSchema: [{ name: "text", type: "string" }], * outputSchema: [{ name: "passed", type: "boolean" }], * }); * console.log(result.id, result.slug); */ create(options: CreateCustomEvaluatorRequest): Promise; /** * Lists all evaluators for the organization, optionally filtered by source. * @param source Optional filter — "custom" for user-created evaluators, "prebuilt" for Traceloop built-in evaluators, omit to get all * @returns Array of evaluators with their metadata and schemas * @throws Error if the API request fails or if an invalid source is provided * * @example * // Get all evaluators * const all = await client.evaluator.list(); * * @example * // Get only custom evaluators * const custom = await client.evaluator.list("custom"); */ list(source?: EvaluatorSource): Promise; /** * Retrieves the full configuration of a single evaluator by ID or slug. * @param identifier The evaluator's ID (e.g. "cmb6nr...") or slug (e.g. "my-quality-evaluator") * @returns Full evaluator details including config, provider, model, messages, and schemas * @throws Error if the evaluator is not found or if the config is missing required fields * * @example * // Get by ID * const evaluator = await client.evaluator.get("cmb6nr..."); * * @example * // Get by slug * const evaluator = await client.evaluator.get("my-quality-evaluator"); * console.log(evaluator.provider, evaluator.model); */ get(identifier: string): Promise; /** * Partially updates a custom evaluator. Only the fields you provide are changed. * To update the LLM config (provider, model, messages, etc.), pass the full config object — it replaces the existing one. * @param identifier The evaluator's ID or slug * @param patch The fields to update — all fields are optional, but at least one must be provided * @returns The updated evaluator's ID * @throws Error if the evaluator is not found, if no fields are provided, or if the API request fails * * @example * // Update name only * await client.evaluator.update("my-quality-evaluator", { name: "Updated Name" }); * * @example * // Update config and schemas * await client.evaluator.update("cmb6nr...", { * provider: "anthropic", * model: "claude-3-5-sonnet", * messages: [{ role: "user", content: "Evaluate: {{text}}" }], * inputSchema: [{ name: "text", type: "string" }], * outputSchema: [{ name: "passed", type: "boolean" }], * }); */ update(identifier: string, patch: EvaluatorUpdateRequest): Promise; /** * Runs an evaluator synchronously with the given input and returns the result. * The input keys must match the evaluator's input schema. * @param identifier The evaluator's ID or slug * @param options The execution options containing the input values * @returns The execution result shaped according to the evaluator's output schema * @throws Error if the evaluator is not found, if the input is empty, or if the API request fails * * @example * const result = await client.evaluator.run("my-quality-evaluator", { * input: { text: "The sky is blue because of Rayleigh scattering." }, * }); * console.log(result.result); // { passed: true, reason: "Factually accurate." } */ run(identifier: string, options: EvaluatorExecuteOptions): Promise; private validateIdentifier; private buildPayload; private toEvaluatorData; /** * Run evaluators on experiment task results and wait for completion */ runExperimentEvaluator(options: EvaluatorRunOptions): Promise; /** * Trigger evaluator execution without waiting for results */ triggerExperimentEvaluator(request: TriggerEvaluatorRequest): Promise; /** * Wait for execution result via stream URL (actually JSON endpoint) */ waitForResult(executionId: string, streamUrl: string): Promise; /** * Validate evaluator run options */ private validateEvaluatorOptions; /** * Create InputSchemaMapping from input object */ private createInputSchemaMapping; } /** * The main client for interacting with Traceloop's API. * This client can be used either directly or through the singleton pattern via configuration. * * @example * // Direct usage * const client = new TraceloopClient('your-api-key'); * * @example * // Through configuration (recommended) * initialize({ apiKey: 'your-api-key', appName: 'your-app' }); * const client = getClient(); */ declare class TraceloopClient { private version; appName: string; private baseUrl; private apiKey; experimentSlug?: string; userFeedback: UserFeedback; datasets: Datasets; experiment: Experiment; evaluator: Evaluator; /** * Creates a new instance of the TraceloopClient. * * @param options - Configuration options for the client */ constructor(options: TraceloopClientOptions); post(path: string, body: Record | any, signal?: AbortSignal): Promise; get(path: string, signal?: AbortSignal, extraHeaders?: Record): Promise; put(path: string, body: Record | any): Promise; patch(path: string, body: Record | any): Promise; delete(path: string): Promise; } /** * Response from the upload URL endpoint */ interface UploadUrlResponse { uploadUrl: string; storageKey: string; expiresAt?: string; method?: string; } /** * Handles attachment upload and registration operations */ declare class AttachmentUploader { private client; constructor(client: TraceloopClient); /** * Requests a presigned upload URL from the API */ getUploadUrl(datasetSlug: string, rowId: string, columnSlug: string, fileName: string, contentType: string, fileType: FileCellType, metadata?: AttachmentMetadata): Promise; /** * Uploads file data directly to S3 using the presigned URL */ uploadToS3(uploadUrl: string, data: Buffer, contentType: string): Promise; /** * Confirms the upload status with the API */ confirmUpload(datasetSlug: string, rowId: string, columnSlug: string, status: "success" | "failed", metadata?: AttachmentMetadata): Promise; /** * Registers an external URL as an attachment */ registerExternalUrl(datasetSlug: string, rowId: string, columnSlug: string, url: string, fileType: FileCellType, metadata?: AttachmentMetadata): Promise; /** * Uploads an Attachment through the full flow: * 1. Get presigned URL * 2. Upload to S3 * 3. Confirm upload */ uploadAttachment(datasetSlug: string, rowId: string, columnSlug: string, attachment: Attachment): Promise; /** * Processes an ExternalAttachment by registering the URL */ processExternalAttachment(datasetSlug: string, rowId: string, columnSlug: string, attachment: ExternalAttachment): Promise; /** * Processes any attachment type (Attachment or ExternalAttachment) */ processAnyAttachment(datasetSlug: string, rowId: string, columnSlug: string, attachmentObj: Attachment | ExternalAttachment): Promise; } interface EvaluatorSchema { slug: string; requiredInputFields: string[]; optionalConfigFields: string[]; description?: string; } type EvaluatorSlug = 'agent-efficiency' | 'agent-flow-quality' | 'agent-goal-accuracy' | 'agent-goal-completeness' | 'agent-tool-error-detector' | 'agent-tool-trajectory' | 'answer-completeness' | 'answer-correctness' | 'answer-relevancy' | 'char-count' | 'char-count-ratio' | 'context-relevance' | 'conversation-quality' | 'faithfulness' | 'html-comparison' | 'instruction-adherence' | 'intent-change' | 'json-validator' | 'perplexity' | 'pii-detector' | 'placeholder-regex' | 'profanity-detector' | 'prompt-injection' | 'prompt-perplexity' | 'regex-validator' | 'secrets-detector' | 'semantic-similarity' | 'sexism-detector' | 'sql-validator' | 'tone-detection' | 'topic-adherence' | 'toxicity-detector' | 'uncertainty-detector' | 'word-count' | 'word-count-ratio'; interface components { schemas: { "request.AgentEfficiencyRequest": { input: components["schemas"]["request.AgentEfficiencyInput"]; }; "request.AgentEfficiencyInput": { /** @example ["User found", "Email updated", "Changes saved"] */ trajectory_completions: string; /** @example ["Find user info", "Update email", "Save changes"] */ trajectory_prompts: string; }; "request.AgentFlowQualityRequest": { config: components["schemas"]["request.AgentFlowQualityConfigRequest"]; input: components["schemas"]["request.AgentFlowQualityInput"]; }; "request.AgentFlowQualityConfigRequest": { /** * @example [ * "no tools called", * "agent completed task" * ] */ conditions: string[]; /** @example 0.5 */ threshold: number; }; "request.AgentFlowQualityInput": { /** @example ["Found 5 flights", "Selected $299 flight", "Booking confirmed"] */ trajectory_completions: string; /** @example ["Search for flights", "Select the cheapest option", "Confirm booking"] */ trajectory_prompts: string; }; "request.AgentGoalAccuracyRequest": { input: components["schemas"]["request.AgentGoalAccuracyInput"]; }; "request.AgentGoalAccuracyInput": { /** @example I have booked your flight from New York to Los Angeles departing Monday at 9am. */ completion: string; /** @example Book a flight from NYC to LA for next Monday */ question: string; /** @example Flight booked: NYC to LA, Monday departure */ reference: string; }; "request.AgentGoalCompletenessRequest": { config?: components["schemas"]["request.AgentGoalCompletenessConfigRequest"]; input: components["schemas"]["request.AgentGoalCompletenessInput"]; }; "request.AgentGoalCompletenessConfigRequest": { /** @example 0.5 */ threshold: number; }; "request.AgentGoalCompletenessInput": { /** @example ["Account created", "Preferences saved", "Notifications enabled"] */ trajectory_completions: string; /** @example ["Create new account", "Set preferences", "Enable notifications"] */ trajectory_prompts: string; }; "request.AgentToolErrorDetectorRequest": { input: components["schemas"]["request.AgentToolErrorDetectorInput"]; }; "request.AgentToolErrorDetectorInput": { /** @example {"action": "search", "query": "flights to Paris"} */ tool_input: string; /** @example {"status": "success", "results": [{"flight": "AF123", "price": 450}]} */ tool_output: string; }; "request.AgentToolTrajectoryRequest": { config?: components["schemas"]["request.AgentToolTrajectoryConfigRequest"]; input: components["schemas"]["request.AgentToolTrajectoryInput"]; }; "request.AgentToolTrajectoryConfigRequest": { /** @example true */ input_params_sensitive?: boolean; /** @example false */ mismatch_sensitive?: boolean; /** @example false */ order_sensitive?: boolean; /** @example 0.5 */ threshold?: number; }; "request.AgentToolTrajectoryInput": { /** @example [{"name": "search", "input": {"query": "weather"}}] */ executed_tool_calls: string; /** @example [{"name": "search", "input": {"query": "weather"}}] */ expected_tool_calls: string; }; "request.AnswerCompletenessRequest": { input: components["schemas"]["request.AnswerCompletenessInput"]; }; "request.AnswerCompletenessInput": { /** @example Paris. */ completion: string; /** @example The capital of France is Paris. */ context: string; /** @example What is the capital of France? */ question: string; }; "request.AnswerCorrectnessRequest": { input: components["schemas"]["request.AnswerCorrectnessInput"]; }; "request.AnswerCorrectnessInput": { /** @example World War II ended in 1945. */ completion: string; /** @example 1945 */ ground_truth: string; /** @example What year did World War II end? */ question: string; }; "request.AnswerRelevancyRequest": { input: components["schemas"]["request.AnswerRelevancyInput"]; }; "request.AnswerRelevancyInput": { /** @example The capital of France is Paris. */ answer: string; /** @example What is the capital of France? */ question: string; }; "request.CharCountRequest": { input: components["schemas"]["request.CharCountInput"]; }; "request.CharCountInput": { /** @example Hello, world! This is a sample text. */ text: string; }; "request.CharCountRatioRequest": { input: components["schemas"]["request.CharCountRatioInput"]; }; "request.CharCountRatioInput": { /** @example This is a longer text for comparison */ denominator_text: string; /** @example Short text */ numerator_text: string; }; "request.ContextRelevanceRequest": { config?: components["schemas"]["request.ContextRelevanceConfigRequest"]; input: components["schemas"]["request.ContextRelevanceInput"]; }; "request.ContextRelevanceConfigRequest": { /** @example gpt-4o */ model?: string; }; "request.ContextRelevanceInput": { /** @example Our store is open Monday to Friday from 9am to 6pm, and Saturday from 10am to 4pm. We are closed on Sundays. */ completion: string; /** @example Our store is open Monday to Friday from 9am to 6pm, and Saturday from 10am to 4pm. We are closed on Sundays. */ context: string; /** @example What are the business hours? */ query: string; }; "request.ConversationQualityRequest": { input: components["schemas"]["request.ConversationQualityInput"]; }; "request.ConversationQualityInput": { /** @example ["Hi! I'd be happy to assist you today.", "We offer consulting, development, and support services."] */ completions: string; /** @example ["Hello, how can I help?", "What services do you offer?"] */ prompts: string; }; "request.FaithfulnessRequest": { input: components["schemas"]["request.FaithfulnessInput"]; }; "request.FaithfulnessInput": { /** @example The Eiffel Tower is located in Paris and was built in 1889. */ completion: string; /** @example The Eiffel Tower is a wrought-iron lattice tower on the Champ de Mars in Paris, France. It was constructed from 1887 to 1889. */ context: string; /** @example When was the Eiffel Tower built? */ question: string; }; "request.HtmlComparisonRequest": { input: components["schemas"]["request.HtmlComparisonInput"]; }; "request.HtmlComparisonInput": { /** @example

Hello, world!

*/ html1: string; /** @example

Hello, world!

*/ html2: string; }; "request.InstructionAdherenceRequest": { input: components["schemas"]["request.InstructionAdherenceInput"]; }; "request.InstructionAdherenceInput": { /** @example Respond in exactly 3 bullet points and use formal language. */ instructions: string; /** * @example - First point about the topic * - Second relevant consideration * - Final concluding thought */ response: string; }; "request.IntentChangeRequest": { input: components["schemas"]["request.IntentChangeInput"]; }; "request.IntentChangeInput": { /** @example ["Sure, I can help with hotel booking", "No problem, let me search for flights"] */ completions: string; /** @example ["I want to book a hotel", "Actually, I need a flight instead"] */ prompts: string; }; "request.JSONValidatorRequest": { config?: components["schemas"]["request.JSONValidatorConfigRequest"]; input: components["schemas"]["request.JSONValidatorInput"]; }; "request.JSONValidatorConfigRequest": { /** @example true */ enable_schema_validation?: boolean; /** @example {} */ schema_string?: string; }; "request.JSONValidatorInput": { /** @example {"name": "John", "age": 30} */ text: string; }; "request.PerplexityRequest": { input: components["schemas"]["request.PerplexityInput"]; }; "request.PerplexityInput": { /** @example [-2.3, -1.5, -0.8, -1.2, -0.5] */ logprobs: string; }; "request.PIIDetectorRequest": { config?: components["schemas"]["request.PIIDetectorConfigRequest"]; input: components["schemas"]["request.PIIDetectorInput"]; }; "request.PIIDetectorConfigRequest": { /** @example 0.8 */ probability_threshold?: number; }; "request.PIIDetectorInput": { /** @example Please contact John Smith at john.smith@email.com or call 555-123-4567. */ text: string; }; "request.PlaceholderRegexRequest": { config?: components["schemas"]["request.PlaceholderRegexConfigRequest"]; input: components["schemas"]["request.PlaceholderRegexInput"]; }; "request.PlaceholderRegexConfigRequest": { /** @example true */ case_sensitive?: boolean; /** @example true */ dot_include_nl?: boolean; /** @example true */ multi_line?: boolean; /** @example true */ should_match?: boolean; }; "request.PlaceholderRegexInput": { /** @example name */ placeholder_name: string; /** @example Hello ${name} */ placeholder_value: string; /** @example Hello John Doe */ text: string; }; "request.ProfanityDetectorRequest": { input: components["schemas"]["request.ProfanityDetectorInput"]; }; "request.ProfanityDetectorInput": { /** @example This is a clean and professional message. */ text: string; }; "request.PromptInjectionRequest": { config?: components["schemas"]["request.PromptInjectionConfigRequest"]; input: components["schemas"]["request.PromptInjectionInput"]; }; "request.PromptInjectionConfigRequest": { /** @example 0.5 */ threshold?: number; }; "request.PromptInjectionInput": { /** @example What is the weather like today? */ prompt: string; }; "request.PromptPerplexityRequest": { input: components["schemas"]["request.PromptPerplexityInput"]; }; "request.PromptPerplexityInput": { /** @example What is the capital of France? */ prompt: string; }; "request.RegexValidatorRequest": { config?: components["schemas"]["request.RegexValidatorConfigRequest"]; input: components["schemas"]["request.RegexValidatorInput"]; }; "request.RegexValidatorConfigRequest": { /** @example true */ case_sensitive?: boolean; /** @example true */ dot_include_nl?: boolean; /** @example true */ multi_line?: boolean; /** @example .* */ regex?: string; /** @example true */ should_match?: boolean; }; "request.RegexValidatorInput": { /** @example user@example.com */ text: string; }; "request.SecretsDetectorRequest": { input: components["schemas"]["request.SecretsDetectorInput"]; }; "request.SecretsDetectorInput": { /** @example Here is some text without any API keys or passwords. */ text: string; }; "request.SemanticSimilarityRequest": { input: components["schemas"]["request.SemanticSimilarityInput"]; }; "request.SemanticSimilarityInput": { /** @example The cat sat on the mat. */ completion: string; /** @example A feline was resting on the rug. */ reference: string; }; "request.SexismDetectorRequest": { config?: components["schemas"]["request.SexismDetectorConfigRequest"]; input: components["schemas"]["request.SexismDetectorInput"]; }; "request.SexismDetectorConfigRequest": { /** @example 0.5 */ threshold?: number; }; "request.SexismDetectorInput": { /** @example All team members should be treated equally regardless of gender. */ text: string; }; "request.SQLValidatorRequest": { input: components["schemas"]["request.SQLValidatorInput"]; }; "request.SQLValidatorInput": { /** @example SELECT * FROM users WHERE id = 1; */ text: string; }; "request.ToneDetectionRequest": { input: components["schemas"]["request.ToneDetectionInput"]; }; "request.ToneDetectionInput": { /** @example The capital of France is Paris. */ text: string; }; "request.TopicAdherenceRequest": { input: components["schemas"]["request.TopicAdherenceInput"]; }; "request.TopicAdherenceInput": { /** @example Machine learning is a subset of AI that enables systems to learn from data. */ completion: string; /** @example Tell me about machine learning */ question: string; /** @example artificial intelligence, data science, algorithms */ reference_topics: string; }; "request.ToxicityDetectorRequest": { config?: components["schemas"]["request.ToxicityDetectorConfigRequest"]; input: components["schemas"]["request.ToxicityDetectorInput"]; }; "request.ToxicityDetectorConfigRequest": { /** @example 0.5 */ threshold?: number; }; "request.ToxicityDetectorInput": { /** @example Thank you for your help with this project. */ text: string; }; "request.UncertaintyDetectorRequest": { input: components["schemas"]["request.UncertaintyDetectorInput"]; }; "request.UncertaintyDetectorInput": { /** @example I am not sure, I think the capital of France is Paris. */ prompt: string; }; "request.WordCountRequest": { input: components["schemas"]["request.WordCountInput"]; }; "request.WordCountInput": { /** @example This is a sample text with several words. */ text: string; }; "request.WordCountRatioRequest": { input: components["schemas"]["request.WordCountRatioInput"]; }; "request.WordCountRatioInput": { /** @example This is a longer input text for comparison */ denominator_text: string; /** @example Short response */ numerator_text: string; }; }; responses: never; parameters: never; requestBodies: never; headers: never; pathItems: never; } type AgentFlowQualityConfig = components['schemas']['request.AgentFlowQualityRequest']['config']; type AgentGoalCompletenessConfig = components['schemas']['request.AgentGoalCompletenessRequest']['config']; type AgentToolTrajectoryConfig = components['schemas']['request.AgentToolTrajectoryRequest']['config']; type ContextRelevanceConfig = components['schemas']['request.ContextRelevanceRequest']['config']; type JsonValidatorConfig = components['schemas']['request.JSONValidatorRequest']['config']; type PiiDetectorConfig = components['schemas']['request.PIIDetectorRequest']['config']; type PlaceholderRegexConfig = components['schemas']['request.PlaceholderRegexRequest']['config']; type PromptInjectionConfig = components['schemas']['request.PromptInjectionRequest']['config']; type RegexValidatorConfig = components['schemas']['request.RegexValidatorRequest']['config']; type SexismDetectorConfig = components['schemas']['request.SexismDetectorRequest']['config']; type ToxicityDetectorConfig = components['schemas']['request.ToxicityDetectorRequest']['config']; /** * Create an evaluator configuration object. */ declare function createEvaluator(slug: EvaluatorSlug, options?: { version?: string; config?: Record; }): EvaluatorWithConfig; /** * Validate that required input fields are present in task output. */ declare function validateEvaluatorInput(slug: EvaluatorSlug, taskOutput: Record): { valid: boolean; missingFields: string[]; }; /** * Get all available evaluator slugs. */ declare function getAvailableEvaluatorSlugs(): EvaluatorSlug[]; /** * Get schema information for an evaluator. */ declare function getEvaluatorSchemaInfo(slug: EvaluatorSlug): EvaluatorSchema | undefined; /** * Factory class for creating type-safe MBT evaluator configurations. * * @example * ```typescript * import { EvaluatorMadeByTraceloop } from '@traceloop/node-server-sdk'; * * const evaluators = [ * EvaluatorMadeByTraceloop.piiDetector({ probability_threshold: 0.8 }), * EvaluatorMadeByTraceloop.faithfulness(), * ]; * ``` */ declare class EvaluatorMadeByTraceloop { static create(slug: EvaluatorSlug, options?: { version?: string; config?: Record; }): EvaluatorWithConfig; static getAvailableSlugs(): EvaluatorSlug[]; static isValidSlug(slug: string): slug is EvaluatorSlug; /** * Evaluate agent efficiency - detect redundant calls, unnecessary follow-ups **Request Body:** - `input.trajectory_prompts` (string, required): JSON array of prompts in the agent trajectory - `input.trajectory_completions` (string, required): JSON array of completions in the agent trajectory * Required task output fields: trajectory_completions, trajectory_prompts */ static agentEfficiency(): EvaluatorWithConfig; /** * Validate agent trajectory against user-defined conditions **Request Body:** - `input.trajectory_prompts` (string, required): JSON array of prompts in the agent trajectory - `input.trajectory_completions` (string, required): JSON array of completions in the agent trajectory - `config.conditions` (array of strings, required): Array of evaluation conditions/rules to validate against - `config.threshold` (number, required): Score threshold for pass/fail determination (0.0-1.0) * Required task output fields: trajectory_completions, trajectory_prompts */ static agentFlowQuality(config?: AgentFlowQualityConfig): EvaluatorWithConfig; /** * Evaluate agent goal accuracy **Request Body:** - `input.question` (string, required): The original question or goal - `input.completion` (string, required): The agent's completion/response - `input.reference` (string, required): The expected reference answer * Required task output fields: completion, question, reference */ static agentGoalAccuracy(): EvaluatorWithConfig; /** * Measure if agent accomplished all user goals **Request Body:** - `input.trajectory_prompts` (string, required): JSON array of prompts in the agent trajectory - `input.trajectory_completions` (string, required): JSON array of completions in the agent trajectory - `config.threshold` (number, required): Score threshold for pass/fail determination (0.0-1.0) * Required task output fields: trajectory_completions, trajectory_prompts */ static agentGoalCompleteness(config?: AgentGoalCompletenessConfig): EvaluatorWithConfig; /** * Detect errors or failures during tool execution **Request Body:** - `input.tool_input` (string, required): JSON string of the tool input - `input.tool_output` (string, required): JSON string of the tool output * Required task output fields: tool_input, tool_output */ static agentToolErrorDetector(): EvaluatorWithConfig; /** * Compare actual tool calls against expected reference tool calls **Request Body:** - `input.executed_tool_calls` (string, required): JSON array of actual tool calls made by the agent - `input.expected_tool_calls` (string, required): JSON array of expected/reference tool calls - `config.threshold` (float, optional): Score threshold for pass/fail determination (default: 0.5) - `config.mismatch_sensitive` (bool, optional): Whether tool calls must match exactly (default: false) - `config.order_sensitive` (bool, optional): Whether order of tool calls matters (default: false) - `config.input_params_sensitive` (bool, optional): Whether to compare input parameters (default: true) * Required task output fields: executed_tool_calls, expected_tool_calls */ static agentToolTrajectory(config?: AgentToolTrajectoryConfig): EvaluatorWithConfig; /** * Evaluate whether the answer is complete and contains all the necessary information **Request Body:** - `input.question` (string, required): The original question - `input.completion` (string, required): The completion to evaluate for completeness - `input.context` (string, required): The context that provides the complete information * Required task output fields: completion, context, question */ static answerCompleteness(): EvaluatorWithConfig; /** * Evaluate factual accuracy by comparing answers against ground truth **Request Body:** - `input.question` (string, required): The original question - `input.completion` (string, required): The completion to evaluate - `input.ground_truth` (string, required): The expected correct answer * Required task output fields: completion, ground_truth, question */ static answerCorrectness(): EvaluatorWithConfig; /** * Check if an answer is relevant to a question **Request Body:** - `input.answer` (string, required): The answer to evaluate for relevancy - `input.question` (string, required): The question that the answer should be relevant to * Required task output fields: answer, question */ static answerRelevancy(): EvaluatorWithConfig; /** * Count the number of characters in text **Request Body:** - `input.text` (string, required): The text to count characters in * Required task output fields: text */ static charCount(): EvaluatorWithConfig; /** * Calculate the ratio of characters between two texts **Request Body:** - `input.numerator_text` (string, required): The numerator text (will be divided by denominator) - `input.denominator_text` (string, required): The denominator text (divides the numerator) * Required task output fields: denominator_text, numerator_text */ static charCountRatio(): EvaluatorWithConfig; /** * Evaluate whether retrieved context contains sufficient information to answer the query **Request Body:** - `input.query` (string, required): The query/question to evaluate context relevance for - `input.completion` (string, required): The completion to evaluate for context relevance - `input.context` (string, required): The context to evaluate for relevance to the query - `config.model` (string, optional): Model to use for evaluation (default: gpt-4o) * Required task output fields: completion, context, query */ static contextRelevance(config?: ContextRelevanceConfig): EvaluatorWithConfig; /** * Evaluate conversation quality based on tone, clarity, flow, responsiveness, and transparency **Request Body:** - `input.prompts` (string, required): JSON array of prompts in the conversation - `input.completions` (string, required): JSON array of completions in the conversation * Required task output fields: completions, prompts */ static conversationQuality(): EvaluatorWithConfig; /** * Check if a completion is faithful to the provided context **Request Body:** - `input.completion` (string, required): The LLM completion to check for faithfulness - `input.context` (string, required): The context that the completion should be faithful to - `input.question` (string, required): The original question asked * Required task output fields: completion, context, question */ static faithfulness(): EvaluatorWithConfig; /** * Compare two HTML documents for structural and content similarity **Request Body:** - `input.html1` (string, required): The first HTML document to compare - `input.html2` (string, required): The second HTML document to compare * Required task output fields: html1, html2 */ static htmlComparison(): EvaluatorWithConfig; /** * Evaluate how well responses follow given instructions **Request Body:** - `input.instructions` (string, required): The instructions that should be followed - `input.response` (string, required): The response to evaluate for instruction adherence * Required task output fields: instructions, response */ static instructionAdherence(): EvaluatorWithConfig; /** * Detect changes in user intent between prompts and completions **Request Body:** - `input.prompts` (string, required): JSON array of prompts in the conversation - `input.completions` (string, required): JSON array of completions in the conversation * Required task output fields: completions, prompts */ static intentChange(): EvaluatorWithConfig; /** * Validate JSON syntax **Request Body:** - `input.text` (string, required): The text to validate as JSON - `config.enable_schema_validation` (bool, optional): Enable JSON schema validation - `config.schema_string` (string, optional): JSON schema to validate against * Required task output fields: text */ static jsonValidator(config?: JsonValidatorConfig): EvaluatorWithConfig; /** * Measure text perplexity from logprobs **Request Body:** - `input.logprobs` (string, required): JSON array of log probabilities from the model * Required task output fields: logprobs */ static perplexity(): EvaluatorWithConfig; /** * Detect personally identifiable information in text **Request Body:** - `input.text` (string, required): The text to scan for personally identifiable information - `config.probability_threshold` (float, optional): Detection threshold (default: 0.8) * Required task output fields: text */ static piiDetector(config?: PiiDetectorConfig): EvaluatorWithConfig; /** * Validate text against a placeholder regex pattern **Request Body:** - `input.placeholder_name` (string, required): The name of the placeholder to substitute - `input.placeholder_value` (string, required): The value to substitute into the regex placeholder - `input.text` (string, required): The text to validate against the regex pattern - `config.should_match` (bool, optional): Whether the text should match the regex - `config.case_sensitive` (bool, optional): Case-sensitive matching - `config.dot_include_nl` (bool, optional): Dot matches newlines - `config.multi_line` (bool, optional): Multi-line mode * Required task output fields: placeholder_name, placeholder_value, text */ static placeholderRegex(config?: PlaceholderRegexConfig): EvaluatorWithConfig; /** * Detect profanity in text **Request Body:** - `input.text` (string, required): The text to scan for profanity * Required task output fields: text */ static profanityDetector(): EvaluatorWithConfig; /** * Detect prompt injection attempts **Request Body:** - `input.prompt` (string, required): The prompt to check for injection attempts - `config.threshold` (float, optional): Detection threshold (default: 0.5) * Required task output fields: prompt */ static promptInjection(config?: PromptInjectionConfig): EvaluatorWithConfig; /** * Measure prompt perplexity to detect potential injection attempts **Request Body:** - `input.prompt` (string, required): The prompt to calculate perplexity for * Required task output fields: prompt */ static promptPerplexity(): EvaluatorWithConfig; /** * Validate text against a regex pattern **Request Body:** - `input.text` (string, required): The text to validate against a regex pattern - `config.regex` (string, optional): The regex pattern to match against - `config.should_match` (bool, optional): Whether the text should match the regex - `config.case_sensitive` (bool, optional): Case-sensitive matching - `config.dot_include_nl` (bool, optional): Dot matches newlines - `config.multi_line` (bool, optional): Multi-line mode * Required task output fields: text */ static regexValidator(config?: RegexValidatorConfig): EvaluatorWithConfig; /** * Detect secrets and credentials in text **Request Body:** - `input.text` (string, required): The text to scan for secrets (API keys, passwords, etc.) * Required task output fields: text */ static secretsDetector(): EvaluatorWithConfig; /** * Calculate semantic similarity between completion and reference **Request Body:** - `input.completion` (string, required): The completion text to compare - `input.reference` (string, required): The reference text to compare against * Required task output fields: completion, reference */ static semanticSimilarity(): EvaluatorWithConfig; /** * Detect sexist language and bias **Request Body:** - `input.text` (string, required): The text to scan for sexist content - `config.threshold` (float, optional): Detection threshold (default: 0.5) * Required task output fields: text */ static sexismDetector(config?: SexismDetectorConfig): EvaluatorWithConfig; /** * Validate SQL query syntax **Request Body:** - `input.text` (string, required): The text to validate as SQL * Required task output fields: text */ static sqlValidator(): EvaluatorWithConfig; /** * Detect the tone of the text **Request Body:** - `input.text` (string, required): The text to detect the tone of * Required task output fields: text */ static toneDetection(): EvaluatorWithConfig; /** * Evaluate topic adherence **Request Body:** - `input.question` (string, required): The original question - `input.completion` (string, required): The completion to evaluate - `input.reference_topics` (string, required): Comma-separated list of expected topics * Required task output fields: completion, question, reference_topics */ static topicAdherence(): EvaluatorWithConfig; /** * Detect toxic or harmful language **Request Body:** - `input.text` (string, required): The text to scan for toxic content - `config.threshold` (float, optional): Detection threshold (default: 0.5) * Required task output fields: text */ static toxicityDetector(config?: ToxicityDetectorConfig): EvaluatorWithConfig; /** * Detect uncertainty in the text **Request Body:** - `input.prompt` (string, required): The text to detect uncertainty in * Required task output fields: prompt */ static uncertaintyDetector(): EvaluatorWithConfig; /** * Count the number of words in text **Request Body:** - `input.text` (string, required): The text to count words in * Required task output fields: text */ static wordCount(): EvaluatorWithConfig; /** * Calculate the ratio of words between two texts **Request Body:** - `input.numerator_text` (string, required): The numerator text (will be divided by denominator) - `input.denominator_text` (string, required): The denominator text (divides the numerator) * Required task output fields: denominator_text, numerator_text */ static wordCountRatio(): EvaluatorWithConfig; } /** * Initializes the Traceloop SDK and creates a singleton client instance if API key is provided. * Must be called once before any other SDK methods. * * @param options - The options to initialize the SDK. See the {@link InitializeOptions} for details. * @returns TraceloopClient - The singleton client instance if API key is provided, otherwise undefined. * @throws {InitializationError} if the configuration is invalid or if failed to fetch feature data. * * @example * ```typescript * initialize({ * apiKey: 'your-api-key', * appName: 'your-app', * }); * ``` */ declare const initialize: (options?: InitializeOptions) => TraceloopClient | undefined; /** * Gets the singleton instance of the TraceloopClient. * The SDK must be initialized with an API key before calling this function. * * @returns The TraceloopClient singleton instance * @throws {Error} if the SDK hasn't been initialized or was initialized without an API key * * @example * ```typescript * const client = getClient(); * await client.annotation.create({ annotationTask: 'taskId', entityInstanceId: 'entityId', tags: { score: 0.9 } }); * ``` */ declare const getClient: () => TraceloopClient; declare const forceFlush: () => Promise; declare const getTraceloopTracer: () => _opentelemetry_api.Tracer; type DecoratorConfig = { name: string; version?: number; associationProperties?: { [name: string]: string; }; conversationId?: string; traceContent?: boolean; inputParameters?: unknown[]; suppressTracing?: boolean; }; declare function withWorkflow ReturnType>(config: DecoratorConfig, fn: F, ...args: A): Promise; declare function withTask ReturnType>(config: DecoratorConfig, fn: F, ...args: A): Promise; declare function withAgent ReturnType>(config: DecoratorConfig, fn: F, ...args: A): Promise; declare function withTool ReturnType>(config: DecoratorConfig, fn: F, ...args: A): Promise; declare function workflow(config: Partial | ((thisArg: unknown, ...funcArgs: unknown[]) => Partial)): (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => void; declare function task(config: Partial | ((thisArg: unknown, ...funcArgs: unknown[]) => Partial)): (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => void; declare function agent(config: Partial | ((thisArg: unknown, ...funcArgs: unknown[]) => Partial)): (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => void; declare function tool(config: Partial | ((thisArg: unknown, ...funcArgs: unknown[]) => Partial)): (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => void; declare function withConversation ReturnType>(conversationId: string, fn: F, thisArg?: ThisParameterType, ...args: A): Promise; declare function conversation(conversationId: string | ((thisArg: unknown, ...funcArgs: unknown[]) => string)): (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => void; type VectorDBCallConfig = { vendor: string; type: "query" | "upsert" | "delete"; }; type LLMCallConfig = { vendor: string; type: "chat" | "completion"; }; declare class VectorSpan { private span; constructor(span: Span); reportQuery({ queryVector }: { queryVector: number[]; }): void; reportResults({ results, }: { results: { ids?: string; scores?: number; distances?: number; metadata?: Record; vectors?: number[]; documents?: string; }[]; }): void; } declare class LLMSpan { private span; constructor(span: Span); reportRequest({ model, messages, }: { model: string; messages: { role: string; content?: string | unknown; }[]; }): void; reportResponse({ model, usage, completions, }: { model: string; usage?: { prompt_tokens: number; completion_tokens: number; total_tokens: number; }; completions?: { finish_reason: string; message: { role: "system" | "user" | "assistant"; content: string | null; }; }[]; }): void; } declare function withVectorDBCall ReturnType>({ vendor, type }: VectorDBCallConfig, fn: F, thisArg?: ThisParameterType): Promise | ReturnType; declare function withLLMCall ReturnType>({ vendor, type }: LLMCallConfig, fn: F, thisArg?: ThisParameterType): Promise | ReturnType; declare function withAssociationProperties ReturnType>(properties: { [name: string]: string; }, fn: F, thisArg?: ThisParameterType, ...args: A): ReturnType; /** * Reports a custom metric to the current active span. * * This function allows you to add a custom metric to the current span in the trace. * If there is no active span, a warning will be logged. * * @param {string} metricName - The name of the custom metric. * @param {number} metricValue - The numeric value of the custom metric. * * @example * reportCustomMetric('processing_time', 150); */ declare const reportCustomMetric: (metricName: string, metricValue: number) => void; declare const ALL_INSTRUMENTATION_LIBRARIES: "all"; type AllInstrumentationLibraries = typeof ALL_INSTRUMENTATION_LIBRARIES; interface SpanProcessorOptions { /** * The API Key for sending traces data. Optional. * Defaults to the TRACELOOP_API_KEY environment variable. */ apiKey?: string; /** * The OTLP endpoint for sending traces data. Optional. * Defaults to TRACELOOP_BASE_URL environment variable or https://api.traceloop.com/ */ baseUrl?: string; /** * Sends traces and spans without batching, for local development. Optional. * Defaults to false. */ disableBatch?: boolean; /** * The OpenTelemetry SpanExporter to be used for sending traces data. Optional. * Defaults to the OTLP exporter. */ exporter?: SpanExporter; /** * The headers to be sent with the traces data. Optional. */ headers?: Record; /** * The instrumentation libraries to be allowed in the traces. Optional. * Defaults to Traceloop instrumentation libraries. * If set to ALL_INSTRUMENTATION_LIBRARIES, all instrumentation libraries will be allowed. * If set to an array of instrumentation libraries, only traceloop instrumentation libraries and the specified instrumentation libraries will be allowed. */ allowedInstrumentationLibraries?: string[] | AllInstrumentationLibraries; } /** * Creates a span processor with Traceloop's custom span handling logic. * This can be used independently of the full SDK initialization. * * @param options - Configuration options for the span processor * @returns A configured SpanProcessor instance */ declare const createSpanProcessor: (options: SpanProcessorOptions) => SpanProcessor$1; declare const traceloopInstrumentationLibraries: string[]; /** * Returns true once SDK prompt registry has been initialized, else rejects with an error. * @returns Promise */ declare const waitForInitialization: () => Promise; declare const getPrompt: (key: string, variables: Record) => any; /** * Core Guard type — any async function that takes a dict input and returns a boolean * or a GuardCallResult (pre-built guards return the raw API response alongside the bool). * * TInput declares the shape of the input dict this guard expects. * Defaults to Record (untyped) for simple guards and custom guards. * Complex pre-built guards (e.g. semanticSimilarityGuard) use a specific TInput so * TypeScript can enforce that a matching inputMapper is provided at the call site. */ type Guard = Record> = ((input: TInput) => Promise) & { guardName?: string; }; /** * Maps the LLM function output to one guard input per guard. * Can return a list (index-matched to guards) or a dict (keyed by guard name). * * TOutput — the type of the LLM output being mapped (defaults to string | object). * TInput — the shape each guard expects as input (defaults to Record). */ type InputMapper = string | Record, TInput extends Record = Record> = (output: TOutput, numGuards: number) => TInput[] | Record; /** Input required by semanticSimilarityGuard. */ type SemanticSimilarityInput = { text: string; reference: string; }; /** Input required by instructionAdherenceGuard. */ type InstructionAdherenceInput = { instructions: string; response: string; }; /** Input required by uncertaintyGuard. */ type UncertaintyInput = { prompt: string; completion: string; }; /** * Passed to on_failure handlers when a guard fails. */ interface GuardedResult { result: string | Record; guardInputs: Record[]; } /** * The result of a single guard's execution. */ interface GuardResult { name: string; passed: boolean; duration: number; /** Raw API response fields, e.g. { similarity_score: 0.12 } or { is_safe: false }. */ output?: Record; } /** * Internal return type for pre-built guards that want to carry the raw API * response alongside the pass/fail boolean. Custom user guards still return * plain `boolean` — _runSingleGuard accepts both via a union check. */ interface GuardCallResult { passed: boolean; output: Record; } declare class FailFastGuardResult { readonly index: number; readonly name: string; readonly passed: false; readonly duration: number; readonly output?: Record | undefined; constructor(index: number, name: string, passed: false, duration: number, output?: Record | undefined); } declare class GuardrailError extends TraceloopError { constructor(message: string); } declare class GuardValidationError extends GuardrailError { output: GuardedResult; constructor(output: GuardedResult, message?: string); } declare class GuardExecutionError extends GuardrailError { originalException: Error; guardInput: Record; guardIndex: number; constructor(originalException: Error, guardInput: Record, guardIndex: number); } declare class GuardInputTypeError extends GuardrailError { guardIndex: number; expectedType: string; actualType: string; constructor(guardIndex: number, expectedType: string, actualType: string); } type ConditionValue = string | number | boolean | null | undefined; /** * Predicate factory functions for use as guard conditions. * Each returns a (value: ConditionValue) => boolean function. */ /** Pass only if value is strictly true (boolean). */ declare function isTrue(): (v: ConditionValue) => boolean; /** Pass only if value is strictly false (boolean). */ declare function isFalse(): (v: ConditionValue) => boolean; /** Pass if value is truthy (loose). */ declare function isTruthy(): (v: ConditionValue) => boolean; /** Pass if value is falsy (loose). */ declare function isFalsy(): (v: ConditionValue) => boolean; /** Pass if value > n. Returns false for non-numbers. */ declare function gt(n: number): (v: ConditionValue) => boolean; /** Pass if value < n. Returns false for non-numbers. */ declare function lt(n: number): (v: ConditionValue) => boolean; /** Pass if value >= n. Returns false for non-numbers. */ declare function gte(n: number): (v: ConditionValue) => boolean; /** Pass if value <= n. Returns false for non-numbers. */ declare function lte(n: number): (v: ConditionValue) => boolean; /** Pass if min <= value <= max (inclusive). Returns false for non-numbers. */ declare function between(min: number, max: number): (v: ConditionValue) => boolean; /** Pass if value === expected (strict equality). */ declare function eq(expected: ConditionValue): (v: ConditionValue) => boolean; type OnFailureHandler = (output: GuardedResult) => string | Record; /** * Built-in failure strategy factories. */ declare const OnFailure: { /** Throw a GuardValidationError (or custom exception). Default behavior. */ readonly raiseException: (message?: string) => OnFailureHandler; /** Log a warning and return the original result unchanged. */ readonly log: (level?: "error" | "warn", message?: string) => OnFailureHandler; /** Silently return the original result (shadow/observe mode). */ readonly noop: () => OnFailureHandler; /** Return a fixed fallback value instead of the original result. */ readonly returnValue: (value: string | Record) => OnFailureHandler; }; /** * Resolve a string shorthand or callable to an OnFailureHandler. * * - "raise" → OnFailure.raiseException() * - "log" → OnFailure.log() * - "ignore" / "noop" → OnFailure.noop() * - any other string → OnFailure.returnValue(string) * - callable → used as-is */ declare function resolveOnFailure(value: string | OnFailureHandler): OnFailureHandler; /** * Creates a default input mapper that converts LLM output to guard inputs. * * - string output → { text, prompt, completion } replicated per guard * - plain object output → enriched with synonym aliases * - anything else → throws (user must provide a custom inputMapper) */ declare function defaultInputMapper(output: string | Record, numGuards: number): Record[]; /** * Resolve guard inputs from either a custom inputMapper or the default mapper. * Handles both list form (index-matched) and dict form (keyed by guard name). */ declare function resolveGuardInputs(output: string | Record, numGuards: number, guardNames: string[], inputMapper?: InputMapper): Record[]; interface PrebuiltGuardOptions { /** Override the default pass/fail condition. Default: isTrue() */ condition?: (v: ConditionValue) => boolean; /** Maximum time to wait for the evaluator API response in ms. Default: 60000 */ timeoutMs?: number; /** Evaluator-specific configuration (e.g. threshold). */ config?: Record; } declare function toxicityGuard(options?: PrebuiltGuardOptions): Guard; declare function piiGuard(options?: PrebuiltGuardOptions): Guard; declare function secretsGuard(options?: PrebuiltGuardOptions): Guard; declare function promptInjectionGuard(options?: PrebuiltGuardOptions): Guard; declare function profanityGuard(options?: PrebuiltGuardOptions): Guard; declare function sexismGuard(options?: PrebuiltGuardOptions): Guard; declare function jsonValidatorGuard(options?: PrebuiltGuardOptions): Guard; declare function sqlValidatorGuard(options?: PrebuiltGuardOptions): Guard; declare function regexValidatorGuard(options?: PrebuiltGuardOptions): Guard; declare function instructionAdherenceGuard(options?: PrebuiltGuardOptions): Guard; declare function semanticSimilarityGuard(options?: PrebuiltGuardOptions): Guard; declare function promptPerplexityGuard(options?: PrebuiltGuardOptions): Guard>; declare function uncertaintyGuard(options?: PrebuiltGuardOptions): Guard; declare function toneDetectionGuard(options?: PrebuiltGuardOptions): Guard>; interface CustomEvaluatorGuardOptions { evaluatorVersion?: string; evaluatorConfig?: Record; /** Which field in result to check. Default: "pass" */ conditionField?: string; /** Override the default condition. Default: isTrue() */ condition?: (v: ConditionValue) => boolean; /** Maximum time to wait for result in ms. Default: 60000 */ timeoutMs?: number; } /** * Guard backed by a user-defined evaluator on the Traceloop platform. * Calls POST /v2/evaluators/{slug}/executions and polls for the result. */ declare function customEvaluatorGuard(slug: string, options?: CustomEvaluatorGuardOptions): Guard; interface GuardrailsOptions { /** * Called when any guard returns false. Can be: * - `"raise"`: Throw GuardValidationError (default) * - `"log"`: Log a warning and return the original result * - `"ignore"`: Return the original result silently (shadow/observe mode) * - Any other string: Return that string as a fallback value * - Callable: Custom OnFailureHandler receiving a GuardedResult */ onFailure?: string | OnFailureHandler; /** * If true, run all guards before handling failures. * If false (default), stop at the first failure (fail-fast). */ runAll?: boolean; /** * If true (default), run guards in parallel for lower latency. * If false, run guards sequentially — useful when guard order matters. */ parallel?: boolean; /** * Maps the guarded function's output to one input dict per guard. * Use this when the output is a structured object and different guards * need different fields. If omitted, the default mapper handles strings * and plain objects automatically. */ inputMapper?: InputMapper; } interface GuardOptions { onFailure?: string | OnFailureHandler; parallel?: boolean; inputMapper?: InputMapper; } interface ValidateOptions { parallel?: boolean; inputMapper?: InputMapper; } interface ValidateResult { passed: boolean; results: GuardResult[]; } /** * Full-control guardrail runner with a fluent builder API. * * @param guards - Guard functions to run. Each receives its corresponding input dict * and returns a boolean: true = pass, false = fail. * @param options - Optional configuration (onFailure, name, runAll, parallel, inputMapper). * * @example * const g = new Guardrails([toxicityGuard(), piiGuard()], { name: "safety", onFailure: "log" }) * .parallel() * .runAll(); * * const result = await g.run(async () => callLLM(prompt)); */ declare class Guardrails { private readonly guards; private readonly _onFailure; private readonly _runAll; private readonly _parallel; private readonly _inputMapper?; constructor(guards: Guard[], options?: GuardrailsOptions); parallel(): Guardrails; sequential(): Guardrails; runAll(): Guardrails; failFast(): Guardrails; raiseOnFailure(): Guardrails; logOnFailure(): Guardrails; ignoreOnFailure(): Guardrails; onFailure(handler: string | OnFailureHandler): Guardrails; private _clone; /** * Runs an async function (typically an LLM call), then evaluates its output * through all configured guards. * * The LLM function runs first and its result is captured. Guards then evaluate * that result. If any guard fails, the configured `onFailure` handler is invoked. * If a guard throws a real error (network failure, API error), a * `GuardExecutionError` is thrown regardless of `onFailure`. * * @param fn - The async function to run (e.g. your LLM call). Its return value * is passed to the guards as input. * @param args - Arguments forwarded to `fn`. * @returns The original return value of `fn` if all guards pass, or the * `onFailure` handler's return value if any guard fails. * * @example * const result = await g.run( * async (prompt) => openai.chat.completions.create(...), * userPrompt, * ); */ run(fn: (...args: unknown[]) => Promise, ...args: unknown[]): Promise>; /** * Runs guards directly against pre-mapped inputs without wrapping an async function. * * Use this when you already have the guard inputs constructed — for example when * using sequential/failFast execution and you want to pass specific field values * to each guard rather than relying on automatic mapping. * * Unlike the standalone `validate()` function, this method does NOT do any input * mapping — you are responsible for providing one input dict per guard in the * correct order. * * @param guardInputs - Array of input dicts, one per guard, in the same order as * the guards passed to the constructor. * @returns Per-guard results: `[{ name, passed, duration }, ...]` * * @example * // Check a user prompt for injection before calling the LLM * const g = new Guardrails([promptInjectionGuard(), piiGuard()]); * const results = await g.validate([ * { prompt: userPrompt }, * { text: userPrompt }, * ]); * if (results.every(r => r.passed)) { * const response = await callLLM(userPrompt); * } */ validate(guardInputs: Record[]): Promise; private _executeGuards; private _runSingleGuard; } /** * Wraps an async function with guardrails. Returns a new function with the same signature. * * @example * const safeGenerate = guard(generateResponse, [toxicityGuard(), piiGuard()], { * onFailure: "Sorry, blocked by content policy.", * }); * const result = await safeGenerate("Tell me a joke"); */ declare function guard(fn: (...args: A) => Promise, guards: Guard[], options?: GuardOptions): (...args: A) => Promise>; /** * Validates a string or object against a set of guards without wrapping a function. * * @example — simple guards, no inputMapper required: * const result = await validateContent("LLM response text", [toxicityGuard(), piiGuard()]); * if (!result.passed) { * console.log("Failed:", result.results.filter(r => !r.passed)); * } * * @example — complex guard with typed input, inputMapper required: * const result = await validateContent(llmOutput, [semanticSimilarityGuard()], { * inputMapper: (output) => [{ text: output as string, reference: expectedAnswer }], * }); */ declare function validateContent(output: string | Record, guards: Guard>[], options?: ValidateOptions): Promise; declare function validateContent>(output: string | Record, guards: Guard[], options: ValidateOptions & { inputMapper: InputMapper, TInput>; }): Promise; /** * Decorator that wraps a class method with guardrails. * * @example * class MyService { * \@guardrail([toxicityGuard()], { onFailure: "Sorry, blocked." }) * async generateResponse(prompt: string): Promise { ... } * } */ declare function guardrail(guards: Guard[], options?: GuardOptions): MethodDecorator; /** * Standard association properties for tracing. * Use these with withAssociationProperties() or decorator associationProperties config. * * @example * ```typescript * // With withAssociationProperties * await traceloop.withAssociationProperties( * { * [traceloop.AssociationProperty.USER_ID]: "12345", * [traceloop.AssociationProperty.SESSION_ID]: "session-abc" * }, * async () => { * await chat(); * } * ); * * // With decorator * @traceloop.workflow((thisArg) => ({ * name: "my_workflow", * associationProperties: { * [traceloop.AssociationProperty.USER_ID]: (thisArg as MyClass).userId, * }, * })) * ``` */ declare enum AssociationProperty { CUSTOMER_ID = "customer_id", USER_ID = "user_id", SESSION_ID = "session_id" } declare class ImageUploader { private baseUrl; private apiKey; constructor(baseUrl: string, apiKey: string); uploadBase64Image(traceId: string, spanId: string, imageName: string, base64ImageData: string): Promise; private getImageUrl; private uploadImageData; } export { ALL_INSTRUMENTATION_LIBRARIES, ArgumentNotProvidedError, AssociationProperty, Attachment, AttachmentReference, AttachmentUploader, Column, Dataset, Datasets, Evaluator, EvaluatorMadeByTraceloop, Experiment, ExternalAttachment, FailFastGuardResult, GuardExecutionError, GuardInputTypeError, GuardValidationError, GuardrailError, Guardrails, ImageUploader, InitializationError, LLMSpan, NotInitializedError, OnFailure, PromptNotFoundError, Row, SEVERITY, TraceloopClient, TraceloopError, VectorSpan, agent, attachment, between, conversation, createEvaluator, createSpanProcessor, customEvaluatorGuard, defaultInputMapper, eq, forceFlush, getAvailableEvaluatorSlugs, getClient, getEvaluatorSchemaInfo, getPrompt, getTraceloopTracer, gt, gte, guard, guardrail, initialize, instructionAdherenceGuard, isAnyAttachment, isAttachment, isAttachmentReference, isExternalAttachment, isFalse, isFalsy, isTrue, isTruthy, jsonValidatorGuard, lt, lte, piiGuard, profanityGuard, promptInjectionGuard, promptPerplexityGuard, regexValidatorGuard, reportCustomMetric, resolveGuardInputs, resolveOnFailure, secretsGuard, semanticSimilarityGuard, sexismGuard, sqlValidatorGuard, task, toneDetectionGuard, tool, toxicityGuard, traceloopInstrumentationLibraries, uncertaintyGuard, validateContent, validateEvaluatorInput, waitForInitialization, withAgent, withAssociationProperties, withConversation, withLLMCall, withTask, withTool, withVectorDBCall, withWorkflow, workflow }; export type { AnnotationCreateOptions, AttachmentMetadata, AttachmentOptions, CSVImportOptions, ColumnDefinition, ColumnResponse, ColumnUpdateOptions, ConditionValue, CreateCustomEvaluatorRequest, CustomEvaluatorGuardOptions, DatasetCreateOptions, DatasetListResponse, DatasetPublishOptions, DatasetResponse, DatasetUpdateOptions, DatasetVersion, DatasetVersionsResponse, DecoratorConfig, EvaluatorCatalogItem, EvaluatorCreateResponse, EvaluatorData, EvaluatorDetails, EvaluatorExecuteOptions, EvaluatorExecuteResponse, EvaluatorSource, EvaluatorUpdateRequest, EvaluatorUpdateResponse, EvaluatorWithConfig, EvaluatorWithVersion, ExecutionResponse, ExperimentRunOptions, ExperimentRunResult, ExperimentTaskFunction, ExternalAttachmentOptions, FileCellType, FileStorageType, GithubContext, Guard, GuardCallResult, GuardOptions, GuardResult, GuardedResult, GuardrailsOptions, InitializeOptions, InputMapper, InstructionAdherenceInput, LLMMessage, OnFailureHandler, PrebuiltGuardOptions, PropertySchema, RowData, RowResponse, RowUpdateOptions, RunInGithubOptions, RunInGithubResponse, SSEStreamEvent, SemanticSimilarityInput, Severity, SpanProcessorOptions, StreamEvent, TaskInput, TaskOutput, TaskResponse, TaskResult, TraceloopClientOptions, UncertaintyInput, UploadUrlResponse, ValidateOptions, ValidateResult };