UNPKG

@aegisai/opik

Version:

Opik TypeScript and JavaScript SDK

2,299 lines (2,040 loc) 183 kB
import * as stream from 'stream'; interface OpikConfig { apiKey: string; apiUrl?: string; projectName: string; workspaceName: string; } /** * This file was auto-generated by Fern from our API Definition. */ type AttachmentListRequestEntityType = "trace" | "span"; declare const AttachmentListRequestEntityType: { readonly Trace: "trace"; readonly Span: "span"; }; /** * This file was auto-generated by Fern from our API Definition. */ type DownloadAttachmentRequestEntityType = "trace" | "span"; declare const DownloadAttachmentRequestEntityType: { readonly Trace: "trace"; readonly Span: "span"; }; /** * This file was auto-generated by Fern from our API Definition. */ type StartMultipartUploadRequestEntityType = "trace" | "span"; declare const StartMultipartUploadRequestEntityType: { readonly Trace: "trace"; readonly Span: "span"; }; /** * This file was auto-generated by Fern from our API Definition. */ type UploadAttachmentRequestEntityType = "trace" | "span"; declare const UploadAttachmentRequestEntityType: { readonly Trace: "trace"; readonly Span: "span"; }; /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * projectId: "project_id", * entityType: "trace", * entityId: "entity_id", * path: "path" * } */ interface AttachmentListRequest { page?: number; size?: number; projectId: string; entityType: AttachmentListRequestEntityType; entityId: string; path: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface DownloadAttachmentRequest { workspaceName?: string; containerId: string; entityType: DownloadAttachmentRequestEntityType; entityId: string; fileName: string; mimeType: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * fileName: "file_name", * numOfFileParts: 1, * entityType: "trace", * entityId: "entity_id", * path: "path" * } */ interface StartMultipartUploadRequest { fileName: string; numOfFileParts: number; mimeType?: string; /** If null, the default project is used */ projectName?: string; entityType: StartMultipartUploadRequestEntityType; entityId: string; path: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * fileName: "file_name", * entityType: "trace", * entityId: "entity_id", * body: { * "key": "value" * } * } */ interface UploadAttachmentRequest { fileName: string; projectName?: string; mimeType?: string; entityType: UploadAttachmentRequestEntityType; entityId: string; body: Record<string, unknown>; } /** * This file was auto-generated by Fern from our API Definition. */ type DatasetWriteVisibility = "private" | "public"; declare const DatasetWriteVisibility: { readonly Private: "private"; readonly Public: "public"; }; /** * This file was auto-generated by Fern from our API Definition. */ type DatasetUpdateVisibility = "private" | "public"; declare const DatasetUpdateVisibility: { readonly Private: "private"; readonly Public: "public"; }; /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface FindDatasetsRequest { page?: number; size?: number; withExperimentsOnly?: boolean; withOptimizationsOnly?: boolean; promptId?: string; name?: string; sorting?: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * name: "name" * } */ interface DatasetWrite { id?: string; name: string; visibility?: DatasetWriteVisibility; description?: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * items: [{ * source: "manual", * data: { * "key": "value" * } * }] * } */ interface DatasetItemBatchWrite { /** If null, dataset_id must be provided */ datasetName?: string; /** If null, dataset_name must be provided */ datasetId?: string; items: DatasetItemWrite[]; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * name: "name" * } */ interface DatasetUpdate { name: string; description?: string; visibility?: DatasetUpdateVisibility; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * datasetName: "dataset_name" * } */ interface DatasetIdentifier { datasetName: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * itemIds: ["item_ids"] * } */ interface DatasetItemsDelete { itemIds: string[]; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * experimentIds: "experiment_ids" * } */ interface FindDatasetItemsWithExperimentItemsRequest { page?: number; size?: number; experimentIds: string; filters?: string; truncate?: boolean; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * datasetName: "dataset_name" * } */ interface DatasetIdentifierPublic { datasetName: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface GetDatasetItemsRequest { page?: number; size?: number; truncate?: boolean; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface GetDatasetItemsOutputColumnsRequest { experimentIds?: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface DatasetItemStreamRequest { datasetName: string; lastRetrievedId?: string; steamLimit?: number; } /** * This file was auto-generated by Fern from our API Definition. */ type ExperimentWriteType = "regular" | "trial" | "mini-batch"; declare const ExperimentWriteType: { readonly Regular: "regular"; readonly Trial: "trial"; readonly MiniBatch: "mini-batch"; }; /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface FindExperimentsRequest { page?: number; size?: number; datasetId?: string; optimizationId?: string; types?: string; name?: string; datasetDeleted?: boolean; promptId?: string; sorting?: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * datasetName: "dataset_name" * } */ interface ExperimentWrite { id?: string; datasetName: string; name?: string; metadata?: JsonNodeWrite; type?: ExperimentWriteType; optimizationId?: string; promptVersion?: PromptVersionLinkWrite; promptVersions?: PromptVersionLinkWrite[]; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * experimentItems: [{ * experimentId: "experiment_id", * datasetItemId: "dataset_item_id", * traceId: "trace_id" * }] * } */ interface ExperimentItemsBatch { experimentItems: ExperimentItem[]; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * ids: ["ids"] * } */ interface ExperimentItemsDelete { ids: string[]; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * experimentName: "experiment_name", * datasetName: "dataset_name", * items: [{ * datasetItemId: "dataset_item_id" * }] * } */ interface ExperimentItemBulkUploadWrite { experimentName: string; datasetName: string; items: ExperimentItemBulkRecordWrite[]; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface FindFeedbackScoreNamesRequest { experimentIds?: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface ExperimentItemStreamRequest { experimentName: string; limit?: number; lastRetrievedId?: string; /** Truncate image included in either input, output or metadata */ truncate?: boolean; } /** * This file was auto-generated by Fern from our API Definition. */ interface ExperimentStreamRequestPublic { name: string; limit?: number; lastRetrievedId?: string; } /** * This file was auto-generated by Fern from our API Definition. */ type FindFeedbackDefinitionsRequestType = "numerical" | "categorical"; declare const FindFeedbackDefinitionsRequestType: { readonly Numerical: "numerical"; readonly Categorical: "categorical"; }; /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface FindFeedbackDefinitionsRequest { page?: number; size?: number; name?: string; type?: FindFeedbackDefinitionsRequestType; } /** * This file was auto-generated by Fern from our API Definition. */ type ProviderApiKeyWriteProvider = "openai" | "anthropic" | "gemini" | "openrouter" | "vertex-ai"; declare const ProviderApiKeyWriteProvider: { readonly Openai: "openai"; readonly Anthropic: "anthropic"; readonly Gemini: "gemini"; readonly Openrouter: "openrouter"; readonly VertexAi: "vertex-ai"; }; /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * provider: "openai", * apiKey: "api_key" * } */ interface ProviderApiKeyWrite { provider: ProviderApiKeyWriteProvider; apiKey: string; name?: string; headers?: Record<string, string>; configuration?: Record<string, string>; baseUrl?: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * apiKey: "api_key" * } */ interface ProviderApiKeyUpdate { apiKey: string; name?: string; } /** * This file was auto-generated by Fern from our API Definition. */ type OptimizationUpdateStatus = "running" | "completed" | "cancelled"; declare const OptimizationUpdateStatus: { readonly Running: "running"; readonly Completed: "completed"; readonly Cancelled: "cancelled"; }; /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface FindOptimizationsRequest { page?: number; size?: number; datasetId?: string; name?: string; datasetDeleted?: boolean; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface OptimizationUpdate { name?: string; status?: OptimizationUpdateStatus; } /** * This file was auto-generated by Fern from our API Definition. */ type ProjectWriteVisibility = "private" | "public"; declare const ProjectWriteVisibility: { readonly Private: "private"; readonly Public: "public"; }; /** * This file was auto-generated by Fern from our API Definition. */ type ProjectUpdateVisibility = "private" | "public"; declare const ProjectUpdateVisibility: { readonly Private: "private"; readonly Public: "public"; }; /** * This file was auto-generated by Fern from our API Definition. */ type ProjectMetricRequestPublicMetricType = "FEEDBACK_SCORES" | "TRACE_COUNT" | "TOKEN_USAGE" | "DURATION" | "COST" | "GUARDRAILS_FAILED_COUNT"; declare const ProjectMetricRequestPublicMetricType: { readonly FeedbackScores: "FEEDBACK_SCORES"; readonly TraceCount: "TRACE_COUNT"; readonly TokenUsage: "TOKEN_USAGE"; readonly Duration: "DURATION"; readonly Cost: "COST"; readonly GuardrailsFailedCount: "GUARDRAILS_FAILED_COUNT"; }; /** * This file was auto-generated by Fern from our API Definition. */ type ProjectMetricRequestPublicInterval = "HOURLY" | "DAILY" | "WEEKLY"; declare const ProjectMetricRequestPublicInterval: { readonly Hourly: "HOURLY"; readonly Daily: "DAILY"; readonly Weekly: "WEEKLY"; }; /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface FindProjectsRequest { page?: number; size?: number; name?: string; sorting?: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * name: "name" * } */ interface ProjectWrite { name: string; visibility?: ProjectWriteVisibility; description?: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface ProjectUpdate { name?: string; description?: string; visibility?: ProjectUpdateVisibility; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface FindFeedbackScoreNamesByProjectIdsRequest { projectIds?: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface ProjectMetricRequestPublic { metricType?: ProjectMetricRequestPublicMetricType; interval?: ProjectMetricRequestPublicInterval; intervalStart?: Date; intervalEnd?: Date; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface GetProjectStatsRequest { page?: number; size?: number; name?: string; sorting?: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * name: "name" * } */ interface ProjectRetrieveDetailed { name: string; } /** * This file was auto-generated by Fern from our API Definition. */ type PromptWriteType = "mustache" | "jinja2"; declare const PromptWriteType: { readonly Mustache: "mustache"; readonly Jinja2: "jinja2"; }; /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface GetPromptsRequest { page?: number; size?: number; name?: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * name: "name" * } */ interface PromptWrite { id?: string; name: string; description?: string; template?: string; metadata?: JsonNodeWrite; changeDescription?: string; type?: PromptWriteType; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * name: "name", * version: { * template: "template" * } * } */ interface CreatePromptVersionDetail { name: string; version: PromptVersionDetail; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * name: "name" * } */ interface PromptUpdatable { name: string; description?: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface GetPromptVersionsRequest { page?: number; size?: number; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * name: "name" * } */ interface PromptVersionRetrieveDetail { name: string; commit?: string; } /** * This file was auto-generated by Fern from our API Definition. */ type GetSpansByProjectRequestType = "general" | "tool" | "llm" | "guardrail"; declare const GetSpansByProjectRequestType: { readonly General: "general"; readonly Tool: "tool"; readonly Llm: "llm"; readonly Guardrail: "guardrail"; }; /** * This file was auto-generated by Fern from our API Definition. */ type SpanUpdateType = "general" | "tool" | "llm" | "guardrail"; declare const SpanUpdateType: { readonly General: "general"; readonly Tool: "tool"; readonly Llm: "llm"; readonly Guardrail: "guardrail"; }; /** * This file was auto-generated by Fern from our API Definition. */ type FindFeedbackScoreNames1RequestType = "general" | "tool" | "llm" | "guardrail"; declare const FindFeedbackScoreNames1RequestType: { readonly General: "general"; readonly Tool: "tool"; readonly Llm: "llm"; readonly Guardrail: "guardrail"; }; /** * This file was auto-generated by Fern from our API Definition. */ type GetSpanStatsRequestType = "general" | "tool" | "llm" | "guardrail"; declare const GetSpanStatsRequestType: { readonly General: "general"; readonly Tool: "tool"; readonly Llm: "llm"; readonly Guardrail: "guardrail"; }; /** * This file was auto-generated by Fern from our API Definition. */ type SpanSearchStreamRequestPublicType = "general" | "tool" | "llm" | "guardrail"; declare const SpanSearchStreamRequestPublicType: { readonly General: "general"; readonly Tool: "tool"; readonly Llm: "llm"; readonly Guardrail: "guardrail"; }; /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface GetSpansByProjectRequest { page?: number; size?: number; projectName?: string; projectId?: string; traceId?: string; type?: GetSpansByProjectRequestType; filters?: string; truncate?: boolean; sorting?: string; exclude?: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * spans: [{ * traceId: "trace_id", * startTime: "2024-01-15T09:30:00Z" * }] * } */ interface SpanBatchWrite { spans: SpanWrite[]; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * traceId: "trace_id" * } */ interface SpanUpdate$1 { /** If null and project_id not specified, Default Project is assumed */ projectName?: string; /** If null and project_name not specified, Default Project is assumed */ projectId?: string; traceId: string; parentSpanId?: string; name?: string; type?: SpanUpdateType; endTime?: Date; input?: JsonListString; output?: JsonListString; metadata?: JsonNode; model?: string; provider?: string; tags?: string[]; usage?: Record<string, number>; totalEstimatedCost?: number; errorInfo?: ErrorInfo; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface FindFeedbackScoreNames1Request { projectId?: string; type?: FindFeedbackScoreNames1RequestType; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface GetSpanStatsRequest { projectId?: string; projectName?: string; traceId?: string; type?: GetSpanStatsRequestType; filters?: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface SpanSearchStreamRequestPublic { traceId?: string; projectName?: string; projectId?: string; type?: SpanSearchStreamRequestPublicType; filters?: SpanFilterPublic[]; /** Max number of spans to be streamed */ limit?: number; lastRetrievedId?: string; /** Truncate image included in either input, output or metadata */ truncate?: boolean; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface FindEvaluatorsRequest { projectId?: string; name?: string; page?: number; size?: number; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * body: { * ids: ["ids"] * } * } */ interface DeleteAutomationRuleEvaluatorBatchRequest { projectId?: string; body: BatchDelete; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface GetEvaluatorByIdRequest { projectId?: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface GetEvaluatorLogsByIdRequest { size?: number; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface ChatCompletionRequest { model?: string; messages?: Message[]; temperature?: number; topP?: number; n?: number; stream?: boolean; streamOptions?: StreamOptions; stop?: string[]; maxTokens?: number; maxCompletionTokens?: number; presencePenalty?: number; frequencyPenalty?: number; logitBias?: Record<string, number>; user?: string; responseFormat?: ResponseFormat; seed?: number; tools?: Tool[]; toolChoice?: Record<string, unknown>; parallelToolCalls?: boolean; store?: boolean; metadata?: Record<string, string>; reasoningEffort?: string; serviceTier?: string; functions?: Function$1[]; functionCall?: FunctionCall; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * guardrails: [{ * entityId: "entity_id", * secondaryId: "secondary_id", * name: "TOPIC", * result: "passed", * config: { * "key": "value" * }, * details: { * "key": "value" * } * }] * } */ interface GuardrailBatchWrite { guardrails: GuardrailWrite[]; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface GetTracesByProjectRequest { page?: number; size?: number; projectName?: string; projectId?: string; filters?: string; truncate?: boolean; sorting?: string; exclude?: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * traces: [{ * startTime: "2024-01-15T09:30:00Z" * }] * } */ interface TraceBatchWrite { traces: TraceWrite[]; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface TraceUpdate { /** If null and project_id not specified, Default Project is assumed */ projectName?: string; /** If null and project_name not specified, Default Project is assumed */ projectId?: string; name?: string; endTime?: Date; input?: JsonListString; output?: JsonListString; metadata?: JsonNode; tags?: string[]; errorInfo?: ErrorInfo; threadId?: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * threadIds: ["thread_ids"] * } */ interface DeleteTraceThreads { /** If null, project_id must be provided */ projectName?: string; /** If null, project_name must be provided */ projectId?: string; threadIds: string[]; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface FindFeedbackScoreNames2Request { projectId?: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface GetTraceStatsRequest { projectId?: string; projectName?: string; filters?: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * projectId: "project_id", * threadId: "thread_id" * } */ interface TraceThreadIdentifier { projectId: string; threadId: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * {} */ interface GetTraceThreadsRequest { page?: number; size?: number; projectName?: string; projectId?: string; truncate?: boolean; filters?: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface TraceSearchStreamRequestPublic { projectName?: string; projectId?: string; filters?: TraceFilterPublic[]; lastRetrievedId?: string; /** Max number of traces to be streamed */ limit?: number; /** Truncate image included in either input, output or metadata */ truncate?: boolean; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * datasetId: "dataset_id", * path: "path" * } */ interface DatasetsRedirectRequest { datasetId: string; workspaceName?: string; path: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * datasetId: "dataset_id", * experimentId: "experiment_id", * path: "path" * } */ interface ExperimentsRedirectRequest { datasetId: string; experimentId: string; workspaceName?: string; path: string; } /** * This file was auto-generated by Fern from our API Definition. */ /** * @example * { * traceId: "trace_id", * path: "path" * } */ interface ProjectsRedirectRequest { traceId: string; workspaceName?: string; path: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface BiInformation { workspaceId?: string; user?: string; count?: number; } /** * This file was auto-generated by Fern from our API Definition. */ interface BiInformationResponse { biInformation?: BiInformation[]; } /** * This file was auto-generated by Fern from our API Definition. */ interface SpansCountResponse { workspacesSpansCount?: WorkspaceSpansCount[]; } /** * This file was auto-generated by Fern from our API Definition. */ interface WorkspaceSpansCount { workspace?: string; spanCount?: number; } /** * This file was auto-generated by Fern from our API Definition. */ interface TraceCountResponse { workspacesTracesCount?: WorkspaceTraceCount[]; } /** * This file was auto-generated by Fern from our API Definition. */ interface WorkspaceTraceCount { workspace?: string; traceCount?: number; } /** * This file was auto-generated by Fern from our API Definition. */ interface Attachment { link?: string; fileName: string; fileSize: number; mimeType: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface AttachmentPage { page?: number; size?: number; total?: number; content?: Attachment[]; sortableBy?: string[]; } /** * This file was auto-generated by Fern from our API Definition. */ type CompleteMultipartUploadRequestEntityType = "trace" | "span"; declare const CompleteMultipartUploadRequestEntityType: { readonly Trace: "trace"; readonly Span: "span"; }; /** * This file was auto-generated by Fern from our API Definition. */ interface CompleteMultipartUploadRequest { fileName: string; /** If null, the default project is used */ projectName?: string; entityType: CompleteMultipartUploadRequestEntityType; entityId: string; containerId?: string; fileSize: number; mimeType?: string; uploadId: string; uploadedFileParts: MultipartUploadPart[]; } /** * This file was auto-generated by Fern from our API Definition. */ interface MultipartUploadPart { eTag: string; partNumber: number; } /** * This file was auto-generated by Fern from our API Definition. */ interface StartMultipartUploadResponse { uploadId: string; preSignUrls: string[]; } /** * This file was auto-generated by Fern from our API Definition. */ type AuthDetailsHolder = Record<string, unknown>; /** * This file was auto-generated by Fern from our API Definition. */ interface WorkspaceNameHolder { workspaceName?: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface LlmAsJudgeCode { model: LlmAsJudgeModelParameters; messages: LlmAsJudgeMessage[]; variables: Record<string, string>; schema: LlmAsJudgeOutputSchema[]; } /** * This file was auto-generated by Fern from our API Definition. */ type LlmAsJudgeMessageRole = "SYSTEM" | "USER" | "AI" | "TOOL_EXECUTION_RESULT" | "CUSTOM"; declare const LlmAsJudgeMessageRole: { readonly System: "SYSTEM"; readonly User: "USER"; readonly Ai: "AI"; readonly ToolExecutionResult: "TOOL_EXECUTION_RESULT"; readonly Custom: "CUSTOM"; }; /** * This file was auto-generated by Fern from our API Definition. */ interface LlmAsJudgeMessage { role: LlmAsJudgeMessageRole; content: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface LlmAsJudgeModelParameters { name: string; temperature: number; } /** * This file was auto-generated by Fern from our API Definition. */ type LlmAsJudgeOutputSchemaType = "BOOLEAN" | "INTEGER" | "DOUBLE"; declare const LlmAsJudgeOutputSchemaType: { readonly Boolean: "BOOLEAN"; readonly Integer: "INTEGER"; readonly Double: "DOUBLE"; }; /** * This file was auto-generated by Fern from our API Definition. */ interface LlmAsJudgeOutputSchema { name: string; type: LlmAsJudgeOutputSchemaType; description: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface UserDefinedMetricPythonCode { metric: string; arguments: Record<string, string>; } /** * This file was auto-generated by Fern from our API Definition. */ interface AutomationRuleEvaluatorLlmAsJudgeWrite { code?: LlmAsJudgeCodeWrite; } /** * This file was auto-generated by Fern from our API Definition. */ interface AutomationRuleEvaluatorUserDefinedMetricPythonWrite { code?: UserDefinedMetricPythonCodeWrite; } /** * This file was auto-generated by Fern from our API Definition. */ type AutomationRuleEvaluatorWrite = AutomationRuleEvaluatorWrite.LlmAsJudge | AutomationRuleEvaluatorWrite.UserDefinedMetricPython; declare namespace AutomationRuleEvaluatorWrite { interface LlmAsJudge extends AutomationRuleEvaluatorLlmAsJudgeWrite, _Base { type: "llm_as_judge"; } interface UserDefinedMetricPython extends AutomationRuleEvaluatorUserDefinedMetricPythonWrite, _Base { type: "user_defined_metric_python"; } interface _Base { projectId?: string; name: string; samplingRate?: number; action?: "evaluator"; } } /** * This file was auto-generated by Fern from our API Definition. */ interface LlmAsJudgeCodeWrite { model: LlmAsJudgeModelParametersWrite; messages: LlmAsJudgeMessageWrite[]; variables: Record<string, string>; schema: LlmAsJudgeOutputSchemaWrite[]; } /** * This file was auto-generated by Fern from our API Definition. */ type LlmAsJudgeMessageWriteRole = "SYSTEM" | "USER" | "AI" | "TOOL_EXECUTION_RESULT" | "CUSTOM"; declare const LlmAsJudgeMessageWriteRole: { readonly System: "SYSTEM"; readonly User: "USER"; readonly Ai: "AI"; readonly ToolExecutionResult: "TOOL_EXECUTION_RESULT"; readonly Custom: "CUSTOM"; }; /** * This file was auto-generated by Fern from our API Definition. */ interface LlmAsJudgeMessageWrite { role: LlmAsJudgeMessageWriteRole; content: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface LlmAsJudgeModelParametersWrite { name: string; temperature: number; } /** * This file was auto-generated by Fern from our API Definition. */ type LlmAsJudgeOutputSchemaWriteType = "BOOLEAN" | "INTEGER" | "DOUBLE"; declare const LlmAsJudgeOutputSchemaWriteType: { readonly Boolean: "BOOLEAN"; readonly Integer: "INTEGER"; readonly Double: "DOUBLE"; }; /** * This file was auto-generated by Fern from our API Definition. */ interface LlmAsJudgeOutputSchemaWrite { name: string; type: LlmAsJudgeOutputSchemaWriteType; description: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface UserDefinedMetricPythonCodeWrite { metric: string; arguments: Record<string, string>; } /** * This file was auto-generated by Fern from our API Definition. */ interface BatchDelete { ids: string[]; } /** * This file was auto-generated by Fern from our API Definition. */ interface AutomationRuleEvaluatorLlmAsJudgePublic { code?: LlmAsJudgeCodePublic; } /** * This file was auto-generated by Fern from our API Definition. */ type AutomationRuleEvaluatorObjectPublic = AutomationRuleEvaluatorObjectPublic.LlmAsJudge | AutomationRuleEvaluatorObjectPublic.UserDefinedMetricPython; declare namespace AutomationRuleEvaluatorObjectPublic { interface LlmAsJudge extends AutomationRuleEvaluatorLlmAsJudgePublic, _Base { type: "llm_as_judge"; } interface UserDefinedMetricPython extends AutomationRuleEvaluatorUserDefinedMetricPythonPublic, _Base { type: "user_defined_metric_python"; } interface _Base { id?: string; projectId?: string; projectName?: string; name: string; samplingRate?: number; createdAt?: Date; createdBy?: string; lastUpdatedAt?: Date; lastUpdatedBy?: string; action?: "evaluator"; } } /** * This file was auto-generated by Fern from our API Definition. */ interface AutomationRuleEvaluatorPagePublic { page?: number; size?: number; total?: number; content?: AutomationRuleEvaluatorObjectPublic[]; } /** * This file was auto-generated by Fern from our API Definition. */ interface AutomationRuleEvaluatorUserDefinedMetricPythonPublic { code?: UserDefinedMetricPythonCodePublic; } /** * This file was auto-generated by Fern from our API Definition. */ interface LlmAsJudgeCodePublic { model: LlmAsJudgeModelParametersPublic; messages: LlmAsJudgeMessagePublic[]; variables: Record<string, string>; schema: LlmAsJudgeOutputSchemaPublic[]; } /** * This file was auto-generated by Fern from our API Definition. */ type LlmAsJudgeMessagePublicRole = "SYSTEM" | "USER" | "AI" | "TOOL_EXECUTION_RESULT" | "CUSTOM"; declare const LlmAsJudgeMessagePublicRole: { readonly System: "SYSTEM"; readonly User: "USER"; readonly Ai: "AI"; readonly ToolExecutionResult: "TOOL_EXECUTION_RESULT"; readonly Custom: "CUSTOM"; }; /** * This file was auto-generated by Fern from our API Definition. */ interface LlmAsJudgeMessagePublic { role: LlmAsJudgeMessagePublicRole; content: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface LlmAsJudgeModelParametersPublic { name: string; temperature: number; } /** * This file was auto-generated by Fern from our API Definition. */ type LlmAsJudgeOutputSchemaPublicType = "BOOLEAN" | "INTEGER" | "DOUBLE"; declare const LlmAsJudgeOutputSchemaPublicType: { readonly Boolean: "BOOLEAN"; readonly Integer: "INTEGER"; readonly Double: "DOUBLE"; }; /** * This file was auto-generated by Fern from our API Definition. */ interface LlmAsJudgeOutputSchemaPublic { name: string; type: LlmAsJudgeOutputSchemaPublicType; description: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface UserDefinedMetricPythonCodePublic { metric: string; arguments: Record<string, string>; } /** * This file was auto-generated by Fern from our API Definition. */ type AutomationRuleEvaluatorPublic = AutomationRuleEvaluatorPublic.LlmAsJudge | AutomationRuleEvaluatorPublic.UserDefinedMetricPython; declare namespace AutomationRuleEvaluatorPublic { interface LlmAsJudge extends AutomationRuleEvaluatorLlmAsJudgePublic, _Base { type: "llm_as_judge"; } interface UserDefinedMetricPython extends AutomationRuleEvaluatorUserDefinedMetricPythonPublic, _Base { type: "user_defined_metric_python"; } interface _Base { id?: string; projectId?: string; projectName?: string; name: string; samplingRate?: number; createdAt?: Date; createdBy?: string; lastUpdatedAt?: Date; lastUpdatedBy?: string; action?: "evaluator"; } } /** * This file was auto-generated by Fern from our API Definition. */ type LogItemLevel = "INFO" | "WARN" | "ERROR" | "DEBUG" | "TRACE"; declare const LogItemLevel: { readonly Info: "INFO"; readonly Warn: "WARN"; readonly Error: "ERROR"; readonly Debug: "DEBUG"; readonly Trace: "TRACE"; }; /** * This file was auto-generated by Fern from our API Definition. */ interface LogItem { timestamp?: Date; ruleId?: string; level?: LogItemLevel; message?: string; markers?: Record<string, string>; } /** * This file was auto-generated by Fern from our API Definition. */ interface LogPage { content?: LogItem[]; page?: number; size?: number; total?: number; } /** * This file was auto-generated by Fern from our API Definition. */ type AutomationRuleEvaluatorUpdate = AutomationRuleEvaluatorUpdate.LlmAsJudge | AutomationRuleEvaluatorUpdate.UserDefinedMetricPython; declare namespace AutomationRuleEvaluatorUpdate { interface LlmAsJudge extends AutomationRuleEvaluatorUpdateLlmAsJudge, _Base { type: "llm_as_judge"; } interface UserDefinedMetricPython extends AutomationRuleEvaluatorUpdateUserDefinedMetricPython, _Base { type: "user_defined_metric_python"; } interface _Base { name: string; samplingRate?: number; projectId?: string; action?: "evaluator"; } } /** * This file was auto-generated by Fern from our API Definition. */ interface AutomationRuleEvaluatorUpdateLlmAsJudge { code?: LlmAsJudgeCode; } /** * This file was auto-generated by Fern from our API Definition. */ interface AutomationRuleEvaluatorUpdateUserDefinedMetricPython { code?: UserDefinedMetricPythonCode; } /** * This file was auto-generated by Fern from our API Definition. */ type AssistantMessageRole = "system" | "user" | "assistant" | "tool" | "function"; declare const AssistantMessageRole: { readonly System: "system"; readonly User: "user"; readonly Assistant: "assistant"; readonly Tool: "tool"; readonly Function: "function"; }; /** * This file was auto-generated by Fern from our API Definition. */ interface AssistantMessage { role?: AssistantMessageRole; content?: string; name?: string; toolCalls?: ToolCall[]; refusal?: boolean; functionCall?: FunctionCall; } /** * This file was auto-generated by Fern from our API Definition. */ interface ChatCompletionChoice { index?: number; message?: AssistantMessage; delta?: Delta; finishReason?: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface ChatCompletionResponse { id?: string; created?: number; model?: string; choices?: ChatCompletionChoice[]; usage?: Usage; systemFingerprint?: string; serviceTier?: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface CompletionTokensDetails { reasoningTokens?: number; } /** * This file was auto-generated by Fern from our API Definition. */ interface Delta { role?: string; content?: string; toolCalls?: ToolCall[]; functionCall?: FunctionCall; } /** * This file was auto-generated by Fern from our API Definition. */ interface FunctionCall { name?: string; arguments?: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface PromptTokensDetails { cachedTokens?: number; } /** * This file was auto-generated by Fern from our API Definition. */ interface ToolCall { id?: string; index?: number; type?: "function"; function?: FunctionCall; } /** * This file was auto-generated by Fern from our API Definition. */ interface Usage { totalTokens?: number; promptTokens?: number; promptTokensDetails?: PromptTokensDetails; completionTokens?: number; completionTokensDetails?: CompletionTokensDetails; } /** * This file was auto-generated by Fern from our API Definition. */ interface Function$1 { name?: string; description?: string; strict?: boolean; parameters?: Record<string, Record<string, unknown>>; } /** * This file was auto-generated by Fern from our API Definition. */ interface JsonSchema { name?: string; strict?: boolean; schema?: Record<string, Record<string, unknown>>; } /** * This file was auto-generated by Fern from our API Definition. */ type Message = Record<string, unknown>; /** * This file was auto-generated by Fern from our API Definition. */ type ResponseFormatType = "text" | "json_object" | "json_schema"; declare const ResponseFormatType: { readonly Text: "text"; readonly JsonObject: "json_object"; readonly JsonSchema: "json_schema"; }; /** * This file was auto-generated by Fern from our API Definition. */ interface ResponseFormat { type?: ResponseFormatType; jsonSchema?: JsonSchema; } /** * This file was auto-generated by Fern from our API Definition. */ interface StreamOptions { includeUsage?: boolean; } /** * This file was auto-generated by Fern from our API Definition. */ interface Tool { type?: "function"; function?: Function$1; } /** * This file was auto-generated by Fern from our API Definition. */ interface Comment { id?: string; text: string; createdAt?: Date; lastUpdatedAt?: Date; createdBy?: string; lastUpdatedBy?: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface ExperimentItem { id?: string; experimentId: string; datasetItemId: string; traceId: string; input?: JsonListString; output?: JsonListString; feedbackScores?: FeedbackScore[]; comments?: Comment[]; totalEstimatedCost?: number; duration?: number; usage?: Record<string, number>; createdAt?: Date; lastUpdatedAt?: Date; createdBy?: string; lastUpdatedBy?: string; } /** * This file was auto-generated by Fern from our API Definition. */ type FeedbackScoreSource = "ui" | "sdk" | "online_scoring"; declare const FeedbackScoreSource: { readonly Ui: "ui"; readonly Sdk: "sdk"; readonly OnlineScoring: "online_scoring"; }; /** * This file was auto-generated by Fern from our API Definition. */ interface FeedbackScore { name: string; categoryName?: string; value: number; reason?: string; source: FeedbackScoreSource; createdAt?: Date; lastUpdatedAt?: Date; createdBy?: string; lastUpdatedBy?: string; } /** * This file was auto-generated by Fern from our API Definition. */ type JsonListString = Record<string, unknown> | Record<string, unknown>[] | string; /** * This file was auto-generated by Fern from our API Definition. */ type DatasetItemWriteSource = "manual" | "trace" | "span" | "sdk"; declare const DatasetItemWriteSource: { readonly Manual: "manual"; readonly Trace: "trace"; readonly Span: "span"; readonly Sdk: "sdk"; }; /** * This file was auto-generated by Fern from our API Definition. */ interface DatasetItemWrite { id?: string; traceId?: string; spanId?: string; source: DatasetItemWriteSource; data: JsonNode; } /** * This file was auto-generated by Fern from our API Definition. */ type ColumnCompareTypesItem = "string" | "number" | "object" | "boolean" | "array" | "null"; declare const ColumnCompareTypesItem: { readonly String: "string"; readonly Number: "number"; readonly Object: "object"; readonly Boolean: "boolean"; readonly Array: "array"; readonly Null: "null"; }; /** * This file was auto-generated by Fern from our API Definition. */ interface ColumnCompare { name?: string; types?: ColumnCompareTypesItem[]; filterFieldPrefix?: string; /** The field to use for filtering */ filterField?: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface CommentCompare { id?: string; text: string; createdAt?: Date; lastUpdatedAt?: Date; createdBy?: string; lastUpdatedBy?: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface DatasetItemPageCompare { content?: DatasetItemCompare[]; page?: number; size?: number; total?: number; columns?: ColumnCompare[]; } /** * This file was auto-generated by Fern from our API Definition. */ type DatasetItemCompareSource = "manual" | "trace" | "span" | "sdk"; declare const DatasetItemCompareSource: { readonly Manual: "manual"; readonly Trace: "trace"; readonly Span: "span"; readonly Sdk: "sdk"; }; /** * This file was auto-generated by Fern from our API Definition. */ interface DatasetItemCompare { id?: string; traceId?: string; spanId?: string; source: DatasetItemCompareSource; data: JsonNode; experimentItems?: ExperimentItemCompare[]; datasetId?: string; createdAt?: Date; lastUpdatedAt?: Date; createdBy?: string; lastUpdatedBy?: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface ExperimentItemCompare { id?: string; experimentId: string; datasetItemId: string; traceId: string; input?: JsonListStringCompare; output?: JsonListStringCompare; feedbackScores?: FeedbackScoreCompare[]; comments?: CommentCompare[]; totalEstimatedCost?: number; duration?: number; usage?: Record<string, number>; createdAt?: Date; lastUpdatedAt?: Date; createdBy?: string; lastUpdatedBy?: string; } /** * This file was auto-generated by Fern from our API Definition. */ type FeedbackScoreCompareSource = "ui" | "sdk" | "online_scoring"; declare const FeedbackScoreCompareSource: { readonly Ui: "ui"; readonly Sdk: "sdk"; readonly OnlineScoring: "online_scoring"; }; /** * This file was auto-generated by Fern from our API Definition. */ interface FeedbackScoreCompare { name: string; categoryName?: string; value: number; reason?: string; source: FeedbackScoreCompareSource; createdAt?: Date; lastUpdatedAt?: Date; createdBy?: string; lastUpdatedBy?: string; } /** * This file was auto-generated by Fern from our API Definition. */ type JsonListStringCompare = Record<string, unknown> | Record<string, unknown>[] | string; /** * This file was auto-generated by Fern from our API Definition. */ interface DatasetPagePublic { content?: DatasetPublic[]; page?: number; size?: number; total?: number; } /** * This file was auto-generated by Fern from our API Definition. */ type DatasetPublicVisibility = "private" | "public"; declare const DatasetPublicVisibility: { readonly Private: "private"; readonly Public: "public"; }; /** * This file was auto-generated by Fern from our API Definition. */ interface DatasetPublic { id?: string; name: string; visibility?: DatasetPublicVisibility; description?: string; createdAt?: Date; createdBy?: string; lastUpdatedAt?: Date; lastUpdatedBy?: string; experimentCount?: number; datasetItemsCount?: number; optimizationCount?: number; mostRecentExperimentAt?: Date; lastCreatedExperimentAt?: Date; mostRecentOptimizationAt?: Date; lastCreatedOptimizationAt?: Date; } /** * This file was auto-generated by Fern from our API Definition. */ type DatasetItemPublicSource = "manual" | "trace" | "span" | "sdk"; declare const DatasetItemPublicSource: { readonly Manual: "manual"; readonly Trace: "trace"; readonly Span: "span"; readonly Sdk: "sdk"; }; /** * This file was auto-generated by Fern from our API Definition. */ interface DatasetItemPublic { id?: string; traceId?: string; spanId?: string; source: DatasetItemPublicSource; data: JsonNode; experimentItems?: ExperimentItemPublic[]; datasetId?: string; createdAt?: Date; lastUpdatedAt?: Date; createdBy?: string; lastUpdatedBy?: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface ExperimentItemPublic { id?: string; experimentId: string; datasetItemId: string; traceId: string; createdAt?: Date; lastUpdatedAt?: Date; createdBy?: string; lastUpdatedBy?: string; } /** * This file was auto-generated by Fern from our API Definition. */ type ColumnPublicTypesItem = "string" | "number" | "object" | "boolean" | "array" | "null"; declare const ColumnPublicTypesItem: { readonly String: "string"; readonly Number: "number"; readonly Object: "object"; readonly Boolean: "boolean"; readonly Array: "array"; readonly Null: "null"; }; /** * This file was auto-generated by Fern from our API Definition. */ interface ColumnPublic { name?: string; types?: ColumnPublicTypesItem[]; filterFieldPrefix?: string; /** The field to use for filtering */ filterField?: string; } /** * This file was auto-generated by Fern from our API Definition. */ interface DatasetItemPagePublic { content?: DatasetItemPublic[]; page?: number; size?: number; total?: number; columns?: ColumnPublic[]; } /** * This file was auto-generated by Fern from our API Definition. */ type ColumnTypesItem = "string" | "number" | "object" | "boolean" | "array" | "null"; declare const ColumnTypesItem: {