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.
  • 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 .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.4.tar.gz (66.9 kB 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.4-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mantisai-0.1.4.tar.gz
Algorithm Hash digest
SHA256 e04969e2f09a152daf43819c1cbd59fc706439b84a1cd790d9e8df2da9698284
MD5 891c78cb2a3385576899c69263cc1612
BLAKE2b-256 b1fc9e52315ebe9b8fd16d8f4670bcabea8be1a3933f3875f7e0d81f00c44226

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for mantisai-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9d0314b50240eb099337b83337b6449d4a46b0bc32f5f535d6628a610d698f04
MD5 7037c1f44093f69483377df31f83372b
BLAKE2b-256 c96ab426d86ea4d8bc6e2f815de558ec88433ded5101b2369bb05535d9e9e4db

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