Skip to main content

Magic tips

Make the most of Hex Magic.

Like all AI-driven features, accuracy can vary based on the model, prompt, and other factors. To improve your querying success and give a sense of what you can do, here's some specific examples and advice on how best to work with Magic.

Magic knows about table and column metadata

Magic has context on your tables and schemas that allow it to map to the most relevant data objects. Adding descriptions on your databases, schemas, tables, and columns in the Data browser can improve Magic's responses that reference these objects.

Being as specific as possible in your prompt and using [@ tagging] to reference tables and dataframes will improve response accuracy.

Magic mapping natural language to the appropriate tables and columns

Magic knows what's going on in the rest of your project

Magic also has metadata on your project, so it can reference dataframes and variables that have been created earlier. In the example below, just asking a question about orders prompts Magic to access the orders dataframe from a previous query. It also has access to the columns and datatypes, so it can intelligently operate on the data.

Similarly, if pandas had already been imported in an earlier stage, Magic would have seen that and not re-imported it.

Magic referencing previous query results to answer a question

It helps to be precise

Magic can be a bit like water, taking the path of least resistance if you aren't specific. Reference specific columns, tables, and give examples of your ideal output to make Magic as accurate as possible.

  • Reference a specific table name to get a fine-tuned result:
Specifying a rollup table to guide Magic
  • Specify exactly the shape of the output you want:
Specifying the exact type of output desired