Skip to main content

A sophisticated CLI application for generating authentic multi-turn conversations using 50+ distinct user personas

Project description

Persona-Based Conversation Generator CLI

A sophisticated Python CLI application that generates authentic multi-turn conversations using 50+ distinct user personas across multiple languages.

Features

  • 50+ Personas: Technology, Healthcare, Education, Business, Creative, and Specialized domains
  • Multi-Language Support: English, Arabic, and more
  • Multi-Turn & Multi-Persona Conversations: Generate conversations with 3-20 turns, including multi-persona (role-based) dialogues
  • Dynamic Personas: Personas are created on-the-fly; no static persona files required
  • Batch Generation: Generate 1-1000 conversations simultaneously with random or domain-specific personas
  • Flexible Export Formats: Output as JSON, CSV, Markdown, or plain text
  • Quality Analysis: Built-in conversation quality metrics and validation
  • Cultural Adaptation: Automatic cultural context and communication style adaptation

Quick Start

Installation

# Clone the repository
git clone <repository-url>
cd persona-chat

# Install dependencies
pip install -r requirements.txt

# Install the package
pip install -e .

Basic Usage

# Generate a single conversation with a random persona
persona-chat generate

# Use a specific persona with multiple turns
persona-chat generate --persona-name "Senior Software Engineer" --turns 8

# Generate an Arabic conversation
persona-chat generate --language ar --persona-name "مهندس برمجيات" --turns 6

# Batch generation (random personas)
persona-chat batch --conversations 10 --turns 5 --random-personas

# Batch generation (IT/technology personas)
persona-chat batch --conversations 10 --turns 5 --persona-domain technology

# Multi-persona conversation (role-based)
persona-chat generate --multi-persona --persona-names "Teacher,Student,Parent" --persona-roles "primary,participant,observer" --language ar --turns 4

Batch Generation Examples

Multi-Persona Batch Generation (NEW)

Batch now supports all persona options, including multi-persona, matching the generate command.

persona-chat batch --conversations 3 --turns 3 --language ar --multi-persona --persona-names "Teacher,Student,Parent" --persona-roles "primary,participant,observer" --llm-backend openai --llm-model gemma2:2b --llm-api-url http://localhost:11434/v1 --output json --output-filename test_multi_persona_batch

Arabic Batch with a Single Dynamic Technology Persona (All Conversations)

persona-chat batch --conversations 3 --turns 4 --language ar --create-persona --persona-name "مهندس برمجيات" --persona-role "مهندس برمجيات" --persona-domain technology --persona-expertise expert --persona-communication-style technical --llm-backend openai --llm-model gemma2:2b --llm-api-url http://localhost:11434/v1 --output json --output-filename test_arabic_batch_dynamic_it

Multi-Persona Conversation (Single)

persona-chat generate --multi-persona --persona-names "Chef,Waiter,Customer" --persona-roles "primary,participant,observer" --language ar --turns 3 --llm-backend openai --llm-model gemma2:2b --llm-api-url http://localhost:11434/v1 --output markdown --output-filename test_multi_persona_restaurant

Note: All persona options (including multi-persona, persona names, roles, and dynamic persona creation) are now supported in both batch and generate commands.

Troubleshooting:

  • If you see No valid persona available for conversation generation, use the --create-persona and --persona-name options as shown above.
  • If you want random personas per conversation, you must restore the static persona files or update the code to support dynamic random persona generation.

Export Formats

  • --output json (default): Structured JSON
  • --output csv: Tabular CSV
  • --output markdown: Human-readable Markdown
  • --output text: Plain text

LLM Backend Support (OpenAI, Ollama, Transformers)

You can use OpenAI-compatible APIs (including local Ollama) or HuggingFace Transformers as the backend for all message generation.

Configuration

  • --llm-backend: Choose the backend (openai, transformers, or none)
  • --llm-model: Model name (e.g., gemma2:2b for Ollama)
  • --llm-api-key: (For OpenAI) Your OpenAI API key (use any dummy value for local Ollama)
  • --llm-api-url: (For OpenAI) Custom API URL for self-hosted or alternative OpenAI-compatible APIs (e.g., http://localhost:11434/v1 for Ollama)

Example: Local Ollama API

persona-chat generate --llm-backend openai --llm-model gemma2:2b --llm-api-key dummy --llm-api-url http://localhost:11434/v1 --persona-name "Senior Software Engineer" --turns 5

Notes

  • All user and assistant messages are generated using the selected LLM backend if enabled.
  • For local Ollama, use --llm-backend openai and provide a dummy API key.
  • For Transformers, the model must be available locally or downloadable from HuggingFace.
  • You can set defaults in a config file or via environment variables for convenience.

Multi-Persona Conversations

  • Use --multi-persona to enable multi-persona mode
  • Specify persona names and roles with --persona-names and --persona-roles
  • Example:
    persona-chat generate --multi-persona --persona-names "Artist,Designer,Client" --persona-roles "primary,participant,observer" --language ar --turns 3
    

Documentation

Project Structure

persona-chat/
├── persona_chat/          # Main application package
├── config/               # Configuration files
├── output/               # Output files
├── tests/                # Test suite
├── docs/                 # Documentation
├── examples/             # Example files
└── tools/                # Development tools

Contributing

Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

persona_chat-0.1.0.tar.gz (69.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

persona_chat-0.1.0-py3-none-any.whl (83.5 kB view details)

Uploaded Python 3

File details

Details for the file persona_chat-0.1.0.tar.gz.

File metadata

  • Download URL: persona_chat-0.1.0.tar.gz
  • Upload date:
  • Size: 69.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for persona_chat-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8b1d7af062d19607d66e8d3a473debb64593303b310cfa66fe8351c99c821fb2
MD5 aaeaeb1b70d2091dc1f2bc8c812a7255
BLAKE2b-256 48be73449819cad96436438267a823e8a695b56e0779797fd540cc41ab4a2230

See more details on using hashes here.

File details

Details for the file persona_chat-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: persona_chat-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 83.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for persona_chat-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db5fc75689ecb575c0d95f04439e7f670ea47cb78642bf9e94607ae0c953d1b9
MD5 62308e94304661d0fc4578171ec68846
BLAKE2b-256 459bdef958651c19a8d289c2f29d6cce778f3dad17275c8d958011083327965a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page