Skip to content

About

πŸ‘‰ Production-oriented FastAPI backend for managing, versioning, rendering, validating, and executing AI prompts with guardrails, logging, testing, Docker, and CI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑ Smart Prompt Studio

A production-minded backend for managing, rendering, validating, and executing reusable AI prompts.

🧠 Prompt Management β€’ πŸ›‘οΈ Guardrails β€’ πŸ€– AI Execution β€’ πŸ“‹ Evaluation β€’ πŸ“¦ Docker β€’ πŸ”„ CI

Python FastAPI OpenAI Tests CI


πŸš€ What is Smart Prompt Studio?

Smart Prompt Studio is a FastAPI-based backend built around one simple idea:

Treat prompts like backend-managed application assets, not random strings buried inside code.

Instead of scattering prompts throughout an application, this service provides a central layer for:

  • πŸ“ Creating prompts
  • πŸ”’ Managing prompt versions
  • 🧩 Rendering variables
  • πŸ›‘οΈ Validating prompts before execution
  • πŸ€– Sending prompts to an AI provider
  • πŸ“Š Tracking execution behavior
  • πŸ§ͺ Testing failure paths
  • πŸ“‹ Evaluating prompt behavior
  • πŸͺ΅ Logging requests and services
  • 🐳 Running inside Docker
  • πŸ”„ Validating changes through GitHub Actions

The project is intentionally small.

The engineering lessons are not.


✨ Core Features

πŸ“ Prompt Management

Create reusable prompts through the API.

POST /prompts

Prompts contain structured messages instead of one giant string.

This keeps prompt construction explicit and maintainable.


🎯 Project Goal

The goal is to build a clean foundation for AI-powered backend systems.

Smart Prompt Studio focuses on the engineering layer surrounding an LLM:

Client
  β”‚
  β–Ό
FastAPI API
  β”‚
  β–Ό
Prompt Service
  β”‚
  β”œβ”€β”€ Versioning
  β”œβ”€β”€ Variable Rendering
  └── Validation
  β”‚
  β–Ό
Guardrail Service
  β”‚
  β–Ό
AI Service
  β”‚
  β–Ό
AI Provider
  β”‚
  β–Ό
Response


πŸ—οΈ Architecture

The project follows a service-oriented FastAPI structure.

Smart-Prompt-Studio/
β”‚
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ config.py
β”‚   β”œβ”€β”€ logging_config.py
β”‚   β”œβ”€β”€ main.py
β”‚   β”œβ”€β”€ schemas.py
β”‚   β”‚
β”‚   β”œβ”€β”€ exceptions/
β”‚   β”‚   β”œβ”€β”€ custom_exceptions.py
β”‚   β”‚   └── handlers.py
β”‚   β”‚
β”‚   β”œβ”€β”€ middleware/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   └── request_logging.py
β”‚   β”‚
β”‚   └── services/
β”‚       β”œβ”€β”€ ai_service.py
β”‚       β”œβ”€β”€ guardrail_service.py
β”‚       └── prompt_service.py
β”‚
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ test_ai_service_errors.py
β”‚   β”œβ”€β”€ test_ai_service_logging.py
β”‚   └── test_prompt_evalutation.py
β”‚
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── ci.yml
β”‚
β”œβ”€β”€ .dockerignore
β”œβ”€β”€ .env.example
β”œβ”€β”€ .gitignore
β”œβ”€β”€ Dockerfile
└── requirements.txt

🧰 Tech Stack

Technology                                  Purpose
-🐍 Python                               Application language
-⚑ FastAPI                              API framework
-πŸ“¦ Pydantic                             Data validation
-πŸ€– OpenAI-compatible SDK                AI communication
-πŸ§ͺ Pytest                               Automated testing
-🐳 Docker                               Containerization
-πŸ”„ GitHub Actions                       CI
-πŸͺ΅ Python Logging                       Observability
-🌿 Git                                  Version control

πŸ“Œ Current Status

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Smart Prompt Studio          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Prompt Management       βœ…   β”‚
β”‚ Versioning              βœ…   β”‚
β”‚ Variable Rendering      βœ…   β”‚
β”‚ Guardrails              βœ…   β”‚
β”‚ AI Integration          βœ…   β”‚
β”‚ Error Handling          βœ…   β”‚
β”‚ Logging                 βœ…   β”‚
β”‚ Automated Tests         βœ…   β”‚
β”‚ Docker                  βœ…   β”‚
β”‚ GitHub Actions CI       βœ…   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Local test suite:

10 passed

CI:

βœ… Passed

Docker:

βœ… Verified


⚑ Final Snapshot

Smart Prompt Studio is a compact AI backend focused on one principle:

Build the engineering around the model, not just the model call.

It combines:

⚑ FastAPI
🧠 Prompt Management
πŸ›‘οΈ Guardrails
πŸ€– AI Execution
πŸͺ΅ Logging
πŸ§ͺ Testing
🐳 Docker
πŸ”„ CI
🌿 Git

Small enough to understand.

Structured enough to extend.

Practical enough to build upon.


πŸ—Ώ Built With Python

Made as part of a hands-on journey toward production-grade AI Backend Engineering.

Code β†’ Test β†’ Containerize β†’ Automate β†’ Ship

Smart Prompt Studio

The prompt is only the beginning.

About

πŸ‘‰ Production-oriented FastAPI backend for managing, versioning, rendering, validating, and executing AI prompts with guardrails, logging, testing, Docker, and CI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages