import { OpenAssistantTool } from '@openassistant/utils'; import { z } from 'zod'; import { SpatialToolContext } from '../types'; /** * ## cartogram Tool * * This tool creates a Dorling cartogram from given geometries and a variable. * A cartogram is a map where the size of geographic units is proportional to a variable value rather than their actual geographic area. * * ### Cartogram Creation * * A cartogram replaces the original layout of areal units with geometric forms (usually circles) that are proportional to the variable value. * This is useful for visualizing data where geographic size doesn't reflect the importance of the data. * * ### Parameters * - `datasetName`: Name of the dataset containing the geometries and variable * - `variableName`: Name of the variable to use for sizing the cartogram elements * - `iterations`: Number of iterations for cartogram optimization (default: 100) * * **Example user prompts:** * - "Create a Dorling cartogram from the geometries and the variable 'population'" * - "Generate a cartogram showing GDP by country" * - "Make a cartogram of election results by state" * * ### Example * ```typescript * import { cartogram } from "@openassistant/geoda"; * import { convertToVercelAiTool } from "@openassistant/utils"; * * const cartogramTool = { * ...cartogram, * context: { * getGeometries: async (datasetName: string) => { * // Implementation to retrieve geometries from your data source * return geometries; * }, * getValues: async (datasetName: string, variableName: string) => { * // Implementation to retrieve values from your data source * return [100, 200, 150, 300, 250]; * }, * }, * }; * * const result = await generateText({ * model: openai('gpt-4.1', { apiKey: key }), * prompt: 'Create a Dorling cartogram from the geometries and the variable "population"', * tools: { cartogram: convertToVercelAiTool(cartogramTool) }, * }); * ``` */ export declare const cartogram: OpenAssistantTool; export type CartogramFunctionArgs = z.ZodObject<{ datasetName: z.ZodString; variableName: z.ZodString; iterations: z.ZodOptional; }>; export type CartogramLlmResult = { success: boolean; result: string; }; export type CartogramAdditionalData = { datasetName?: string; [outputDatasetName: string]: unknown; }; export type CartogramTool = typeof cartogram;