import type { TSchema, Type, Static } from "@sinclair/typebox"; import { AiAssistantProps, ChatData, ChatItem, GetChatCompletionOptions, GetStructuredResponseOptions, ToolDeclaration, AiAssistantSuggestedPromptsProps, GetFollowUpSuggestions, ChatDataFile, } from "./sharedTypes"; export const getDefaultGetFollowUpSuggestions: (args: { promptOverride?: string; }) => GetFollowUpSuggestions; export function AiAssistant(args: AiAssistantProps): JSX.Element; export function AiAssistantSuggestedPrompts( args: AiAssistantSuggestedPromptsProps ): JSX.Element; /** * IMPORTANT: These types must be kept in sync with the source files: * - AiResponseRating and GenAIRatingComponentProps are defined in src/frontend/components/GenAIRatingComponent.tsx * - GenAIRatingComponentApolloWrappedProps is defined in src/frontend/components/GenAIRatingComponentApolloWrapped.tsx * * When updating these types in the source, you MUST also update them here. */ export interface AiResponseRating { id: string; userRating?: "THUMBS_UP" | "THUMBS_DOWN" | null; userComment?: string | null; } export interface GenAIRatingComponentProps { responseType: "WTC_MESSAGE" | "SURVEY_SUMMARY" | "COMMENTS_SUMMARY"; responseId: string; genAiMessage: string; genAiMessageTimestamp: string; onSubmitRating: (input: any) => Promise; isLoading?: boolean; error?: Error; aiResponseRating?: AiResponseRating | null; } export type GenAIRatingComponentApolloWrappedProps = Omit< GenAIRatingComponentProps, "onSubmitRating" | "isLoading" | "error" | "aiResponseRating" > & { /** * Optional CSS value for the top position of success/error toasts. * * Use this to position toasts below fixed headers or other UI elements that might * obscure them. Accepts any valid CSS top value (e.g., "80px", "5rem", "10%"). * * @example * // Position toasts 80px from the top, below a fixed admin header * * * @default undefined (uses the default toast position from Confetti) */ toastTop?: string; }; export function GenAIRatingComponent( args: GenAIRatingComponentProps ): JSX.Element; export function GenAIRatingComponentApolloWrapped( args: GenAIRatingComponentApolloWrappedProps ): JSX.Element; export const tools: { kazooTools: { getRewardsAndRecognitionCurrentUserTool: ToolDeclaration; }; sharedTools: { doMathTool: ToolDeclaration; getCurrentTimeTool: ToolDeclaration; askSingleShotQuestion: ToolDeclaration; analyzeCurrentPage: ToolDeclaration; }; /** * Helper function to define a new tool for the AI Assistant. * * The tool's name, description, and the full schema of its parameters (including * their descriptions) are sent to the LLM at the beginning of every interaction. * The LLM uses this information to understand what the tool does and decide * when and how to call it. * * Providing a clear, descriptive tool `description` and detailed descriptions * for each field in the `parameters` object is essential for reliable tool calling. */ createTool(args: { name: string; /** * A description of the tool that is provided to the LLM. * This tells the LLM what the tool is capable of getting or doing, helping it * decide when to invoke it. */ description: string; /** * A user-friendly, present-tense name for the tool (e.g., "Performing calculations"). * This is shown in the AI Assistant UI while the tool is executing. */ displayName: string; /** * A user-friendly, past-tense name for the tool (e.g., "Performed calculations"). * This is shown in the AI Assistant's debug mode after the tool has finished executing. */ pastTenseDisplayName: string; /** * A function that returns a JSON schema (using TypeBox) defining the arguments * required by the tool. Each field in the schema should include a `description` * to help the LLM provide accurate values. */ parameters?: (t: typeof Type) => TParams; /** * The implementation function for the tool. This is called when the LLM * decides to invoke the tool. */ fulfill: (args: Static) => Promise; /** * Currently unused. Investigate intent and potential removal before using. */ chatItemMatches?: (chatItem: ChatItem) => boolean; }): ToolDeclaration; } = {}; export const config: { /** * Get the URL for the LLM call. */ getLlmCallUrl: () => string; /** * Get the configured LLM region override. Returns `undefined` when no * override is set (the server then uses its default region). */ getLlmRegion: () => string | undefined; /** * Get the URL for the structured response call. */ getStructuredResponseUrl: () => string; /** * Get the URL for the Kazoo service. */ getKazooUrl: (urlPath: string) => string; /** * Get the URL for the Pulse service. */ getPulseUrl: (urlPath: string) => string; /** * Get the Pulse bearer token. */ getPulseBearerToken: () => string; /** * Set the strategy for getting Kazoo URLs. */ setKazooUrlStrategy: (strategy: (urlPath: string) => string) => void; /** * Set the strategy for getting LLM call URLs. */ setLlmCallUrlStrategy: (strategy: (path: string) => string) => void; /** * Set the strategy for selecting the LLM region. The strategy is invoked * on every chat / structured-response call, so consumers can return a * dynamically-resolved value (e.g. a feature-flag value). * * Returning `undefined` (or an empty string) tells the server to use its * default region (the `GCP_LLM_LOCATION` env var on kazoo-web). Returning * a region name (e.g. "global", "us-central1") sends it as the `region` * field in the request body, and the server forwards it as a per-call * Vertex location override. */ setLlmRegionStrategy: (strategy: () => string | undefined) => void; /** * Set the strategy for getting Pulse URLs. */ setPulseUrlStrategy: (strategy: (urlPath: string) => string) => void; /** * Set the strategy for getting Pulse bearer tokens. */ setPulseBearerTokenStrategy: (strategy: () => string) => void; /** * Set the strategy for getting structured response URLs. */ setStructuredResponseUrlStrategy: ( strategy: (path: string) => string ) => void; /** * Set the main content selector for the page for when taking screenshots. */ setScreenshotMainContentSelector: (selector: string) => void; /** * Get the main content selector for the page for when taking screenshots. */ getScreenshotMainContentSelector: () => string; /** * Set the strategy for getting synthesize URLs. */ setSynthesizeUrlStrategy: (strategy: () => string) => void; /** * Set the strategy for getting transcribe URLs. */ setTranscribeUrlStrategy: (strategy: () => string) => void; } = {}; /** * Makes a structured response request to the LLM API. */ export function getStructuredResponse( args: GetStructuredResponseOptions ): Promise>; /** * Makes a chat completion request to the LLM API. Can be used both with streaming and non-streaming responses. * For streaming responses, provides callbacks for handling chunks and errors. */ export function getChatCompletion( args: GetChatCompletionOptions ): Promise; export * from "./sharedTypes";