SimplePromptTemplate
Models & Types · AiDotNet.PromptEngineering.Templates
Simple prompt template with basic variable substitution.
Inheritance: PromptTemplateBase → SimplePromptTemplate
For Beginners
The most basic template - just fill in the blanks.
Example:
var template = new SimplePromptTemplate(
"Translate the following {source_lang} text to {target_lang}: {text}"
);
var prompt = template.Format(new Dictionary<string, string>
{
["source_lang"] = "English",
["target_lang"] = "Spanish",
["text"] = "Hello, how are you?"
});
// Result: "Translate the following English text to Spanish: Hello, how are you?"
Use this when:
- You have a simple prompt structure
- No special formatting needed
- Performance is important (fastest option)
- Prompt logic is straightforward
How It Works
This template provides straightforward variable substitution without any complex formatting or structure. It’s the simplest and fastest template type, suitable for basic prompts.
Constructors
| Constructor | Summary |
|---|---|
SimplePromptTemplate(string template) |
Initializes a new instance of the SimplePromptTemplate class. |
Methods
| Method | Summary |
|---|---|
SimplePromptTemplate FromTemplate(string template) |
Creates a SimplePromptTemplate from a template string. |