genai-processors

GenAI Processors is a lightweight Python library that enables efficient, parallel content processing.

What is genai-processors?

GenAI Processors is a lightweight Python library that enables efficient, parallel content processing.

Overview of genai-processors

What it is

GenAI Processors is a lightweight Python library that enables efficient, parallel content processing. It provides a framework for building modular, asynchronous, and composable AI pipelines for generative AI. The library addresses the fragmentation of LLM APIs through three core pillars: a unified content model for consistent input/output representation, processors as composable Python classes that transform content streams using native asyncio, and built-in asynchronous streaming capabilities.

Key features

  • Modular: Breaks down complex tasks into reusable Processor and PartProcessor units, which can be chained (+) or parallelized (//) to create sophisticated data flows.
  • Integrated with GenAI API: Includes ready-to-use processors like GenaiModel for turn-based API calls and LiveProcessor for real-time streaming interactions.
  • Extensible: Allows creation of custom processors by inheriting from base classes or using simple function decorators.
  • Rich Content Handling: ProcessorPart wraps genai.types.Part with metadata like MIME type, role, and custom attributes; supports text, images, audio, and custom JSON.
  • Asynchronous & Concurrent: Built on Python's asyncio framework to orchestrate concurrent tasks including network I/O and communication with compute-heavy subthreads.
  • Stream Management: Utilities for splitting, concatenating, and merging asynchronous streams of ProcessorParts.

Use cases

  • Building real-time audio-in audio-out live agents with tools like Google Search, as demonstrated in the Real-Time Live Example.
  • Creating research agents composed of multiple sub-processors, chaining, and custom ProcessorPart creation, as shown in the Research Agent Example.
  • Developing live commentary agents using the Gemini Live API, with separate agents for event detection and conversation management, as illustrated in the Live Commentary Example.
  • General parallel content processing and orchestration of generative AI workflows.

Getting started

The library requires Python 3.10+. Install it with:

pip install genai-processors

For detailed guidance, refer to the documentation microsite and the introductory Colab notebooks listed in the repository README.

License and pricing

This project is licensed under the Apache License, Version 2.0. It is open source and free to use.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/google-geminigenai-processors.svg)](https://yunodb.com/tools/google-geminigenai-processors?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/google-geminigenai-processors?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/google-geminigenai-processors.svg" alt="Featured on YunoDB" height="20"></a>