Skip to main content

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

Metadata

Release files for fastyr-ai-pipeline 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastyr-ai-pipeline 0.1.0
File Size Uploaded
fastyr_ai_pipeline-0.1.0.tar.gz 10.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fastyr-ai-pipeline 0.1.0
File Interpreter ABI Platform
fastyr_ai_pipeline-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.1 kB

Release files / fastyr_ai_pipeline-0.1.0.tar.gz

Download URL fastyr_ai_pipeline-0.1.0.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
41d814b55c60c3689d99760bf47cc8f10cd2aa40801612c90e53af795bbd8417
BLAKE2b-256 checksum
How to use checksums
282f525178cceed6115d4788e70bf62248ca22373143d593fb31a80aa0d8baab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / fastyr_ai_pipeline-0.1.0-py3-none-any.whl

Download URL fastyr_ai_pipeline-0.1.0-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3e3ae5442d9d4e31792e937ed36be159d64fdd92e5fe1ae7655a8aea7903483c
BLAKE2b-256 checksum
How to use checksums
19f4a9da0762fa996a7f91b243dffa83c0bef5174cc302969572b16aa7f46c22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page