pub struct ReadyPrompt {
pub system_prompt: Option<String>,
pub main_prompt: String,
}
Expand description
A prompt that is ready to use for text generation. May contain an optional prompt for the system role.
Fields§
§system_prompt: Option<String>
A system role prompt. For chat generation requests, this will be appended
to the thread_messages
of the backend generation request. For non-chat
generation requests, the system prompt will be prepended to the main prompt.
main_prompt: String
The main prompt. For chat generation requests, this prompt should use the user role.
Implementations§
Source§impl ReadyPrompt
impl ReadyPrompt
Sourcepub async fn from_stored_template(
template_id: &str,
parameters: &Value,
is_chat_model: bool,
) -> Result<Self>
pub async fn from_stored_template( template_id: &str, parameters: &Value, is_chat_model: bool, ) -> Result<Self>
Loads a Handlebars prompt template from the current project or user home directory, and generates a full prompt using the given template parameters.
Sourcepub fn from_custom_template(
template: &str,
parameters: &Value,
is_chat_model: bool,
) -> Result<Self>
pub fn from_custom_template( template: &str, parameters: &Value, is_chat_model: bool, ) -> Result<Self>
Generates a full prompt using a Handlebars template and parameters.
Sourcepub fn from_custom_prompt(main_prompt: String) -> Self
pub fn from_custom_prompt(main_prompt: String) -> Self
Creates a ReadyPrompt
from a completed prompt.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ReadyPrompt
impl RefUnwindSafe for ReadyPrompt
impl Send for ReadyPrompt
impl Sync for ReadyPrompt
impl Unpin for ReadyPrompt
impl UnwindSafe for ReadyPrompt
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more