Skip to main content
Core.Today

Templates

사전 정의된 AI 프롬프트 템플릿을 사용하여 일관된 결과물을 생성합니다. 시스템 템플릿을 복제하여 커스터마이징하거나 직접 템플릿을 생성할 수 있습니다.

주요 기능

  • 4계층 구조: Persona, Reasoning Flow, Input Schema, Output Schema
  • 시스템 템플릿: 검증된 프롬프트 템플릿 즉시 사용
  • 커스텀 템플릿: 팀 전용 템플릿 생성 및 관리
  • 동적 입력: JSON Schema 기반 폼 자동 생성
  • 구조화된 출력: JSON 또는 텍스트 형식 지정
  • 스트리밍: 실시간 응답 스트리밍 지원

템플릿 구조

템플릿은 4개의 계층으로 구성됩니다:

1. Persona Layer

AI의 역할, 정체성, 전문성 정의

2. Reasoning Protocol

사고 절차, 분석 순서 지정

3. Input Schema

사용자 입력 폼 정의

4. Output Schema

출력 형식 (JSON/텍스트) 지정

1

템플릿 목록 조회

팀 템플릿과 시스템 템플릿을 조회합니다.

curl https://api.core.today/v1/templates \
  -H "X-API-Key: cdt_your_api_key"

응답 예시

{
  "success": true,
  "templates": [
    {
      "uid": "tpl_abc123",
      "name": "Content Style Transformer",
      "slug": "content-rewriter",
      "category": "writing",
      "description": "콘텐츠 스타일 변환기",
      "tags": ["writing", "style", "transform"],
      "team_id": "SYSTEM",
      "usage_count": 1250,
      "icon": "✏️"
    },
    {
      "uid": "tpl_xyz789",
      "name": "My Custom Template",
      "category": "custom",
      "team_id": "team_abc",
      "usage_count": 42
    }
  ],
  "total": 2
}
2

템플릿 상세 조회

템플릿의 상세 정보와 입력 스키마를 조회합니다.

curl https://api.core.today/v1/templates/{template_uid} \
  -H "X-API-Key: cdt_your_api_key"

응답 예시

{
  "success": true,
  "template": {
    "uid": "tpl_abc123",
    "name": "Content Style Transformer",
    "description": "콘텐츠의 스타일을 변환합니다",
    "category": "writing",
    "persona": "You are a professional content editor...",
    "reasoning_flow": [
      "Analyze the source content style",
      "Identify key points to preserve",
      "Transform to target style"
    ],
    "input_schema": {
      "fields": [
        {
          "name": "content",
          "type": "textarea",
          "label": "Original Content",
          "required": true
        },
        {
          "name": "target_style",
          "type": "select",
          "label": "Target Style",
          "options": ["formal", "casual", "academic"]
        }
      ]
    },
    "output_schema": {
      "type": "text"
    },
    "model_policy": {
      "provider": "openai",
      "model": "gpt-4o",
      "temperature": 0.7,
      "max_tokens": 4096
    }
  }
}
3

템플릿 실행

템플릿에 입력값을 전달하여 AI 응답을 생성합니다.

비스트리밍 실행

curl -X POST https://api.core.today/v1/templates/{template_uid}/execute \
  -H "X-API-Key: cdt_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "input_values": {
      "content": "고구마는 맛있다를 주장",
      "source_style": "informal",
      "target_style": "formal",
      "preserve_length": "same"
    }
  }'

응답 예시

{
  "success": true,
  "execution": {
    "execution_id": "exec_abc123",
    "template_uid": "tpl_abc123",
    "status": "completed",
    "output": "고구마는 맛이 매우 뛰어난 식품이라고 할 수 있습니다.",
    "output_type": "text",
    "execution_time_ms": 2340,
    "model_used": "gpt-4o",
    "created_at": "2024-12-30T10:00:00Z"
  }
}

스트리밍 실행

SSE(Server-Sent Events)를 통해 실시간으로 응답을 받습니다.

curl -X POST https://api.core.today/v1/templates/{template_uid}/execute/stream \
  -H "X-API-Key: cdt_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "input_values": {
      "content": "AI 기술의 발전",
      "target_style": "academic"
    }
  }'

스트리밍 응답 형식

data: AI
data: 기술의
data: 발전은
data: 현대
data: 사회에
data: 지대한
data: 영향을
data: 미치고
data: 있습니다.
data: [DONE]

실행 옵션

