Skip to content

feat: AI tag suggestion endpoint #48

@meninoebom

Description

@meninoebom

Phase 4a — Backend

Add a backend endpoint that uses Claude to suggest tags for a theme based on its content.

Acceptance Criteria

  • anthropic added to pyproject.toml dependencies
  • ANTHROPIC_API_KEY env var documented and added to Railway
  • POST /api/themes/{theme_id}/suggest-tags endpoint (auth required)
    • Fetches theme body_md from DB
    • Queries all existing tag names for context (prefer reuse)
    • Calls Claude Haiku with prompt to suggest 3–5 tags
    • Returns {"tags": ["tag-one", "tag-two"]}, normalized via existing tag format
  • Returns 404 if theme not found
  • Tests with mocked anthropic client

Notes

  • No migration needed
  • Tag names normalized through existing [a-z0-9-] format

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions