import { APIResource } from "../../../core/resource.js"; import * as ConversationsAPI from "./conversations.js"; import { ConversationCreateParams, ConversationDeleteParams, ConversationExportPromptsParams, ConversationListParams, ConversationPushMessagesParams, ConversationRenameParams, ConversationRetrieveParams, Conversations } from "./conversations.js"; import { APIPromise } from "../../../core/api-promise.js"; import { RequestOptions } from "../../../internal/request-options.js"; export declare class PerformanceInsights extends APIResource { conversations: ConversationsAPI.Conversations; /** * Generate an embeddable URL and token for the Performance Insights dashboard. * Requires a TrueLearn userContextJwt to authenticate data access. * * @example * ```ts * const response = await client.v1.performanceInsights.generateEmbed({ * userContextJwt: 'userContextJwt', * }); * ``` */ generateEmbed(body: PerformanceInsightsGenerateEmbedParams, options?: RequestOptions): APIPromise; /** * Submit or remove thumbs-up / thumbs-down feedback for a PI assistant message. * Send `feedback: null` to remove an existing rating. * * @example * ```ts * await client.v1.performanceInsights.submitFeedback({ * sessionId: 'sessionId', * messageId: 'messageId', * feedback: 'thumbsUp', * }); * ``` */ submitFeedback(body: PerformanceInsightsSubmitFeedbackParams, options?: RequestOptions): APIPromise; /** * List PI message feedback for the organization. * * @example * ```ts * const response = await client.v1.performanceInsights.listFeedback({ * componentId: 'componentId', * feedbackType: 'thumbsDown', * }); * ``` */ listFeedback(query?: PerformanceInsightsListFeedbackParams | null | undefined, options?: RequestOptions): APIPromise; /** * Retrieve the rated message and surrounding conversation for a feedback item. * * @example * ```ts * const context = * await client.v1.performanceInsights.retrieveFeedbackContext('feedbackId'); * ``` */ retrieveFeedbackContext(feedbackID: string, options?: RequestOptions): APIPromise; /** * Export user prompts as CSV. Scope with componentId and a date range. * * @example * ```ts * const csv = await client.v1.performanceInsights.exportPrompts({ * componentId: 'componentId', * startDate: '2026-01-01T00:00:00.000Z', * }); * ``` */ exportPrompts(query?: PerformanceInsightsExportPromptsParams | null | undefined, options?: RequestOptions): APIPromise; /** * Stream an AI-powered analytics response using server-sent events (SSE). * * @example * ```ts * await client.v1.performanceInsights.stream(); * ``` */ stream(params?: PerformanceInsightsStreamParams | null | undefined, options?: RequestOptions): APIPromise; } export interface PerformanceInsightsGenerateEmbedResponse { /** * Full embed URL for iframe integration */ embedUrl: string; /** * JWT embed token */ token: string; /** * Token expiration timestamp (1 hour from creation) */ expiresAt: string; /** * Resolved component id backing this embed. Stable across calls sharing the same * organization + componentId, so it can be passed back as componentId on a later * call to target the same record explicitly. */ componentId: string; } export interface PerformanceInsightsGenerateEmbedParams { /** * TrueLearn user context JWT for data access */ userContextJwt: string; /** * Reuse the component returned by a previous embed call, so config edits and usage * history accumulate on it instead of forking a new one. Omit on the first call; * store the componentId from the response and pass it back on every subsequent * call for this environment. An unknown/stale id falls back to minting a new * component rather than failing the call. */ componentId?: string; /** * Force minting a brand-new component instead of falling back to the shared * default bucket when componentId is omitted. Use this to deliberately set up a * new environment (e.g. a new componentId to start tracking Faculty separately) * rather than relying on the default-bucket fallback meant for callers that have * not yet adopted componentId. Ignored if componentId is also provided. */ createNew?: boolean; /** * Show Python code execution details in the embed */ debug?: boolean; /** * Group IDs for access control */ groupIds?: Array; /** * Embed height (e.g., "400px", "100vh") */ height?: string; /** * Swagger/OpenAPI JSON path appended to the API base URL. Scopes which endpoints * the bot can discover. Defaults to swagger/v1/swagger.json when omitted. */ swaggerDocPath?: string; /** * Where the iframe is opened (e.g. high_answer_confidence_correct_individual, * answer_change_individual). Controls which suggestion prompts the embed shows. * Unknown values fall back to the default faculty/member prompt set. */ suggestionContext?: string; /** * IANA timezone string for data analysis (e.g., "America/New_York"). Timestamps in * reports will be shown in this timezone. */ timezone?: string; /** * TrueLearn API origin (https). Defaults to QA when omitted. */ trueLearnApiBase?: string; /** * TrueLearn OAuth token URL (must include connect/token path). Defaults to QA login * when omitted. */ trueLearnTokenUrl?: string; /** * User ID for tracking. If omitted, derived from userContextJwt hash. */ userId?: string; /** * Embed width (e.g., "100%", "600px") */ width?: string; } export interface PerformanceInsightsSubmitFeedbackResponse { success: boolean; } export interface PerformanceInsightsSubmitFeedbackParams { /** * Body param: Session / conversation ID */ sessionId: string; /** * Body param: Assistant message ID being rated */ messageId: string; /** * Body param: Rating to set, or null to remove an existing rating */ feedback: 'thumbsUp' | 'thumbsDown' | null; /** * Body param: Optional reason for the rating */ reason?: string; /** * Header param: Embed token containing the TrueLearn userContextJwt */ 'x-embed-token'?: string; /** * Header param: User ID header (used when authenticating via API key) */ 'x-user-id'?: string; /** * Header param: Group IDs header (comma-separated) for group scoping on feedback */ 'x-group-ids'?: string; } export interface PerformanceInsightsListFeedbackResponse { feedback: Array; groups: Array; stats: PerformanceInsightsListFeedbackResponse.Stats; total: number; } export declare namespace PerformanceInsightsListFeedbackResponse { interface FeedbackItem { _id: string; componentId: string; sessionId: string; messageId: string; feedback: 'thumbsUp' | 'thumbsDown'; reason: string; userId: string; groupIds?: Array; timestamp?: string; } interface Stats { thumbsDown: number; thumbsUp: number; withReason: number; } } export interface PerformanceInsightsFeedbackContextResponse { conversation: Array | null; feedback: PerformanceInsightsFeedbackContextResponse.Feedback; message: PerformanceInsightsFeedbackContextResponse.Message | null; } export declare namespace PerformanceInsightsFeedbackContextResponse { interface Feedback { _id: string; componentId: string; sessionId: string; messageId: string; feedback: 'thumbsUp' | 'thumbsDown'; reason: string; userId: string; timestamp?: string; } interface Message { content: string; createdAt: string; id: string; role: string; } } export interface PerformanceInsightsListFeedbackParams { /** * Filter by component ID */ componentId?: string; /** * Filter by end date (ISO 8601) */ endDate?: string; /** * Filter by feedback type */ feedbackType?: 'thumbsUp' | 'thumbsDown'; /** * Filter by group ID */ groupId?: string; /** * Number of records to return (default: 20) */ limit?: number; /** * Number of records to skip (default: 0) */ skip?: number; /** * Filter by start date (ISO 8601) */ startDate?: string; /** * Filter by user ID */ userId?: string; } export interface PerformanceInsightsExportPromptsParams { /** * Restrict to a single Performance Insights component */ componentId?: string; /** * End date for filtering (ISO 8601) */ endDate?: string; /** * Filter by group ID */ groupId?: string; /** * Filter by session ID */ sessionId?: string; /** * Start date for filtering (ISO 8601) */ startDate?: string; /** * Filter by user ID */ userId?: string; } export interface PerformanceInsightsStreamParams { /** * Body param: Session / conversation ID (AI SDK uses "id") */ id?: string; /** * Body param: Component ID */ componentId?: string; /** * Body param: Additional context */ context?: unknown; /** * Body param: Group IDs for access control */ groupIds?: Array; /** * Body param: Messages array for AI SDK format */ messages?: Array; /** * Body param: Session ID */ sessionId?: string; /** * Body param: IANA timezone string for data analysis */ timezone?: string; /** * Body param: Trigger for AI SDK (what triggered the message) */ trigger?: string; /** * Body param: User ID */ userId?: string; /** * Header param: Embed token containing the TrueLearn userContextJwt */ 'x-embed-token'?: string; /** * Header param: User ID header (used when authenticating via API key) */ 'x-user-id'?: string; } export declare namespace PerformanceInsights { export { type PerformanceInsightsGenerateEmbedResponse as PerformanceInsightsGenerateEmbedResponse, type PerformanceInsightsGenerateEmbedParams as PerformanceInsightsGenerateEmbedParams, type PerformanceInsightsSubmitFeedbackResponse as PerformanceInsightsSubmitFeedbackResponse, type PerformanceInsightsSubmitFeedbackParams as PerformanceInsightsSubmitFeedbackParams, type PerformanceInsightsListFeedbackResponse as PerformanceInsightsListFeedbackResponse, type PerformanceInsightsFeedbackContextResponse as PerformanceInsightsFeedbackContextResponse, type PerformanceInsightsListFeedbackParams as PerformanceInsightsListFeedbackParams, type PerformanceInsightsExportPromptsParams as PerformanceInsightsExportPromptsParams, type PerformanceInsightsStreamParams as PerformanceInsightsStreamParams, }; export { Conversations as Conversations, type ConversationListParams as ConversationListParams, type ConversationCreateParams as ConversationCreateParams, type ConversationRetrieveParams as ConversationRetrieveParams, type ConversationPushMessagesParams as ConversationPushMessagesParams, type ConversationRenameParams as ConversationRenameParams, type ConversationDeleteParams as ConversationDeleteParams, type ConversationExportPromptsParams as ConversationExportPromptsParams, }; } //# sourceMappingURL=performance-insights.d.ts.map