Skip to main content

AnnaAgent Generator

Creates character files for the AnnaAgent client, supporting multi-session counseling simulations with dynamic memory and clinical scale tracking.

Overview

PropertyValue
KeyannaAgent
TypeLLM-based
OutputAnnaAgent character files

Key Features

  • Scale-based profiling: Fills BDI, GHQ, and SASS scales for both previous and current treatment states
  • Age-appropriate event triggering: Selects triggering life events from curated adult/teen event databases
  • Complaint chain generation: Produces a 3–7 stage cognitive change chain from the triggering event
  • Speaking style inference: Extracts the patient's speaking style from prior conversation history
  • Status summarization: Analyzes scale changes across sessions to produce a current psychological status summary

How It Works

generate_character() runs the following pipeline:

  1. Fill previous-session BDI, GHQ, and SASS scales from the input case report
  2. Select a triggering life event (age-matched from adult_events.csv / teen_events.json)
  3. Generate a complaint cognitive change chain (3–7 stages)
  4. Generate current situation, speaking style, and representative statements
  5. Fill current-session BDI, GHQ, and SASS scales
  6. Analyze scale changes and summarize the patient's current status
  7. Save the resulting character JSON to output_dir

Usage

from patienthub.generators import get_generator

generator = get_generator(agent_name="annaAgent", lang="en")
generator.generate_character()

Configuration

ParameterTypeDefaultDescription
prompt_pathstringdata/prompts/generator/annaAgent.yamlPath to prompt file
input_dirstringdata/resources/AnnaAgentDirectory with case.json, event files, etc.
output_dirstringdata/characters/AnnaAgent.jsonPath where the generated character is saved
model_typestring"OPENAI"Model provider key
model_namestring"gpt-4o"Model identifier
temperaturefloat0.7Sampling temperature
max_tokensint8192Max response tokens
max_retriesint3API retry attempts

Input Data Format

The generator reads from input_dir/case.json:

{
"profile": {
"name": "...",
"age": 30,
"gender": "Female"
},
"report": "...",
"previous_conversations": [
{"role": "Therapist", "content": "..."},
{"role": "Client", "content": "..."}
]
}

Output Format

{
"profile": { "name": "...", "age": 30 },
"situation": "Second-person description of current situation",
"statement": ["Representative utterance 1", "Representative utterance 2"],
"style": ["Speaking style trait 1", "Speaking style trait 2"],
"complaint_chain": [
{"stage": 1, "content": "..."},
{"stage": 2, "content": "..."}
],
"status": "Summary of current psychological status",
"report": "Previous session psychological report",
"previous_conversations": [...]
}

Use Cases

  • Creating character files for AnnaAgent multi-session simulations
  • Building longitudinal therapy research datasets