pub struct PersonaGenerator { /* private fields */ }Expand description
Generator for creating data based on persona profiles
Uses the persona’s seed and traits to generate consistent, domain-appropriate data that reflects the persona’s personality.
Implementations§
Source§impl PersonaGenerator
impl PersonaGenerator
Sourcepub fn generate_for_persona(
&self,
persona: &PersonaProfile,
field_type: &str,
) -> Result<Value>
pub fn generate_for_persona( &self, persona: &PersonaProfile, field_type: &str, ) -> Result<Value>
Generate data for a specific field type based on persona
Uses the persona’s seed to create a deterministic RNG, then generates domain-specific data that may be influenced by the persona’s traits.
Sourcepub fn generate_for_persona_with_reality(
&self,
persona: &PersonaProfile,
field_type: &str,
reality_ratio: f64,
recorded_data: Option<&Value>,
real_data: Option<&Value>,
) -> Result<Value>
pub fn generate_for_persona_with_reality( &self, persona: &PersonaProfile, field_type: &str, reality_ratio: f64, recorded_data: Option<&Value>, real_data: Option<&Value>, ) -> Result<Value>
Generate data for a specific field type based on persona with reality awareness
The reality ratio determines how much the generated data blends with recorded/real data:
- 0.0-0.3: Purely synthetic (persona-generated)
- 0.3-0.7: Blended with recorded snapshots
- 0.7-1.0: Blended with upstream/real data
§Arguments
persona- Persona profile to generate data forfield_type- Type of field to generate (e.g., “name”, “email”, “amount”)reality_ratio- Reality continuum ratio (0.0 = mock, 1.0 = real)recorded_data- Optional recorded/snapshot data to blend withreal_data- Optional real/upstream data to blend with
Sourcepub fn generate_traits_from_backstory(
&self,
persona: &PersonaProfile,
) -> Result<HashMap<String, String>>
pub fn generate_traits_from_backstory( &self, persona: &PersonaProfile, ) -> Result<HashMap<String, String>>
Generate traits from a persona’s backstory
Analyzes the backstory to extract or infer trait values that align with the narrative. This ensures traits are coherent with the backstory.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PersonaGenerator
impl RefUnwindSafe for PersonaGenerator
impl Send for PersonaGenerator
impl Sync for PersonaGenerator
impl Unpin for PersonaGenerator
impl UnwindSafe for PersonaGenerator
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