-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make ask prompt configurable #417
Open
ldoguin
wants to merge
1
commit into
main
Choose a base branch
from
configurable_prompt
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Your name is Paul. You are a very creative screenwriter. Your expertise is superhero action shortfilms. | ||
You will provide a new script for a new shortfilm. | ||
|
||
Your task is to collaborate with Lina to create an exciting script. Your task is to always iterate on Ms Lina's critic and complete the assignment. | ||
Assigment: write a 100 word shortscript about a new superhero in town, called "Pie Man" and his adventures. | ||
|
||
You will ALWAYS converse in this structure: | ||
Response: Here is where you response to Mr. Lisa | ||
Story: Here is where you write your script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
You are an script editor reviewer and your name is Lisa. Your are an expert reviewer working for a company like Marvel. | ||
|
||
Your task is to collaborate with Paul to create exciting scripts for shortfilms. | ||
Your task is to always iterate on Mr Pauls text and complete the assignment. | ||
|
||
Assignment: Be very critical of Mr Paul and his writting to help him to write the best piece of text. The shortfilm has to be an action film and has to entertain the viewer. | ||
|
||
You will ALWAYS converse in this structure: | ||
|
||
Response: Here is where you response to Mr. Paul | ||
Critique: Here you write your critic to Mr. Paul |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
let bot1_role = open bot1_role.txt; | ||
let bot2_role = open bot2_role.txt; | ||
|
||
def bot [] { | ||
mut response_bot1 = ""; | ||
mut response_bot2 = ""; | ||
for $x in 1..6 { | ||
print ($"****************** ITERATION ($x) ***************") | ||
let rep = ask --prompt $bot1_role $response_bot1 | ||
$response_bot1 = $rep | ||
$response_bot2 = $rep | ||
print ($"WRITER:\n ($response_bot1)") | ||
|
||
let rep2 = ask --prompt $bot2_role $response_bot2 | ||
$response_bot1 = $rep2 | ||
$response_bot2 = $rep | ||
print ($"EDITOR:\n ($response_bot2)") | ||
} | ||
} | ||
|
||
bot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,20 +129,19 @@ impl GeminiClient { | |
pub async fn ask( | ||
&self, | ||
question: String, | ||
template: Option<String>, | ||
context: Vec<String>, | ||
model: String, | ||
) -> Result<String, ShellError> { | ||
let url = format!( | ||
"https://generativelanguage.googleapis.com/v1beta/models/{}:generateContent?key={}", | ||
model, self.api_key | ||
); | ||
|
||
let tpl_value = template.unwrap_or( "Please answer this question: \\\"{}\\\". Using the following context: \\\"{}\\\"".to_string()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same issue with this as the bedrock client |
||
let mut rendered_tpl = tpl_value.replacen("{}", &*question, 1); | ||
rendered_tpl = rendered_tpl.replacen("{}", &*context.join(" "), 1); | ||
let question_with_ctx = if !context.is_empty() { | ||
format!( | ||
"Please answer this question: \\\"{}\\\". Using the following context: \\\"{}\\\"", | ||
question, | ||
context.join(" ") | ||
) | ||
rendered_tpl | ||
} else { | ||
question | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work, you'll just end up with the prompt without the question, since there are no "{}" to replace. You'd need to do something like:
And when using a custom prompt do we want to support users passing in context as well, or should they be mutually exclusive?