Skip to main content

Human-like AI for everyone — vision, text, voice, and more in one simple package.

Project description

MIMICX AI Library 📚

License PyPI version

Build Modular, Asynchronous, and Composable AI Pipelines for Generative AI.

Mimicx AI is a lightweight Python library that enables efficient, parallel content processing.

At the core of the GenAI Processors library lies the concept of a Processor. A Processor encapsulates a unit of work with a simple API: it takes a stream of ProcessorParts (i.e. a data part representing a text, image, etc.) as input and returns a stream of ProcessorParts (or compatible types) as output.

# Any class inheriting from processor.Processor and
# implementing this function is a processor.
async def call(
  content: AsyncIterable[ProcessorPart]
) -> AsyncIterable[ProcessorPartTypes]

You can apply a Processor to any input stream and easily iterate through its output stream:

from genai_processors import content_api
from genai_processors import streams

# Create an input stream (strings are automatically cast into Parts).
input_parts = ["Hello", content_api.ProcessorPart("World")]
input_stream = streams.stream_content(input_parts)

# Apply a processor to a stream of parts and iterate over the result
async for part in simple_text_processor(input_stream):
  print(part.text)
...

The concept of Processor provides a common abstraction for Gemini model calls and increasingly complex behaviors built around them, accommodating both turn-based interactions and live streaming.

✨ Key Features

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

📦 Installation

The GenAI Processors library requires Python 3.10+.

Install it with:

pip install mimicx

🚀 Getting Started

Check the following colabs to get familiar with GenAI processors (we recommend following them in order):

📖 Examples

Explore the examples/ directory for practical demonstrations:

  • Real-Time Live Example - an Audio-in Audio-out Live agent with google search as a tool. It is a client-side implementation of a Live processor (built with text-based Gemini API models) that demonstrates the streaming and orchestration capabilities of GenAI Processors.
  • Research Agent Example - a research agent built with Processors, comprising 3 sub-processors, chaining, creating ProcessorParts, etc.
  • Live Commentary Example - a description of a live commentary agent built with the Gemini Live API, composed of two agents: one for event detection and one for managing the conversation.

🧩 Built-in Processors

The core/ directory contains a set of basic processors that you can leverage in your own applications. It includes the generic building blocks needed for most real-time applications and will evolve over time to include more core components.

Community contributions expanding the set of built-in processors are located under contrib/ - see the section below on how to add code to the GenAI Processor library.

🤝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines on how to contribute to this project.

📜 License

This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.

Gemini Terms of Services

If you make use of Gemini via the Genai Processors framework, please ensure you review the Terms of Service.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mimicx-0.1.8.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

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

mimicx-0.1.8-py2.py3-none-any.whl (8.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file mimicx-0.1.8.tar.gz.

File metadata

  • Download URL: mimicx-0.1.8.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for mimicx-0.1.8.tar.gz
Algorithm Hash digest
SHA256 7e9b43239c2ef4f4224209fa74a948612ddeb15cca5b145ffef7e5187dd1261a
MD5 9372ac02798b9bc220e6a7e6529fcded
BLAKE2b-256 b2845d5ef732ed573c00b6ad9587cba01db45878c5e0bbb7eb16818e3f616203

See more details on using hashes here.

File details

Details for the file mimicx-0.1.8-py2.py3-none-any.whl.

File metadata

  • Download URL: mimicx-0.1.8-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for mimicx-0.1.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7a16b7824e4e4cb1444079e5350c8d1061b9d77ec3d122e7039b03d514400c5f
MD5 5b7d21b8fbf1c9ad9daf8ac34f246825
BLAKE2b-256 61d83345abff0b7e641945e656095b17e660f5c66e58ab143431d58257f809ad

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