실행 시 모델 설정을 오버라이드할 수 있습니다.

{
  "input_values": {
    "content": "변환할 콘텐츠"
  },
  "model_override": "gpt-4o-mini",  // 모델 변경
  "temperature_override": 0.5       // 온도 조절
}
파라미터타입설명
input_valuesobject템플릿 입력 스키마에 맞는 값 (필수)
model_overridestring사용할 모델 ID (선택)
temperature_overridenumber온도 설정 0.0-2.0 (선택)

카테고리

💼

business

📊

analysis

✏️

writing

productivity

💻

development

📢

marketing

🎓

education

🧩

custom

SDK 예제

JavaScript / TypeScript

import axios from 'axios';

const api = axios.create({
  baseURL: 'https://api.core.today/v1',
  headers: { 'X-API-Key': 'cdt_your_api_key' }
});

// 템플릿 목록 조회
const { data: templates } = await api.get('/templates');
console.log(templates);

// 템플릿 실행 (비스트리밍)
const { data: result } = await api.post('/templates/tpl_abc123/execute', {
  input_values: {
    content: '변환할 텍스트',
    target_style: 'formal'
  }
});
console.log(result.execution.output);

// 템플릿 실행 (스트리밍)
const response = await fetch('https://api.core.today/v1/templates/tpl_abc123/execute/stream', {
  method: 'POST',
  headers: {
    'X-API-Key': 'cdt_your_api_key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    input_values: { content: '스트리밍 테스트' }
  })
});

const reader = response.body.getReader();
const decoder = new TextDecoder();

while (true) {
  const { done, value } = await reader.read();
  if (done) break;

  const text = decoder.decode(value);
  const lines = text.split('\n');

  for (const line of lines) {
    if (line.startsWith('data: ') && line !== 'data: [DONE]') {
      process.stdout.write(line.slice(6));
    }
  }
}

Python

import requests
import sseclient  # pip install sseclient-py

API_KEY = "cdt_your_api_key"
BASE_URL = "https://api.core.today/v1"
headers = {"X-API-Key": API_KEY}

# 템플릿 목록 조회
templates = requests.get(f"{BASE_URL}/templates", headers=headers).json()
print(templates)

# 템플릿 실행 (비스트리밍)
result = requests.post(
    f"{BASE_URL}/templates/tpl_abc123/execute",
    headers=headers,
    json={
        "input_values": {
            "content": "변환할 텍스트",
            "target_style": "formal"
        }
    }
).json()
print(result["execution"]["output"])

# 템플릿 실행 (스트리밍)
response = requests.post(
    f"{BASE_URL}/templates/tpl_abc123/execute/stream",
    headers={**headers, "Accept": "text/event-stream"},
    json={"input_values": {"content": "스트리밍 테스트"}},
    stream=True
)

client = sseclient.SSEClient(response)
for event in client.events():
    if event.data != "[DONE]":
        print(event.data, end="", flush=True)

시스템 템플릿

즉시 사용 가능한 검증된 템플릿입니다. 대시보드에서 복제하여 커스터마이징할 수 있습니다.

템플릿카테고리설명
Startup Pitch Expertbusiness스타트업 IR 피치덱 분석 및 피드백
Tech Doc Analyzeranalysis기술 문서 분석 및 요약
Content Rewriterwriting콘텐츠 스타일 변환
Meeting Summarizerproductivity회의록을 액션 아이템으로 정리
Code Review Assistantdevelopment코드 리뷰 및 개선 제안

API 엔드포인트 요약

메서드엔드포인트설명
GET/templates템플릿 목록 조회
GET/templates/{uid}템플릿 상세 조회
POST/templates/{uid}/execute템플릿 실행 (비스트리밍)
POST/templates/{uid}/execute/stream템플릿 실행 (스트리밍)

Best Practices

  • 템플릿 선택: 목적에 맞는 시스템 템플릿을 먼저 찾아보고, 필요시 복제하여 커스터마이징하세요.
  • 입력 검증: 템플릿의 input_schema를 확인하고 필수 필드를 모두 전달하세요.
  • 스트리밍: 긴 응답이 예상되면 스트리밍 엔드포인트를 사용하여 사용자 경험을 개선하세요.
  • 모델 선택: 빠른 응답이 필요하면 gpt-4o-mini, 품질이 중요하면 gpt-4o를 사용하세요.
  • 에러 처리: 스트리밍 응답에서 JSON 에러 메시지를 확인하고 적절히 처리하세요.