본문으로 건너뛰기

PromptTemplating

Prompt 저장/변수치환/캐싱/버전관리 + 운영자 Filament UI (scope 매핑은 SaaS � 임)

상태

항목
Layerfoundation
TierL0
Statusreleased
Version1.0.0
가격Free (free)
**카�
�고리**AI / LLM

개요

개요

PromptTemplating 은 multi-saas-kit 의 Layer 0 Foundation Plugin � 니다. 운영자가 LLM system prompt 를 코드 수정 없이 편집할 수 있는 저장 + 변수치환 + 캐싱 + 버전관리 + Filament UI 를 표준화합니다.

⚠️ 분리선 결정 (2026-05)

5계층 scope (학교급/학� �/과목/레슨/문제지) 추상화는 의도적으로 plugin 에 포함하지 않음.

분석 결과:

  • 교육 SaaS (exam/academy): 5계층 (학교급/학� �/과목/레슨/문제지)
  • 챗봇 SaaS (agent.how): 2계층 (tenant/agent_definition)
  • 커머스 SaaS: N계층 (카� �고리 트리)
  • 각 SaaS 의 scope 구조가 너무 다름 → 추상화 비용이 직접 작성 비용보다 큼

현실적 분리선:

| 영역 | � 임 | 비고 | |------|------|------| | Plugin (범용) | PromptTemplate Model + 변수치환 + 캐싱 + 버전관리 + Filament 운영자 UI | 모든 SaaS 공유 | | SaaS (도메인) | scope 모델 정의 + scope 우선순위 결정 + LLM 호출 시점 | 도메인 특화 |

구성 (Phase 3 본격 RC)

Plugin 영역 (예정)

// 1) Model
class PromptTemplate extends Model {
protected $fillable = [
'tenant_id', 'key', 'scope_type', 'scope_id',
'content', 'version', 'is_active',
];
}

// 2) 변수 치환 (Pure)
class VariableSubstitutor {
public function substitute(string $template, array $variables): string;
}

// 3) 캐싱 wrapper
class CachedPromptResolver {
public function resolve(string $key, array $context): ?PromptTemplate;
}

// 4) Filament Resource (Phase 3 의 핵심 가치)
// - PromptTemplateResource (목록 + 검색 + scope 필터)
// - 미리보기 (변수 치환 결과)
// - draft → published 워크플로
// - 버전 비교 / 롤백
// - tenant 단위 격리 (BelongsToTenant)

SaaS 영역 (각자 구현)

// exam.how 의 5계층 scope priority
class ExamPromptResolver {
public function resolveForQuestion(int $worksheetProfileId): string {
// 1) worksheet_profile scope 조회
// 2) chapter scope fallback
// 3) grade scope fallback
// 4) subject scope fallback
// 5) school_level scope fallback
// 6) merge 또는 override 정�
결정
// 7) plugin 의 VariableSubstitutor 호출
}
}

// agent.how 의 2계층 scope priority
class AgentPromptResolver {
public function resolveForAgent(int $agentId): string {
// 1) agent_definition scope 조회
// 2) tenant scope fallback
// 3) plugin 의 VariableSubstitutor 호출
}
}

가치 분석

기능직접 구현 비용Plugin 활용 비용
운영자 prompt 편집 UI (Filament Resource + diff + 미리보기 + 롤백)1~2일30분 (활성 + scope 인터페이스 구현)
변수 치환 / 캐싱 / 버전관리0.5일즉시 사용

Plugin ROI 의 핵심은 "Pure logic" 이 아니라 "Filament 운영 UI 표준화"

진행 상황

1.0.0 RC complete (2026-05-01).

  • � Plugin/ServiceProvider/Config
  • � Migration (plg_prompt_templates + plg_prompt_template_versions)
  • � Model (PromptTemplate + PromptTemplateVersion, BelongsToTenant + SoftDeletes)
  • � VariableSubstitutor + CachedPromptResolver + PromptResolverInterface
  • � Filament PromptTemplateResource (CRUD + Publish + 자동 변수추출 + 자동 버전 스� 샷)
  • � exam.how / agent.how 어댑터 example (docs/examples/)

출처 (참고)

exam.how 의 App\Services\PromptTemplateResolver (428줄, 5계층 hard-coded) + App\Models\PromptTemplate (184줄). 5계층 추상화는 plugin 으로 포함하지 않고, PromptTemplate Model + 운영 UI 만 추출.

다른 Plugin 과의 관계

다음 plugin 들이 본 plugin 을 활용 가능 (필수 아님 — optional 의존):

  • AiRelay — LLM 호출 직전 prompt 합성 (호출자가 plugin 의 VariableSubstitutor 만 사용)
  • QuestionGeneration / StagePipeline / ReviewQueue / AssessmentReport — 도메인 scope priority 직접 작성 후 plugin 의 변수치환 + 운영 UI 활용

라이선스

MIT

데모


🛒 Plugin Store에서 보기: store.codebase.how/plugins/prompt-templating