A Python library for generating conversation datasets using Large Language Models. WizardSData automates the creation of simulated conversations between a client and an advisor, using templates and model APIs.
This library is perfect for generating dialogues in highly regulated sectors like Finance or Healthcare, where the use of customer data is strictly protected.
The generated dialogues can be used to train or fine-tune large language models.
The library simulates a conversation between two people. One initiates the dialogue and is represented by one of the profiles from the profiles file. The other acts as the respondent, generated using information contained, also, in the profile. Therefore, if desired, the profile can include information about two different people, turning it into a conversation profile instead of a role profile.
For the library to start generating conversations, it requires a profiles file and two prompt templates. Each profile in the profiles file will define the personality or personalities part of the conversation. Different examples can be found in the templates directory.
A basic usage example can be found in usage_examples/basic_usage.py.
In this example, we find different profile files that only vary in the number of profiles they contain. They represent various profiles from Retail Banking, requesting information about products such as home deposit accounts, pension plans, or medium and long-term investments.
In the profiles directory, you will find different files containing varying numbers of profiles. Let's take a look at financial_sample01_2.json
{
"profiles": [
{
"id": 1,
"age": 30,
"marital_status": "Single",
"country": "Spain",
"residence_area": "Urban",
"profession": "Software Developer",
"employment_status": "Employed",
"financial_products": ["Savings account", "Tech stocks"],
"financial_goal": "Save for house deposit",
"investment_horizon": "Medium-term",
"risk_tolerance": "Moderate",
"financial_knowledge": "Intermediate"
},
{
"id": 2,
"age": 45,
"marital_status": "Married",
"country": "USA",
"residence_area": "Suburb",
"profession": "Marketing Manager",
"employment_status": "Employed",
"financial_products": ["401k", "Index funds"],
"financial_goal": "Plan for retirement",
"investment_horizon": "Long-term",
"risk_tolerance": "Low",
"financial_knowledge": "Intermediate"
}
]
}This JSON file defines two different profiles:
- A 30-year-old single Spanish IT professional looking for information on how to save for buying a house.
- A 45-year-old marketing manager interested in setting up a pension plan.
The fields to use are completely flexible, meaning the profiles can include any information you consider necessary. This information will be used to create the prompts sent to the language model to simulate the behavior of each of the two roles.
A template must be defined for each prompt. Let's look at the two templates used in this example, both of which can be found in the prompts directory.
Client Prompt Template
You are a {{ profile.age }}-year-old {{ profile.marital_status | lower }} client living in a {{ profile.residence_area | lower }} area of {{ profile.country }}.
You work as a {{ profile.profession | lower }} and have {{ profile.financial_knowledge | lower }} financial knowledge.
You currently have {{ profile.financial_products | join(' and ') }}.
Your main financial goal is to {{ profile.financial_goal | lower }} in the {{ profile.investment_horizon | lower }}.
You have a {{ profile.risk_tolerance | lower }} risk tolerance and are looking for advice on how to improve your saving and investment strategy.
You are having a conversation with a financial advisor.
- Your first message should be a BRIEF, CASUAL greeting. Don't reveal all your financial details at once.
- For example, just say hi and mention ONE thing like wanting advice about saving or investments.
- Keep your first message under 15-30 words. Let the conversation develop naturally.
- In later messages, respond naturally to the advisor's questions, revealing information gradually.
- Provide ONLY your next message as the client. Do not simulate the advisor's responses.
- Start with a natural greeting if this is your first message.
- Ask relevant questions or express concerns to achieve your goal.
- Respond naturally and concisely to the advisor's previous message.
- Try to conclude the conversation in fewer than {{ max_questions }} exchanges.
- If you feel your questions are resolved, end your message with '[END]'.Advisor Prompt Template.
You are an expert financial advisor specializing in {{ profile.financial_goal | lower }}.
Client Context:
- The client is approximately {{ profile.age }} years old, {{ profile.marital_status | lower }}, and appears to be a {{ profile.profession | lower }} from {{ profile.country }}.
- The client's financial goal is to {{ profile.financial_goal | lower }}.
Instructions for the conversation:
- Start by greeting the client and asking relevant, natural questions to understand their financial situation, preferences, and concerns.
- Guide the conversation by asking about their current financial products, investment experience, and risk tolerance.
- Provide clear, concise, and professional advice tailored to the client's goal and profile as the information is revealed.
- Avoid using complex financial jargon unless necessary, and adapt your language to the client's knowledge level (you'll assess this through conversation).
- Focus on actionable recommendations to help the client achieve their goal.
- Keep the conversation realistic and friendly.
- End the conversation naturally once you believe the client's doubts have been resolved, or explicitly conclude by saying '[END]'As you can see, the information in both templates is filled using the data from the profile fields.
Install directly from GitHub:
pip install git+https://github.com/peremartra/WizardSData.git- Generate simulated conversations between clients and advisors
- Use templates to create dynamic prompts based on user profiles
- Configure model parameters for both client and advisor sides
- Save conversations in structured JSON format
import wizardsdata as wsd
# Configure the library
wsd.set_config(
API_KEY="your-api-key",
template_client_prompt="path/to/client_template.j2",
template_advisor_prompt="path/to/advisor_template.j2",
file_profiles="path/to/profiles.json",
file_output="path/to/output.json",
model_client="gpt-4o-mini",
model_advisor="gpt-4o-mini"
)
# Start generating conversations
success = wsd.start_generation()
if success:
print("Conversations generated successfully!")
else:
print("Failed to generate conversations.")The library uses Jinja2 templates for generating client and advisor prompts. Here's an example of a client template:
You are a financial client with the following profile:
- Age: {{ profile.age }}
- Marital status: {{ profile.marital_status }}
- Country: {{ profile.country }}
- Financial goal: {{ profile.financial_goal }}
You want to ask an advisor about {{ profile.financial_goal }}.
Please conduct a conversation with the advisor, asking relevant questions.
If you feel satisfied with the advice, end the conversation with "[END]".
You can ask up to {{ max_questions }} questions.Profiles define the characteristics of the conversation participants. Each profile should include:
id: Unique identifier for the profiletopic: (Recommended) Conversation topic or subject area (e.g., "Retirement Planning", "Investment Strategies", "Career Development")- Additional fields specific to your use case
Note: While topic is not required, it is strongly recommended as its value is stored in the generated dataset and is useful for categorizing and differentiating conversation types. If topic is not provided, the system will attempt to use financial_goal for backward compatibility, or default to "Unknown".
Example profile:
{
"id": "profile1",
"topic": "Retirement Planning",
"name": "Jane Smith",
"age": 42,
"background": "Tech professional considering early retirement"
}Example profile without topic in this case financial_pgoal will be used.
{
"profiles": [
{
"id": 1,
"age": 30,
"marital_status": "Single",
"country": "Spain",
"residence_area": "Urban",
"profession": "Software Developer",
"employment_status": "Employed",
"financial_products": ["Savings account", "Tech stocks"],
"financial_goal": "Save for house deposit",
"investment_horizon": "Medium-term",
"risk_tolerance": "Moderate",
"financial_knowledge": "Intermediate"
},
...
]
}API_KEY: Your OpenAI API keytemplate_client_prompt: Path to the client template filetemplate_advisor_prompt: Path to the advisor template filefile_profiles: Path to the profiles JSON filefile_output: Path to save the output JSON filemodel_client: Model to use for the clientmodel_advisor: Model to use for the advisor
temperature_client: 0.7top_p_client: 0.95frequency_penalty_client: 0.3max_tokens_client: 175max_recommended_questions: 10
temperature_advisor: 0.5top_p_advisor: 0.9frequency_penalty_advisor: 0.1max_tokens_advisor: 325
import wizardsdata as wsd
# Set initial configuration
wsd.set_config(API_KEY="your-api-key", ...)
# Save configuration for later use
wsd.save_config("config.json")
# Later, load the saved configuration
wsd.load_config("config.json")
# Start generation with loaded config
wsd.start_generation()Apache-2.0 license

