diff --git a/app/lyric/api/routers/v1/lyric.py b/app/lyric/api/routers/v1/lyric.py index ea808b8..ff01be4 100644 --- a/app/lyric/api/routers/v1/lyric.py +++ b/app/lyric/api/routers/v1/lyric.py @@ -44,6 +44,7 @@ from app.utils.chatgpt_prompt import ChatgptService from app.utils.pagination import PaginatedResponse, get_paginated from app.utils.prompts.prompts import lyric_prompt +import traceback as tb router = APIRouter(prefix="/lyric", tags=["lyric"]) @@ -360,7 +361,7 @@ async def generate_lyric( task_id=task_id, lyric=None, language=request_body.language, - error_message=str(e), + error_message=''.join(tb.format_exception(None, e, e.__traceback__)), ) diff --git a/app/utils/prompts/lyric_prompt.json b/app/utils/prompts/lyric_prompt.json index 1d4ffa8..14df2c4 100644 --- a/app/utils/prompts/lyric_prompt.json +++ b/app/utils/prompts/lyric_prompt.json @@ -1 +1,34 @@ -{"model": "gpt-5-mini", "prompt_variables": ["customer_name", "region", "detail_region_info", "marketing_intelligence_summary", "language", "promotional_expression_example", "timing_rules"], "output_format": {"format": {"type": "json_schema", "name": "lyric", "schema": {"type": "object", "properties": {"lyric": {"type": "string"}}, "required": ["lyric"], "additionalProperties": false}, "strict": true}}} \ No newline at end of file +{ + "model": "gpt-5-mini", + "prompt_variables": [ + "customer_name", + "region", + "detail_region_info", + "marketing_intelligence_summary", + "language", + "promotional_expression_example", + "timing_rules" + ], + "output_format": { + "format": { + "type": "json_schema", + "name": "lyric", + "schema": { + "type": "object", + "properties": { + "lyric": { + "type": "string" + }, + "suno_prompt":{ + "type" : "string" + } + }, + "required": [ + "lyric", "suno_prompt" + ], + "additionalProperties": false + }, + "strict": true + } + } +} \ No newline at end of file diff --git a/app/utils/prompts/lyric_prompt.txt b/app/utils/prompts/lyric_prompt.txt index e379cb2..f434c6f 100644 --- a/app/utils/prompts/lyric_prompt.txt +++ b/app/utils/prompts/lyric_prompt.txt @@ -34,7 +34,7 @@ Mandatory Inclusions: - Region name - Promotion subject - Promotional expressions including: -{promotional_expressions[language]} +{promotional_expression_example} Content Rules: - Lyrics must be emotionally driven, not descriptive listings @@ -64,8 +64,6 @@ Any violation invalidates the entire output [OUTPUT RULES – STRICT] {timing_rules} -8–12 lines -Full verse flow, immersive mood No explanations No headings diff --git a/app/utils/prompts/marketing_prompt.json b/app/utils/prompts/marketing_prompt.json index e9e42dd..c84231a 100644 --- a/app/utils/prompts/marketing_prompt.json +++ b/app/utils/prompts/marketing_prompt.json @@ -1 +1,58 @@ -{"model": "gpt-5-mini", "prompt_variables": ["customer_name", "region", "detail_region_info"], "output_format": {"format": {"type": "json_schema", "name": "report", "schema": {"type": "object", "properties": {"report": {"type": "string"}, "selling_points": {"type": "array", "items": {"type": "object", "properties": {"category": {"type": "string"}, "keywords": {"type": "string"}, "description": {"type": "string"}}, "required": ["category", "keywords", "description"], "additionalProperties": false}}, "tags": {"type": "array", "items": {"type": "string"}}}, "required": ["report", "selling_points", "tags"], "additionalProperties": false}, "strict": true}}} \ No newline at end of file +{ + "model": "gpt-5.2", + "prompt_variables": [ + "customer_name", + "region", + "detail_region_info" + ], + "output_format": { + "format": { + "type": "json_schema", + "name": "report", + "schema": { + "type": "object", + "properties": { + "report": { + "type": "string" + }, + "selling_points": { + "type": "array", + "items": { + "type": "object", + "properties": { + "category": { + "type": "string" + }, + "keywords": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "required": [ + "category", + "keywords", + "description" + ], + "additionalProperties": false + } + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "report", + "selling_points", + "tags" + ], + "additionalProperties": false + }, + "strict": true + } + } +} \ No newline at end of file diff --git a/app/utils/prompts/marketing_prompt.txt b/app/utils/prompts/marketing_prompt.txt index 2cd0921..2bf9307 100644 --- a/app/utils/prompts/marketing_prompt.txt +++ b/app/utils/prompts/marketing_prompt.txt @@ -11,7 +11,7 @@ The report must clearly explain what makes the property sellable, marketable, an [Core Analysis Requirements] Analyze the property based on: -Location, concept, photos, online presence, and nearby environment +Location, concept, and nearby environment Target customer behavior and reservation decision factors Include: - Target customer segments & personas @@ -26,6 +26,7 @@ Focus only on factors that directly influence booking decisions Each selling point must be concise and visually scannable Language must be reusable for ads, short-form videos, and listing headlines Avoid full sentences in descriptions; use short selling phrases +Do not provide in report Output format: [Category] @@ -33,6 +34,7 @@ Output format: One-line selling phrase (not a full sentence) Limit: 5 to 8 Key Selling Points only +Do not provide in report [Content & Automation Readiness Check] Ensure that: diff --git a/app/utils/prompts/marketing_prompt_20260116.txt b/app/utils/prompts/marketing_prompt_20260116.txt new file mode 100644 index 0000000..2cd0921 --- /dev/null +++ b/app/utils/prompts/marketing_prompt_20260116.txt @@ -0,0 +1,62 @@ + +[Role & Objective] +Act as a content marketing expert with strong domain knowledge in the Korean pension / stay-accommodation industry. +Your goal is to produce a Marketing Intelligence Report that will be shown to accommodation owners BEFORE any content is generated. +The report must clearly explain what makes the property sellable, marketable, and scalable through content. + +[INPUT] +- Business Name: {customer_name} +- Region: {region} +- Region Details: {detail_region_info} + +[Core Analysis Requirements] +Analyze the property based on: +Location, concept, photos, online presence, and nearby environment +Target customer behavior and reservation decision factors +Include: +- Target customer segments & personas +- Unique Selling Propositions (USPs) +- Competitive landscape (direct & indirect competitors) +- Market positioning + +[Key Selling Point Structuring – UI Optimized] +From the analysis above, extract the main Key Selling Points using the structure below. +Rules: +Focus only on factors that directly influence booking decisions +Each selling point must be concise and visually scannable +Language must be reusable for ads, short-form videos, and listing headlines +Avoid full sentences in descriptions; use short selling phrases + +Output format: +[Category] +(Tag keyword – 5~8 words, noun-based, UI oval-style) +One-line selling phrase (not a full sentence) +Limit: +5 to 8 Key Selling Points only + +[Content & Automation Readiness Check] +Ensure that: +Each tag keyword can directly map to a content theme +Each selling phrase can be used as: +- Video hook +- Image headline +- Ad copy snippet + + +[Tag Generation Rules] +- Tags must include **only core keywords that can be directly used for viral video song lyrics** +- Each tag should be selected with **search discovery + emotional resonance + reservation conversion** in mind +- The number of tags must be **exactly 5** +- Tags must be **nouns or short keyword phrases**; full sentences are strictly prohibited +- The following categories must be **balanced and all represented**: + 1) **Location / Local context** (region name, neighborhood, travel context) + 2) **Accommodation positioning** (emotional stay, private stay, boutique stay, etc.) + 3) **Emotion / Experience** (healing, rest, one-day escape, memory, etc.) + 4) **SNS / Viral signals** (Instagram vibes, picture-perfect day, aesthetic travel, etc.) + 5) **Travel & booking intent** (travel, getaway, stay, relaxation, etc.) + +- If a brand name exists, **at least one tag must include the brand name or a brand-specific expression** +- Avoid overly generic keywords (e.g., “hotel”, “travel” alone); **prioritize distinctive, differentiating phrases** +- The final output must strictly follow the JSON format below, with no additional text + + "tags": ["Tag1", "Tag2", "Tag3", "Tag4", "Tag5"] diff --git a/app/utils/prompts/prompts.py b/app/utils/prompts/prompts.py index b224cbd..40b0e70 100644 --- a/app/utils/prompts/prompts.py +++ b/app/utils/prompts/prompts.py @@ -46,6 +46,10 @@ class Prompt(): missing_variables = input_data.keys() - set(self.prompt_input) if missing_variables: raise Exception(f"missing_variable for prompt {self.prompt_name} : {missing_variables}") + + flooding_variables = set(self.prompt_input) - input_data.keys() + if flooding_variables: + raise Exception(f"flooding_variables for prompt {self.prompt_name} : {flooding_variables}") return True marketing_prompt = Prompt(