Luigi commited on
Commit
ee32282
·
1 Parent(s): d8028fb

Refine title generation prompt and parameters

Browse files

- Update title prompt to be more specific about single title generation
- Reduce max_tokens from 50 to 20 for shorter titles
- Improve system message to emphasize single title output
- Add word limit guidance in prompt

Files changed (1) hide show
  1. src/summarization.py +3 -3
src/summarization.py CHANGED
@@ -206,7 +206,7 @@ def summarize_transcript_langchain(transcript: str, selected_gguf_model: str, pr
206
 
207
  def create_title_prompt() -> PromptTemplate:
208
  """Prompt for generating a document title"""
209
- template = """Generate a concise, descriptive title for this transcript. The title should capture the main topic or theme.
210
 
211
  Transcript:
212
  {text}
@@ -243,11 +243,11 @@ def generate_title(transcript: str, selected_gguf_model: str) -> str:
243
  # Generate title
244
  response = llm.create_chat_completion(
245
  messages=[
246
- {"role": "system", "content": "You are an expert at creating concise, descriptive titles for documents and transcripts."},
247
  {"role": "user", "content": formatted_prompt}
248
  ],
249
  stream=False,
250
- max_tokens=50, # Limit title length
251
  )
252
 
253
  title = response['choices'][0]['message']['content'].strip()
 
206
 
207
  def create_title_prompt() -> PromptTemplate:
208
  """Prompt for generating a document title"""
209
+ template = """Generate a single, concise title for this transcript that captures the main topic or theme. Keep it under 10 words.
210
 
211
  Transcript:
212
  {text}
 
243
  # Generate title
244
  response = llm.create_chat_completion(
245
  messages=[
246
+ {"role": "system", "content": "You are an expert at creating single, concise titles for documents and transcripts. Always provide exactly one title, nothing else."},
247
  {"role": "user", "content": formatted_prompt}
248
  ],
249
  stream=False,
250
+ max_tokens=20, # Very short for titles
251
  )
252
 
253
  title = response['choices'][0]['message']['content'].strip()