pub struct TranslationRequest {
pub source_text: String,
pub target_language: String,
pub model: String,
pub endpoint: String,
}Expand description
A request to translate text.
Contains all parameters needed to perform a translation and compute a unique cache key.
Fields§
§source_text: StringThe text to translate.
target_language: StringThe target language (ISO 639-1 code, e.g., “ja”, “en”).
model: StringThe model to use for translation.
endpoint: StringThe API endpoint URL.
Implementations§
Source§impl TranslationRequest
impl TranslationRequest
Sourcepub fn cache_key(&self) -> String
pub fn cache_key(&self) -> String
Computes a unique cache key for this request.
The key is a SHA-256 hash of the source text, target language, model, endpoint, and prompt template hash.
Sourcepub fn prompt_hash() -> String
pub fn prompt_hash() -> String
Computes a hash of the system prompt template.
Used to invalidate cache when the prompt changes.
Trait Implementations§
Source§impl Clone for TranslationRequest
impl Clone for TranslationRequest
Source§fn clone(&self) -> TranslationRequest
fn clone(&self) -> TranslationRequest
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 moreAuto Trait Implementations§
impl Freeze for TranslationRequest
impl RefUnwindSafe for TranslationRequest
impl Send for TranslationRequest
impl Sync for TranslationRequest
impl Unpin for TranslationRequest
impl UnwindSafe for TranslationRequest
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