> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prophecy.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate expressions in gems

> Automatically generate expressions with natural language

Copilot enhances the expression-building experience within gem configurations in two ways:

* Suggesting context-aware expressions based on your input and column metadata.
* Accepting natural language prompts to build new expressions.

## Copilot suggestions

Copilot suggests expressions based on semantic cues from your column names. To accept Copilot suggestions, click `tab` or click on the expression itself in the gem.

For best results, use descriptive column names.

* **Recommended**: `customer_email`

  Clear intent, likely to produce accurate suggestions.

* **Not recommended**: `col1`

  Ambiguous, may result in less reliable output.

<img src="https://mintcdn.com/prophecy-62973bd0/H0ZTapkqkd-vL9H9/data-analysis/gems/copilot/img/copilot-expressions.gif?s=d0a512ec341601d3250a7e736a4995cf" alt="Copilot expressions" width="2870" height="1608" data-path="data-analysis/gems/copilot/img/copilot-expressions.gif" />

## Copilot prompts

If you want to build your own expression, you can ask Copilot to help. Copilot is available for writing expressions in both the visual and code view.

1. Click on an expression field in a gem.
2. Click **Ask AI** to enter a prompt.
3. Copilot uses your prompt to generate an expression.

## Example prompts

The following are example prompts you can use to generate expressions in gems.

| Scenario             | Prompt                                                             |
| -------------------- | ------------------------------------------------------------------ |
| Basic transformation | “Extract the domain from the `email` column.”                      |
| String formatting    | “Capitalize the first letter of each word in `customer_name`.”     |
| Date parsing         | “Convert `order_date` to YYYY-MM format.”                          |
| Conditional logic    | “If `amount` > 1000, then label as 'high value', else 'standard'.” |
| Null handling        | “Replace null values in `zipcode` with '00000'.”                   |
| Math calculation     | “Calculate discount as `price` \* `discount_rate`.”                |
