Metadata-Version: 2.1
Name: maihem
Version: 1.0.0
Summary: LLM evaluations and synthetic data generation with the MAIHEM models
Author: MAIHEM
License: MIT License
        
        Copyright (c) 2023 MAIHEM
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/maihemlabs/maihem
Keywords: genAI,LLM,evaluation,data,generation
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.5
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests

# 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](https://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](./run_example.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)
```


