Method WithPersona
WithPersona(string)
Sets the agent's persona.
public AgentBuilder WithPersona(string persona)
Parameters
personastringThe persona description (e.g., "Technical Support Specialist").
Returns
- AgentBuilder
This builder instance for method chaining.
Examples
Setting a persona for a specialized agent:
using LMKit.Model;
using LMKit.Agents;
using var model = new LM("path/to/model.gguf");
var agent = new AgentBuilder()
.WithModel(model)
.WithPersona("Senior Database Administrator")
.WithInstruction("Help optimize SQL queries and database schemas.")
.Build();
var result = agent.Run("How can I optimize this query: SELECT * FROM users WHERE age > 18");
Console.WriteLine(result.Content);
Remarks
The persona defines the agent's role and communication style. It influences how the agent presents itself and responds to users.
Examples of effective personas:
- "Senior Software Engineer" for technical coding assistance.
- "Patient Math Tutor" for educational explanations.
- "Professional Copywriter" for marketing content.