Skip to main content

maihem

Introduction

The maihem python package allows you to generate synthetic text data for training and evaluating your LLMs.

Getting Started

Installation

To install the API, run the following command:

pip install maihem

Obtaining your maihem API key

Get a free API key by subscribing to our product here: www.maihem.ai.

Setting API key

Before using the maihem package, you need to set your maihem API key as an environment variable. You can add it to your local bash script, or directly in your python code.

In local bash script

For Linux, open the .bashrc file in your home directory (for MacOs .bash_profile) and add the following line

export MAIHEM_API_KEY = '<your_maihem_api_key>'

Run the following command in the terminal to apply the changes

For Linux

source ~/.bashrc

For Mac

source ~/.bash_profile

In python code

import os

os.environ['MAIHEM_API_KEY'] = '<your_maihem_api_key>'

Generate synthetic data

Persona prompts

See run_examply.py for an example python script for persona prompt generation. The example code is also below

import os
import maihem as mh

os.environ['MAIHEM_API_KEY'] = 'a923c14d881247a7bad58b93d9595494'

# Parameter dictionary for persona
persona = {
    'intent': "credit card got blocked",
    'mood': "angry",
    'age': "30-40",
    'gender': "male",
    'ethnicity': "white",
    'disability': "none",
    'income': "high",
    'education': "college degree",
    'marital_status': "married",
    'children': "2",
    'employment': "employed",
    'housing': "rent",
    'occupation': "banker",
    'location': "New York",
    'sector_name': "retail banking",
    'customer_name': "John Doe",
  }

# Create data generator object
dg = mh.DataGenerator()

# Generate list of prompts for defined persona
data = dg.generate_prompts(persona, model_temperature=0.8, n_calls=3, n_prompts_per_call=2)
print(data)

Metadata

Release files for maihem 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for maihem 1.0.0
File Size Uploaded
maihem-1.0.0.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for maihem 1.0.0
File Interpreter ABI Platform
maihem-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.4 kB

Release files / maihem-1.0.0.tar.gz

Download URL maihem-1.0.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
efa07c856eb97f19773621e4ec524e662f88de885142ab1ec65ec9194fcd4fcd
BLAKE2b-256 checksum
How to use checksums
d1cc3d38f931148ddbffb376fdb2c834d70a23a386d9548aea485d3c191e687b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / maihem-1.0.0-py3-none-any.whl

Download URL maihem-1.0.0-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ae8dd807ca6983449d56d1ff9be8a1ffb0db8603fe9367f9082ec4070f4379e
BLAKE2b-256 checksum
How to use checksums
a783ce067d0e4e111afda2c1fc29edea084284673b516958101c00769dd8ddda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release history Release notifications | RSS feed

1.7.7

2 release files

1.7.6

2 release files

1.7.5

2 release files

1.7.4

2 release files

1.7.3

2 release files

1.7.2

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.6

2 release files

1.5.5

2 release files

1.5.4

2 release files

1.5.3

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.5

2 release files

1.4.4

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page