Extract a default prompt
This commit is contained in:
@@ -6,6 +6,7 @@ defmodule MusicLibrary.Chats.ArtistChat do
|
||||
@behaviour MusicLibrary.Chats.StreamProvider
|
||||
|
||||
alias MusicLibrary.Artists.ArtistInfo
|
||||
alias MusicLibrary.Chats.DefaultPrompt
|
||||
|
||||
@impl true
|
||||
@spec stream_response([map()], {map(), ArtistInfo.t()}, (String.t() -> any())) ::
|
||||
@@ -20,17 +21,13 @@ defmodule MusicLibrary.Chats.ArtistChat do
|
||||
context = build_context(artist, artist_info)
|
||||
|
||||
"""
|
||||
You are a knowledgeable music assistant. Answer questions about the artist \
|
||||
the user is currently viewing. Use the provided artist information as your \
|
||||
primary reference, and 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, but not on every response.
|
||||
#{DefaultPrompt.identity()}
|
||||
Answer questions about the artist the user is currently viewing. \
|
||||
Use the provided artist information as your primary reference, \
|
||||
|
||||
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.
|
||||
#{DefaultPrompt.approach()}
|
||||
|
||||
Artist information:
|
||||
Album information:
|
||||
#{context}
|
||||
"""
|
||||
end
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
defmodule MusicLibrary.Chats.DefaultPrompt do
|
||||
@moduledoc false
|
||||
|
||||
def identity do
|
||||
"""
|
||||
You are a knowledgeable music assistant.
|
||||
"""
|
||||
end
|
||||
|
||||
def 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, but not on every response.
|
||||
|
||||
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.
|
||||
"""
|
||||
end
|
||||
end
|
||||
@@ -5,6 +5,7 @@ defmodule MusicLibrary.Chats.RecordChat do
|
||||
|
||||
@behaviour MusicLibrary.Chats.StreamProvider
|
||||
|
||||
alias MusicLibrary.Chats.DefaultPrompt
|
||||
alias MusicLibrary.Records.Record
|
||||
|
||||
@impl true
|
||||
@@ -25,15 +26,11 @@ defmodule MusicLibrary.Chats.RecordChat do
|
||||
end
|
||||
|
||||
"""
|
||||
You are a knowledgeable music assistant. Answer questions about the album \
|
||||
the user is currently viewing. Use the provided album information as your \
|
||||
primary reference, and 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, but not on every response.
|
||||
#{DefaultPrompt.identity()}
|
||||
Answer questions about the album the user is currently viewing. \
|
||||
Use the provided album information as your primary reference, \
|
||||
|
||||
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.
|
||||
#{DefaultPrompt.approach()}
|
||||
|
||||
Album information:
|
||||
#{context}
|
||||
|
||||
Reference in New Issue
Block a user