Files
robinhood/backend/app/api/prompts.py

21 lines
573 B
Python

from __future__ import annotations
from fastapi import APIRouter, HTTPException
from typing import Any, Dict, List
from app.services.prompts import list_templates, get_template
router = APIRouter(prefix="/prompt-templates", tags=["Prompts"])
@router.get("")
async def list_prompt_templates() -> List[Dict[str, Any]]:
return list_templates()
@router.get("/{name}")
async def get_prompt_template(name: str) -> Dict[str, Any]:
try:
return get_template(name)
except KeyError:
raise HTTPException(status_code=404, detail="Template not found")