MCPcopy Create free account
hub / github.com/AI45Lab/Code / render

Function render

core/src/prompts.rs:589–595  ·  view source on GitHub ↗

Render a template by replacing `{key}` placeholders with values

(template: &str, vars: &[(&str, &str)])

Source from the content-addressed store, hash-verified

587
588/// Render a template by replacing `{key}` placeholders with values
589pub fn render(template: &str, vars: &[(&str, &str)]) -> String {
590 let mut result = template.to_string();
591 for (key, value) in vars {
592 result = result.replace(&format!("{{{}}}", key), value);
593 }
594 result
595}
596
597#[cfg(test)]
598mod tests {

Callers 5

test_render_templateFunction · 0.85
compact_messagesFunction · 0.85
fallback_planMethod · 0.85
execute_planMethod · 0.85

Calls

no outgoing calls

Tested by 2

test_render_templateFunction · 0.68