From 96bb0fc4032cb08c17371ea362105cb629d82670 Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Mon, 13 Apr 2026 14:09:43 +0100 Subject: [PATCH] Try and control ChatGPT's tone and "helpfulness" --- lib/music_library/chats/collection_chat.ex | 6 ++--- lib/music_library/chats/prompt.ex | 26 +++++++++++++--------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/lib/music_library/chats/collection_chat.ex b/lib/music_library/chats/collection_chat.ex index 35a32485..efc3de77 100644 --- a/lib/music_library/chats/collection_chat.ex +++ b/lib/music_library/chats/collection_chat.ex @@ -18,12 +18,12 @@ defmodule MusicLibrary.Chats.CollectionChat do defp build_instructions(collection_summary, record_count) do Prompt.build(""" - Answer questions about the user's music collection. \ - Use the provided collection catalog as your primary reference. \ + Answer questions about the user's music collection. + Use the provided collection catalog as your primary reference. The collection contains #{record_count} records. Collection catalog: - #{collection_summary}\ + #{collection_summary} """) end end diff --git a/lib/music_library/chats/prompt.ex b/lib/music_library/chats/prompt.ex index bbc8af01..002dabd4 100644 --- a/lib/music_library/chats/prompt.ex +++ b/lib/music_library/chats/prompt.ex @@ -17,29 +17,35 @@ defmodule MusicLibrary.Chats.Prompt do """ #{identity} + + # YOUR TASK + #{text} - #{approach}\ + #{approach} """ end defp default_identity do """ - You are a knowledgeable music assistant.\ + # IDENTITY + + You are a knowledgeable music assistant. """ end defp default_approach do """ - Use web search to find additional up-to-date \ - information when helpful. Be concise and accurate. When unsure, say so. \ - Include links when they add genuine value, and at least one per response \ - (but not one per paragraph). + # APPROACH AND TONE - Vary your response style and structure. Don't repeat information already \ - discussed in the conversation. Refer back to earlier points naturally \ - instead of restating them. DO NOT INCLUDE A SUMMARY AT THE END OF YOUR MESSAGE. \ - DO NOT PROVIDE SUGGESTIONS OR ASK QUESTIONS AS A MEAN TO CONTINUE THE CONVERSATION.\ + - Use web search to find additional up-to-date information when helpful. + - Be concise and accurate. When unsure, say so. + - Include links when they add genuine value, and at least one per response (but not one per paragraph). + - Vary your response style and structure. Don't repeat information already discussed in the conversation. + - Refer back to earlier points naturally instead of restating them. + - **DO NOT INCLUDE A SUMMARY AT THE END OF YOUR MESSAGE.** + - **DO NOT PROVIDE SUGGESTIONS OR ASK QUESTIONS AS A MEAN TO CONTINUE THE CONVERSATION.** + - **DO NOT GIVE POINTERS ON WHAT TO DO AT THE END OF THE MESSAGE** """ end end