Table of Contents

Method ToSystemPrompt

Namespace
LMKit.Agents
Assembly
LM-Kit.NET.dll

ToSystemPrompt()

Formats the identity as a system prompt suitable for injection into a conversation.

public string ToSystemPrompt()

Returns

string

A formatted string containing the persona and/or instruction, or an empty string if both are absent.

Examples

Converting identity to system prompt:

using LMKit.Agents;

var identity = new AgentIdentity(
    "Helpful Assistant",
    "Answer questions accurately and concisely."
);

string systemPrompt = identity.ToSystemPrompt();
Console.WriteLine(systemPrompt);
// Output:
// You are Helpful Assistant.
//
// Answer questions accurately and concisely.

System prompt with persona only:

using LMKit.Agents;

var identity = new AgentIdentity("Math Tutor");

Console.WriteLine(identity.ToSystemPrompt());
// Output: You are Math Tutor.

Remarks

The system prompt combines persona and instruction in a natural format:

  • Both defined: "You are {Persona}.\n\n{Instruction}"
  • Persona only: "You are {Persona}."
  • Instruction only: "{Instruction}"
  • Neither: Empty string