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

Prompts for AI-powered SQL query explanations.

# `fragment_prompt`

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

Build the user prompt for explaining a fragment in context of the full query.

The fragment is the portion the user highlighted/selected. The full query
provides necessary context so the LLM can explain even isolated terms
(e.g., a single JOIN clause, a HAVING condition, or a function call).

## Parameters

- `fragment` - The selected SQL fragment to explain
- `full_sql` - The complete SQL query for context
- `schema_context` - Optional schema context string

# `system_prompt`

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

Generate system prompt for query explanation.

## Parameters

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

# `user_prompt`

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

Build the user prompt for a full query explanation.

## Parameters

- `sql` - The full SQL query to explain
- `schema_context` - Optional schema context string

---

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