A Python package for transcribing audio files, summarizing text, and extracting information using Gemini AI and Pydantic.
Project description
Mantis: Audio Processing with Large Language Models
Mantis is a Python package that makes it easy to transcribe audio files, generate summaries, and extract information using large language models. Built with Pydantic for robust data validation, it provides a simple and user-friendly API for processing both local audio files and YouTube content.
Key Features
- Audio Transcription: Convert audio files to text.
- Text Summarization: Generate concise summaries of your audio content.
- Information Extraction: Retrieve specific details from audio using custom prompts.
- Structured Data: Extract information in typed, validated formats using Pydantic models.
- YouTube Support: Automatically process YouTube URLs.
- Pydantic Validation: Ensure robust input/output handling.
Installation
Install Mantis with pip:
pip install mantisai
Quick Start
For Local Files
import mantis
# Transcribe a local audio file
print(mantis.transcribe("path/to/local/audio.mp3"))
# Summarize a local audio file
print(mantis.summarize("path/to/local/audio.mp3"))
# Extract information from a local audio file using a custom prompt
print(mantis.extract("path/to/local/audio.mp3", "Extract key details"))
For YouTube URLs
import mantis
# Transcribe a YouTube URL
print(mantis.transcribe("https://www.youtube.com/watch?v=example"))
# Summarize a YouTube URL
print(mantis.summarize("https://www.youtube.com/watch?v=example"))
# Extract information from a YouTube URL using a custom prompt
print(mantis.extract("https://www.youtube.com/watch?v=example", "Extract key details"))
Usage Notes
- Unified Interface: Whether you're passing a
.mp3file or a YouTube URL, the functionsmantis.transcribe,mantis.summarize, andmantis.extractare used in the same way. - Custom Prompts: For extraction, you can provide a custom prompt to guide the information retrieval.
- API Key: Ensure your Gemini AI API key is set in your environment (or in your code) as shown.
- Default Generative Model: Mantis uses Gemini 1.5 Flash by default.
Contributing
We welcome contributions! Here's how you can help:
- Fork the repository.
- Create a feature branch.
- Make your changes.
- Run the tests:
python -m unittest discover tests - Submit a pull request.
License
This project is licensed under the Apache 2.0 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mantisai-0.1.5.tar.gz.
File metadata
- Download URL: mantisai-0.1.5.tar.gz
- Upload date:
- Size: 70.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
316091119fcf145ab2ffc2943f8b73c0c663379d2feb9d274e197b84767ec6b0
|
|
| MD5 |
38fb8526bb040912e6ef356635decce0
|
|
| BLAKE2b-256 |
f5d41f6dc9ae2ef19a517eaa09b96ad340af2eb2a962eee16355aabffafb9135
|
File details
Details for the file mantisai-0.1.5-py3-none-any.whl.
File metadata
- Download URL: mantisai-0.1.5-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5863a2d834f2fe08dd733accaf49b502f39adc0fd4b2e617d343eaf18962c6d9
|
|
| MD5 |
1c80817334a3a5e61709df43c366c3db
|
|
| BLAKE2b-256 |
13908ea6cb5ff8aa8a892921657d9995e0113b8f92a08965ad18e2c4d65ec192
|