pub fn parse_injection_block(
header_name: Option<&str>,
content: &str,
) -> Result<InjectionDef, ConfigError>Expand description
Parses an InjectionConfig YAML block and converts it into an InjectionDef.
If both a header name and a name field in the YAML payload are present, this returns
a ConfigError::NameConflict. The returned InjectionDef contains the parsed
source, target, injection mode, priority, and optional max_tokens. filter is unset.
ยงExamples
use cellstate_pipeline::parse_injection_block;
let yaml = r#"
source: "memory_a"
target: "agent_b"
mode: "full"
priority: 10
"#;
let def = parse_injection_block(None, yaml).unwrap();
assert_eq!(def.source, "memory_a");
assert_eq!(def.target, "agent_b");
assert_eq!(def.priority, 10);