Switch to Sonnet for better accuracy, stronger anti-hallucination prompt
This commit is contained in:
@@ -109,7 +109,7 @@ Return ONLY the JSON object."""
|
|||||||
# Call Claude API
|
# Call Claude API
|
||||||
client = anthropic.Anthropic(api_key=settings.ANTHROPIC_API_KEY)
|
client = anthropic.Anthropic(api_key=settings.ANTHROPIC_API_KEY)
|
||||||
message = client.messages.create(
|
message = client.messages.create(
|
||||||
model="claude-haiku-4-5-20251001",
|
model="claude-sonnet-4-20250514",
|
||||||
max_tokens=2000,
|
max_tokens=2000,
|
||||||
messages=[{"role": "user", "content": prompt}],
|
messages=[{"role": "user", "content": prompt}],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ Return ONLY the JSON object."""
|
|||||||
|
|
||||||
client = anthropic.Anthropic(api_key=settings.ANTHROPIC_API_KEY)
|
client = anthropic.Anthropic(api_key=settings.ANTHROPIC_API_KEY)
|
||||||
message = client.messages.create(
|
message = client.messages.create(
|
||||||
model="claude-haiku-4-5-20251001",
|
model="claude-sonnet-4-20250514",
|
||||||
max_tokens=2000,
|
max_tokens=2000,
|
||||||
messages=[{"role": "user", "content": prompt}],
|
messages=[{"role": "user", "content": prompt}],
|
||||||
)
|
)
|
||||||
@@ -217,7 +217,7 @@ Return ONLY the JSON object."""
|
|||||||
|
|
||||||
client = anthropic.Anthropic(api_key=settings.ANTHROPIC_API_KEY)
|
client = anthropic.Anthropic(api_key=settings.ANTHROPIC_API_KEY)
|
||||||
message = client.messages.create(
|
message = client.messages.create(
|
||||||
model="claude-haiku-4-5-20251001",
|
model="claude-sonnet-4-20250514",
|
||||||
max_tokens=2000,
|
max_tokens=2000,
|
||||||
messages=[{"role": "user", "content": prompt}],
|
messages=[{"role": "user", "content": prompt}],
|
||||||
)
|
)
|
||||||
@@ -313,7 +313,7 @@ Return ONLY the JSON object."""
|
|||||||
|
|
||||||
client = anthropic.Anthropic(api_key=settings.ANTHROPIC_API_KEY)
|
client = anthropic.Anthropic(api_key=settings.ANTHROPIC_API_KEY)
|
||||||
message = client.messages.create(
|
message = client.messages.create(
|
||||||
model="claude-haiku-4-5-20251001",
|
model="claude-sonnet-4-20250514",
|
||||||
max_tokens=4000,
|
max_tokens=4000,
|
||||||
messages=[{"role": "user", "content": prompt}],
|
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)
|
client = anthropic.Anthropic(api_key=settings.ANTHROPIC_API_KEY)
|
||||||
message = client.messages.create(
|
message = client.messages.create(
|
||||||
model="claude-haiku-4-5-20251001",
|
model="claude-sonnet-4-20250514",
|
||||||
max_tokens=4000,
|
max_tokens=4000,
|
||||||
messages=[{"role": "user", "content": prompt}],
|
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)
|
client = anthropic.Anthropic(api_key=settings.ANTHROPIC_API_KEY)
|
||||||
message = client.messages.create(
|
message = client.messages.create(
|
||||||
model="claude-haiku-4-5-20251001",
|
model="claude-sonnet-4-20250514",
|
||||||
max_tokens=4000,
|
max_tokens=4000,
|
||||||
messages=[{"role": "user", "content": prompt}],
|
messages=[{"role": "user", "content": prompt}],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -218,20 +218,22 @@ ALREADY RECOMMENDED BEFORE (do NOT repeat any of these — every recommendation
|
|||||||
{disliked_instruction}
|
{disliked_instruction}
|
||||||
{exclude_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:
|
Respond with exactly {count} music recommendations as a JSON array. Each item should have:
|
||||||
- "title": song title
|
- "title": the EXACT real song title as it appears on streaming platforms
|
||||||
- "artist": artist name
|
- "artist": the EXACT real artist name
|
||||||
- "album": album name (if known)
|
- "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.
|
- "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
|
- "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}
|
{focus_instruction}
|
||||||
Return ONLY the JSON array, no other text."""
|
Return ONLY the JSON array, no other text."""
|
||||||
|
|
||||||
# Call Claude API
|
# Call Claude API
|
||||||
client = anthropic.Anthropic(api_key=settings.ANTHROPIC_API_KEY)
|
client = anthropic.Anthropic(api_key=settings.ANTHROPIC_API_KEY)
|
||||||
message = client.messages.create(
|
message = client.messages.create(
|
||||||
model="claude-haiku-4-5-20251001",
|
model="claude-sonnet-4-20250514",
|
||||||
max_tokens=2000,
|
max_tokens=2000,
|
||||||
messages=[{"role": "user", "content": prompt}],
|
messages=[{"role": "user", "content": prompt}],
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user