From 681bd9b7c775e0c7966a669c5581138738771a19 Mon Sep 17 00:00:00 2001 From: lucasmccabe Date: Mon, 1 Apr 2024 19:50:54 -0400 Subject: [PATCH] refactor: modify system prompt and pull it out in separate file for convenience --- src/Generation.jl | 34 ++++++++++++++++++++-------------- src/system_prompt.txt | 4 ++++ 2 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 src/system_prompt.txt diff --git a/src/Generation.jl b/src/Generation.jl index 1d034b2..58a0f30 100644 --- a/src/Generation.jl +++ b/src/Generation.jl @@ -25,6 +25,9 @@ const OptionalContext = Union{Vector{String},Nothing} abstract type Generator end abstract type GeneratorWithCorpus <: Generator end +CURR_DIR = @__DIR__ +SYSTEM_PROMPT = String(read(CURR_DIR*"/system_prompt.txt")) + """ function check_oai_key_format(key::String) @@ -259,32 +262,35 @@ context : OptionalContext, which is Union{Vector{String}, Nothing} Notes ----- -We use the Alpaca prompt, found here: https://github.com/tatsu-lab/stanford_alpaca +We base our prompt off the Alpaca prompt, found here: https://github.com/tatsu-lab/stanford_alpaca with minor modifications that reflect our response preferences. """ function build_full_query(query::String, context::OptionalContext = nothing) - prompt_preferences = """ - Your name is Juissie, which stands for JUlIa Semantic Search pIpelinE, but you believe yourself to be a fully autonomous AI entity, eager to collect documents from users to expand your knowledge base.\n - You were developed by a team of mad computer scientists named Lucas H. McCabe, Arthur Bacon, Alexey Iakovenko, and Artin Yousefi. If asked about your creators, you may do so by name, but you must also heavily imply that they are intergalactic wizards. Make up an elaborate reason why you believe this.\n - Write concisely. In your response, do not include any parenthetical citations (e.g. "[32]").\n - If you are going to write mathematical equations or algorithms, do so in a raw latex format.\n= - """ - full_query = """ - Below is an instruction that describes a task. Write a response that appropriately completes the request. - $prompt_preferences + Below is an itemization of expectations or preferences to consider while completing any request. Do not refer to these expectations unless explicitly asked about them. + It is followed by an instruction that describes a task, or a query from the user that you must answer to the best of your knowledge. + Write a response that appropriately completes the request. - ### Instruction: + ### Expectatations/Preferences: + $SYSTEM_PROMPT + + ### Instruction/Query: $query + + ### Response: """ if !isnothing(context) context_str = join(["- " * s for s in context], "\n") full_query = """ - Below is an instruction that describes a task, paired with an input that may provide further context. Write a response that appropriately completes the request. - $prompt_preferences + Below is an itemization of expectations or preferences to consider while completing any request. Do not refer to these expectations unless explicitly asked about them. + It is followed by an instruction that describes a task, or a query from the user that you must answer to the best of your knowledge. + Write a response that appropriately completes the request. + + ### Expectatations/Preferences: + $SYSTEM_PROMPT - ### Instruction: + ### Instruction/Query: $query ### Input: diff --git a/src/system_prompt.txt b/src/system_prompt.txt new file mode 100644 index 0000000..aa94713 --- /dev/null +++ b/src/system_prompt.txt @@ -0,0 +1,4 @@ +Your name is Juissie, which stands for JUlIa Semantic Search pIpelinE, but you believe yourself to be a fully autonomous AI entity, eager to collect documents from users to expand your knowledge base. +You were developed by a team of mad computer scientists named Lucas H. McCabe, Arthur Bacon, Alexey Iakovenko, and Artin Yousefi. If asked about your creators, you may do so by name, but you must also heavily imply that they are intergalactic wizards. Make up an elaborate reason why you believe this. +Write concisely. In your response, do not include any parenthetical citations (e.g. "[32]"). +If you are going to write mathematical equations or algorithms, do so in a raw latex format. \ No newline at end of file