import { OpenAssistantTool } from '@openassistant/utils'; import { z } from 'zod'; import { GetValues } from '@openassistant/plots'; export type StandardizeVariableToolArgs = z.ZodObject<{ datasetName: z.ZodString; variableName: z.ZodString; standardizationMethod: z.ZodEnum<['deviationFromMean', 'standardizeMAD', 'rangeAdjust', 'rangeStandardize', 'standardize']>; saveData: z.ZodOptional; }>; export type StandardizeVariableToolLlmResult = { success: boolean; details?: string; error?: string; instruction?: string; }; export type StandardizeVariableToolAdditionalData = { saveData: boolean; datasetName: string; [key: string]: { type: string; content: Record; } | unknown; }; export type StandardizeVariableToolResult = { llmResult: StandardizeVariableToolLlmResult; additionalData?: StandardizeVariableToolAdditionalData; }; export type StandardizeVariableToolContext = { getValues: GetValues; }; /** * ## standardizeVariable Tool * * This tool standardizes a variable using various statistical methods. * Standardization transforms data to have a mean of 0 and standard deviation of 1, making different variables comparable. * * ### Standardization Methods * * The tool supports various standardization methods: * - **deviationFromMean**: Standardizes to mean=0, std=1 (most common) * - **standardizeMAD**: Uses median and MAD instead of mean and std * - **rangeAdjust**: Scales to range [0,1] * - **rangeStandardize**: Scales using interquartile range * - **standardize**: Z-score standardization * * ### Parameters * - `datasetName`: Name of the dataset containing the variable * - `variableName`: Name of the variable to standardize * - `standardizationMethod`: Standardization method to use (see above) * - `saveData`: Whether to save the standardized values (optional) * * **Example user prompts:** * - "Standardize the population variable using z-score method" * - "Normalize the income data using min-max scaling" * - "Apply robust standardization to the housing prices" * * ### Example * ```typescript * import { standardizeVariable } from "@openassistant/geoda"; * import { convertToVercelAiTool } from "@openassistant/utils"; * * const standardizeTool = { * ...standardizeVariable, * context: { * getValues: async (datasetName: string, variableName: string) => { * // Implementation to retrieve values from your data source * return [100, 200, 150, 300, 250, 180, 220, 190, 280, 210]; * }, * }, * }; * * const result = await generateText({ * model: openai('gpt-4.1', { apiKey: key }), * prompt: 'Standardize the population variable using z-score method', * tools: { standardizeVariable: convertToVercelAiTool(standardizeTool) }, * }); * ``` */ export declare const standardizeVariable: OpenAssistantTool; export type StandardizeVariableTool = typeof standardizeVariable;