Skip to main content

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.

PyPI version License

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.
  • 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 .mp3 file or a YouTube URL, the functions mantis.transcribe, mantis.summarize, and mantis.extract are 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:

  1. Fork the repository.
  2. Create a feature branch.
  3. Make your changes.
  4. Run the tests: python -m unittest discover tests
  5. 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

mantisai-0.1.2.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mantisai-0.1.2-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file mantisai-0.1.2.tar.gz.

File metadata

  • Download URL: mantisai-0.1.2.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for mantisai-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0eae010424972a9aa09790d1c2082d86a498bbeb2afe42516fd287df77452d06
MD5 02d62ed7850c7558d643d476c53a6c4d
BLAKE2b-256 5e697e691776d790c34ebddcf453e92cb0ade05f847b61f1a577951df3cf16ea

See more details on using hashes here.

File details

Details for the file mantisai-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: mantisai-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for mantisai-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9c31569e4c785a8ff141782908cfe3502e54baae8be79b9587220067f0a36703
MD5 76ca4477378110a006341366c5ebf9d6
BLAKE2b-256 e1480b15f339adcdefa7229a645bd09fe79d025a56e02188f69f05d2efe93cc3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page