Switch to Sonnet for better accuracy, stronger anti-hallucination prompt

This commit is contained in:
root
2026-03-31 19:41:13 -05:00
parent 5773870c91
commit 2cb6f4d6b2
3 changed files with 13 additions and 11 deletions

View File

@@ -109,7 +109,7 @@ Return ONLY the JSON object."""
# Call Claude API
client = anthropic.Anthropic(api_key=settings.ANTHROPIC_API_KEY)
message = client.messages.create(
model="claude-haiku-4-5-20251001",
model="claude-sonnet-4-20250514",
max_tokens=2000,
messages=[{"role": "user", "content": prompt}],
)

View File

@@ -127,7 +127,7 @@ Return ONLY the JSON object."""
client = anthropic.Anthropic(api_key=settings.ANTHROPIC_API_KEY)
message = client.messages.create(
model="claude-haiku-4-5-20251001",
model="claude-sonnet-4-20250514",
max_tokens=2000,
messages=[{"role": "user", "content": prompt}],
)
@@ -217,7 +217,7 @@ Return ONLY the JSON object."""
client = anthropic.Anthropic(api_key=settings.ANTHROPIC_API_KEY)
message = client.messages.create(
model="claude-haiku-4-5-20251001",
model="claude-sonnet-4-20250514",
max_tokens=2000,
messages=[{"role": "user", "content": prompt}],
)
@@ -313,7 +313,7 @@ Return ONLY the JSON object."""
client = anthropic.Anthropic(api_key=settings.ANTHROPIC_API_KEY)
message = client.messages.create(
model="claude-haiku-4-5-20251001",
model="claude-sonnet-4-20250514",
max_tokens=4000,
messages=[{"role": "user", "content": prompt}],
)
@@ -431,7 +431,7 @@ Only recommend real songs. Return ONLY the JSON array."""
client = anthropic.Anthropic(api_key=settings.ANTHROPIC_API_KEY)
message = client.messages.create(
model="claude-haiku-4-5-20251001",
model="claude-sonnet-4-20250514",
max_tokens=4000,
messages=[{"role": "user", "content": prompt}],
)
@@ -565,7 +565,7 @@ Only use real songs. Return ONLY the JSON."""
client = anthropic.Anthropic(api_key=settings.ANTHROPIC_API_KEY)
message = client.messages.create(
model="claude-haiku-4-5-20251001",
model="claude-sonnet-4-20250514",
max_tokens=4000,
messages=[{"role": "user", "content": prompt}],
)

View File

@@ -218,20 +218,22 @@ ALREADY RECOMMENDED BEFORE (do NOT repeat any of these — every recommendation
{disliked_instruction}
{exclude_instruction}
Respond with exactly {count} music recommendations as a JSON array. Only recommend songs that actually exist — do not invent or guess song titles. Each item should have:
- "title": song title
- "artist": artist name
- "album": album name (if known)
Respond with exactly {count} music recommendations as a JSON array. Each item should have:
- "title": the EXACT real song title as it appears on streaming platforms
- "artist": the EXACT real artist name
- "album": the real album name (if known)
- "reason": A warm, personal 2-3 sentence explanation of WHY they'll love this track. Reference specific qualities from their taste profile. Be specific about sonic qualities, not generic.
- "score": confidence score 0.0-1.0
CRITICAL: Every song MUST be a real, verifiable song that exists on YouTube Music, Spotify, or Apple Music. Do NOT invent songs, guess titles, or combine wrong artists with wrong songs. If you are not 100% certain a song exists with that exact title by that exact artist, do NOT include it. It is better to recommend a well-known song you are certain about than to guess at an obscure one.
{focus_instruction}
Return ONLY the JSON array, no other text."""
# Call Claude API
client = anthropic.Anthropic(api_key=settings.ANTHROPIC_API_KEY)
message = client.messages.create(
model="claude-haiku-4-5-20251001",
model="claude-sonnet-4-20250514",
max_tokens=2000,
messages=[{"role": "user", "content": prompt}],
)