# `Lotus.AI.Prompts.Optimization`
[🔗](https://github.com/typhoonworks/lotus/blob/v0.16.6/lib/lotus/ai/prompts/optimization.ex#L1)

System prompts for AI-powered query optimization suggestions.

# `parse_suggestions`

```elixir
@spec parse_suggestions(String.t()) :: [map()]
```

Parse the AI response into a list of suggestion maps.

Returns a list of validated suggestion maps or an empty list if parsing fails.

# `system_prompt`

```elixir
@spec system_prompt(atom()) :: String.t()
```

Generate system prompt for query optimization analysis.

## Parameters

- `database_type` - Database type (e.g., :postgres, :mysql, :sqlite)

# `user_prompt`

```elixir
@spec user_prompt(String.t(), String.t() | nil, String.t() | nil) :: String.t()
```

Build the user prompt containing the SQL and execution plan.

## Parameters

- `sql` - The SQL query to optimize
- `execution_plan` - The execution plan string (from EXPLAIN)
- `schema_context` - Optional schema context string

---

*Consult [api-reference.md](api-reference.md) for complete listing*
