Skip to main content

A flexible AI pipeline for STT, LLM, and TTS

Project description

Fastyr AI Pipeline

A flexible and extensible Python library for building AI-powered conversational pipelines. Fastyr provides a clean interface between Speech-to-Text (STT), Language Model (LLM), and Text-to-Speech (TTS) services.

Features

  • Seamless integration of STT, LLM, and TTS services
  • Easy provider switching with consistent interfaces
  • Async/await support for optimal performance
  • Built-in error handling and retries
  • Flexible storage backend support

Installation

pip install fastyr-ai-pipeline

Quick Start

import os
from fastyr.services.providers.pipeline_service import PipelineService
from fastyr.services.providers.deepgram_provider import DeepgramProvider
from fastyr.services.providers.openai_provider import OpenAIProvider
from fastyr.services.providers.elevenlabs_provider import ElevenLabsProvider
from fastyr.services.providers.local_storage_provider import LocalStorageProvider

# Initialize providers
storage = LocalStorageProvider(base_path="storage/audio")
pipeline = PipelineService(
    stt_provider=DeepgramProvider(api_key=os.getenv('DEEPGRAM_API_KEY')),
    llm_provider=OpenAIProvider(api_key=os.getenv('OPENAI_API_KEY')),
    tts_provider=ElevenLabsProvider(
        api_key=os.getenv('ELEVENLABS_API_KEY'),
        voice_id="your-voice-id"
    ),
    storage_provider=storage
)

# Process audio through the pipeline
result = await pipeline.process(request)
print(f"Processed audio available at: {result.audio_url}")

Provider Interfaces

The library defines three core interfaces:

  • STTProvider: transcribe(audio_data: bytes, options: Dict) -> str
  • LLMProvider: generate_response(prompt: str, options: Dict) -> str
  • TTSProvider: synthesize(text: str, options: Dict) -> bytes

Implemented Providers

  • Deepgram (STT): High-accuracy speech recognition with multi-language support
  • OpenAI (LLM): GPT-3.5/4 integration with customizable prompts
  • ElevenLabs (TTS): High-quality voice synthesis with multiple voice options

Configuration

Set environment variables for your API keys:

DEEPGRAM_API_KEY=your_deepgram_key
OPENAI_API_KEY=your_openai_key
ELEVENLABS_API_KEY=your_elevenlabs_key

Custom Providers

Implement your own provider by extending the relevant interface:

from fastyr.services.interfaces.stt_provider import STTProvider
from typing import Dict, Any

class CustomSTTProvider(STTProvider):
    async def transcribe(self, audio_data: bytes, options: Dict[str, Any] = None) -> str:
        # Your implementation
        pass

Requirements

  • Python 3.7+
  • See setup.py for dependencies

License

MIT License - see LICENSE file for details

Author

William Jefferson Mensah - GitHub

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

fastyr_ai_pipeline-0.1.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

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

fastyr_ai_pipeline-0.1.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file fastyr_ai_pipeline-0.1.0.tar.gz.

File metadata

  • Download URL: fastyr_ai_pipeline-0.1.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for fastyr_ai_pipeline-0.1.0.tar.gz
Algorithm Hash digest
SHA256 41d814b55c60c3689d99760bf47cc8f10cd2aa40801612c90e53af795bbd8417
MD5 b906c1c59f043abf69439f6f6d851a83
BLAKE2b-256 282f525178cceed6115d4788e70bf62248ca22373143d593fb31a80aa0d8baab

See more details on using hashes here.

File details

Details for the file fastyr_ai_pipeline-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fastyr_ai_pipeline-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e3ae5442d9d4e31792e937ed36be159d64fdd92e5fe1ae7655a8aea7903483c
MD5 cf6b271f3dc63b7b7d8748ccebc319e1
BLAKE2b-256 19f4a9da0762fa996a7f91b243dffa83c0bef5174cc302969572b16aa7f46c22

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