---
title: "Generate Exercise Solution For Admin"
method: POST
path: "/admin/holiday-courses/exercises/generate-solution"
tags: ["Admin - Holiday Courses"]
---

# Generate Exercise Solution For Admin

`POST /admin/holiday-courses/exercises/generate-solution`

Generate a plausible solution for an exercise using AI.

This endpoint:
1. Takes an exercise statement (LaTeX/HTML) and optional difficulty level
2. Uses an LLM to generate a step-by-step solution
3. Returns the generated solution formatted for KaTeX rendering

Only accessible by admin users.

## Request body

- GenerateSolutionRequest — Request model for generating exercise solution via AI
  - `exercise_content` string, required
  - `difficulty` 'easy' | 'medium' | 'hard', nullable

## Response `200`

Successful Response

- GenerateSolutionResponse — Response model for generated exercise solution
  - `generated_solution` string, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/excellence-ai/apis/excellence-learning.md) · [All operations](https://skmtc.dev/excellence-ai/apis/excellence-learning/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/excellence-ai/excellence-learning/revisions/c407f3b5a05b/schema)
