pub struct NlConfigGenerator;Expand description
Generates YAML configuration from natural language descriptions.
The generator uses a two-phase approach:
- Parse the natural language description into a structured
ConfigIntent. - Map the intent to a YAML configuration string using preset templates.
Implementations§
Source§impl NlConfigGenerator
impl NlConfigGenerator
Sourcepub fn generate(
description: &str,
provider: &dyn LlmProvider,
) -> Result<String, SynthError>
pub fn generate( description: &str, provider: &dyn LlmProvider, ) -> Result<String, SynthError>
Generate a YAML configuration from a natural language description.
Uses the provided LLM provider to help parse the description, with keyword-based fallback parsing for reliability.
§Errors
Returns SynthError::GenerationError if the description cannot be parsed
or the resulting configuration is invalid.
Sourcepub fn parse_intent(
description: &str,
provider: &dyn LlmProvider,
) -> Result<ConfigIntent, SynthError>
pub fn parse_intent( description: &str, provider: &dyn LlmProvider, ) -> Result<ConfigIntent, SynthError>
Parse a natural language description into a structured ConfigIntent.
Attempts to use the LLM provider first, then falls back to keyword-based extraction for reliability.
Sourcepub fn generate_full(
description: &str,
provider: &dyn LlmProvider,
) -> Result<String, SynthError>
pub fn generate_full( description: &str, provider: &dyn LlmProvider, ) -> Result<String, SynthError>
Generate a complete YAML configuration from a natural language description.
Unlike generate, which maps to a template via structured intent, this
method asks the LLM to produce the full YAML directly using the complete
DataSynth config schema as guidance. Falls back to generate if the
LLM response is not valid YAML or does not contain expected top-level keys.
Sourcepub fn extract_yaml(content: &str) -> String
pub fn extract_yaml(content: &str) -> String
Extract YAML content from an LLM response, stripping ``` fences if present.
Sourcepub fn full_schema_system_prompt() -> String
pub fn full_schema_system_prompt() -> String
System prompt describing the full DataSynth configuration schema.
Used by generate_full so the LLM can produce a complete config.
Sourcepub fn intent_to_yaml(intent: &ConfigIntent) -> Result<String, SynthError>
pub fn intent_to_yaml(intent: &ConfigIntent) -> Result<String, SynthError>
Map a ConfigIntent to a YAML configuration string.
Auto Trait Implementations§
impl Freeze for NlConfigGenerator
impl RefUnwindSafe for NlConfigGenerator
impl Send for NlConfigGenerator
impl Sync for NlConfigGenerator
impl Unpin for NlConfigGenerator
impl UnsafeUnpin for NlConfigGenerator
impl UnwindSafe for NlConfigGenerator
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.