pub struct Prompt {
pub id: String,
pub variables: Option<HashMap<String, String>>,
}Expand description
Reference to a prompt template with variables
Allows you to use pre-defined prompt templates stored in the OpenAI platform, optionally with variable substitution.
§API Reference
Corresponds to the prompt parameter in the OpenAI Responses API:
https://platform.openai.com/docs/api-reference/responses/create
§Examples
use openai_tools::responses::request::Prompt;
use std::collections::HashMap;
// Simple prompt reference
let prompt = Prompt::new("prompt-abc123");
// Prompt with variables
let mut vars = HashMap::new();
vars.insert("name".to_string(), "Alice".to_string());
let prompt = Prompt::with_variables("prompt-abc123", vars);Fields§
§id: StringThe ID of the prompt template
variables: Option<HashMap<String, String>>Optional variables to substitute in the template
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Prompt
impl RefUnwindSafe for Prompt
impl Send for Prompt
impl Sync for Prompt
impl Unpin for Prompt
impl UnsafeUnpin for Prompt
impl UnwindSafe for Prompt
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