A Python client for Monster API v2
Project description
Monsterapi v2
A Python client for interacting with Monster API v2 in .
Installation
pip install monsterapi
Has support to following MonsterAPI services:
Available models:
Text-Gen/LLMs:
1. falcon-7b-instruct
2. mpt-7b-instruct
3. llama2-7b-chat
4. falcon-40b-instruct
5. mpt-30b-instruct
6. codellama-13b-instruct
7. zephyr-7b-beta
Others models are accessible through client but are not activated yet. Will be updated shortly.
Image Gen:
1. txt2img - stable-diffusion v1.5
2. sdxl - stable-diffusion XL V1.0
3. pix2pix - Instruct-pix2pix
4. img2img - Image to Image using Stable Diffusion
Speech Gen:
1. sunoai-bark - Bark (Sunoai Bark)
2. whisper - (Whisper Large V2)
Usage
Import Module
from monsterapi import client
set MONSTER_API_KEY
env variable to your API key.
os.environ["MONSTER_API_KEY"] = <your_api_key>
client = client() # Initialize client
or
pass api_key
parameter to client constructor.
client = client(<api_key>) # pass api_key as parameter
Send a response to a model and suitable payload and retreive payload
# Fetching a response
response = client.get_response(model='falcon-7b-instruct', data={
"prompt": "Your prompt here",
# ... other parameters
})
print(response["process_id"])
Get the status of the process
status = client.get_status("your_process_id")
print(status)
Wait and Get the Result
# Waiting for result
result = client.wait_and_get_result("your_process_id")
print(result)
or
Use generate method
result = client.generate(model='falcon-7b-instruct', data={
"prompt": "Your prompt here",
# ... other parameters
})
Note: Input Model Payload Parameters can be found here
Run tests
Install test dependencies
pip install monsterapi[tests]
Run functional tests involving actual API key
export MONSTER_API_KEY=<your_api_key>
python3 -m pytest tests/ # Run all tests includes functional tests using actual API key
Run unit tests
export MONSTER_API_KEY="dummy"
python3 -m pytest tests/ -m "not slow" # Run only unit tests
PIP package push Instructions
pip install --upgrade setuptools wheel
python setup.py sdist bdist_wheel
pip install twine
twine upload dist/*
About us
Check us out at monsterapi.ai
Check out new no-code finetuning service here
Checkout our Monster-SD Stable Diffusion v1.5 vs XL Comparison space here
Checkout our Monster API LLM comparison space here
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
monsterapi-1.0.4.tar.gz
(13.1 kB
view hashes)
Built Distribution
monsterapi-1.0.4-py3-none-any.whl
(11.2 kB
view hashes)
Close
Hashes for monsterapi-1.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39b7774cbd8e7ae8aa57ec62636ab7c79193e9c70ab10de27e32ed0c27660c37 |
|
MD5 | 4f8dbc21d2aa41893f80b63896daf21b |
|
BLAKE2b-256 | f3c7b24bd1231d6ab3ff53ddbb13207eafa587168cdbc16abc6d365a764d041b |