pub struct PromptTemplate {
pub query_prefix: String,
pub doc_prefix: String,
}Expand description
Prompt template applied before tokenization, used for instruction-tuned / prompt-tuned embedders.
Common patterns in the ecosystem:
- E5:
query: {text}vspassage: {text} - BGE (often): no prompt, or
query: .../passage: ...depending on checkpoint - Instruct models: sometimes use longer task prompts; we keep this as plain prefixing for now because it composes with both local and remote backends.
Fields§
§query_prefix: String§doc_prefix: StringImplementations§
Source§impl PromptTemplate
impl PromptTemplate
pub fn apply(&self, mode: EmbedMode, text: &str) -> String
Sourcepub fn from_iksh_env() -> Self
👎Deprecated since 0.2.0: use from_embedd_env() or from_env_any()
pub fn from_iksh_env() -> Self
use from_embedd_env() or from_env_any()
Load prompt prefixes from the legacy iksh env vars (compat).
Sourcepub fn from_embedd_env() -> Self
pub fn from_embedd_env() -> Self
Load prompt prefixes from EMBEDD_QUERY_PREFIX / EMBEDD_DOC_PREFIX.
Falls back to defaults when unset.
Sourcepub fn from_env_any() -> Self
pub fn from_env_any() -> Self
Prefer EMBEDD_* prompt env vars, else fall back to IKSH_*, else defaults.
This is useful for examples/benchmarks that want a single “prompt surface” without
accidentally drifting existing iksh behavior.
Trait Implementations§
Source§impl Clone for PromptTemplate
impl Clone for PromptTemplate
Source§fn clone(&self) -> PromptTemplate
fn clone(&self) -> PromptTemplate
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PromptTemplate
impl Debug for PromptTemplate
Source§impl Default for PromptTemplate
impl Default for PromptTemplate
Source§impl PartialEq for PromptTemplate
impl PartialEq for PromptTemplate
impl Eq for PromptTemplate
impl StructuralPartialEq for PromptTemplate
Auto Trait Implementations§
impl Freeze for PromptTemplate
impl RefUnwindSafe for PromptTemplate
impl Send for PromptTemplate
impl Sync for PromptTemplate
impl Unpin for PromptTemplate
impl UnsafeUnpin for PromptTemplate
impl UnwindSafe for PromptTemplate
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