{"id":29028579,"url":"https://github.com/google-gemini/genai-processors","last_synced_at":"2025-08-02T17:12:16.961Z","repository":{"id":294203777,"uuid":"975045036","full_name":"google-gemini/genai-processors","owner":"google-gemini","description":"GenAI Processors is a lightweight Python library that enables efficient, parallel content processing.","archived":false,"fork":false,"pushed_at":"2025-07-25T16:43:49.000Z","size":544,"stargazers_count":1809,"open_issues_count":9,"forks_count":160,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-07-25T22:42:54.148Z","etag":null,"topics":["agent","ai","asyncio","gemini","genai","generative-ai","language-model","multimodal","python","realtime"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/google-gemini.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-29T17:38:09.000Z","updated_at":"2025-07-25T19:00:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"86b9177e-ef80-4723-8fa4-da9c88e630af","html_url":"https://github.com/google-gemini/genai-processors","commit_stats":null,"previous_names":["google/genai-processors","google-gemini/genai-processors"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/google-gemini/genai-processors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-gemini%2Fgenai-processors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-gemini%2Fgenai-processors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-gemini%2Fgenai-processors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-gemini%2Fgenai-processors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google-gemini","download_url":"https://codeload.github.com/google-gemini/genai-processors/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-gemini%2Fgenai-processors/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268424029,"owners_count":24248119,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","ai","asyncio","gemini","genai","generative-ai","language-model","multimodal","python","realtime"],"created_at":"2025-06-26T07:34:46.428Z","updated_at":"2025-08-02T17:12:16.949Z","avatar_url":"https://github.com/google-gemini.png","language":"Python","funding_links":[],"categories":["Python","Model Deployment","python","AI Agent Frameworks \u0026 SDKs"],"sub_categories":["Orchestration Frameworks"],"readme":"# GenAI Processors Library 📚\n\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![PyPI version](https://img.shields.io/pypi/v/genai-processors.svg)](https://pypi.org/project/genai-processors/)\n\n**Build Modular, Asynchronous, and Composable AI Pipelines for Generative AI.**\n\nGenAI Processors is a lightweight Python library that enables efficient,\nparallel content processing.\n\nAt the core of the GenAI Processors library lies the concept of a `Processor`. A\n`Processor` encapsulates a unit of work with a simple API: it takes a stream of\n`ProcessorPart`s (i.e. a data part representing a text, image, etc.) as input\nand returns a stream of `ProcessorPart`s (or compatible types) as output.\n\n```python\n# Any class inheriting from processor.Processor and\n# implementing this function is a processor.\nasync def call(\n  content: AsyncIterable[ProcessorPart]\n) -\u003e AsyncIterable[ProcessorPartTypes]\n```\n\nYou can apply a `Processor` to any input stream and easily iterate through its\noutput stream:\n\n```python\nfrom genai_processors import content_api\nfrom genai_processors import streams\n\n# Create an input stream (strings are automatically cast into Parts).\ninput_parts = [\"Hello\", content_api.ProcessorPart(\"World\")]\ninput_stream = streams.stream_content(input_parts)\n\n# Apply a processor to a stream of parts and iterate over the result\nasync for part in simple_text_processor(input_stream):\n  print(part.text)\n...\n```\n\nThe concept of `Processor` provides a common abstraction for Gemini model calls\nand increasingly complex behaviors built around them, accommodating both\nturn-based interactions and live streaming.\n\n## ✨ Key Features\n\n*   **Modular**: Breaks down complex tasks into reusable `Processor` and\n    `PartProcessor` units, which are easily chained (`+`) or parallelized (`//`)\n    to create sophisticated data flows and agentic behaviors.\n*   **Integrated with GenAI API**: Includes ready-to-use processors like\n    `GenaiModel` for turn-based API calls and `LiveProcessor` for real-time\n    streaming interactions.\n*   **Extensible**: Lets you create custom processors by inheriting from base\n    classes or using simple function decorators.\n*   **Rich Content Handling**:\n    *   `ProcessorPart`: A wrapper around `genai.types.Part` enriched with\n        metadata like MIME type, role, and custom attributes.\n    *   Supports various content types (text, images, audio, custom JSON).\n*   **Asynchronous \u0026 Concurrent**: Built on Python's familiar `asyncio`\n    framework to orchestrate concurrent tasks (including network I/O and\n    communication with compute-heavy subthreads).\n*   **Stream Management**: Has utilities for splitting, concatenating, and\n    merging asynchronous streams of `ProcessorPart`s.\n\n## 📦 Installation\n\nThe GenAI Processors library requires Python 3.10+.\n\nInstall it with:\n\n```bash\npip install genai-processors\n```\n\n## 🚀 Getting Started\n\nCheck the following colabs to get familiar with GenAI processors (we recommend\nfollowing them in order):\n\n*   [Content API Colab](https://colab.research.google.com/github/google-gemini/genai-processors/blob/main/notebooks/content_api_intro.ipynb) -\n    explains the basics of `ProcessorPart`, `ProcessorContent`, and how to\n    create them.\n*   [Processor Intro Colab](https://colab.research.google.com/github/google-gemini/genai-processors/blob/main/notebooks/processor_intro.ipynb) -\n    an introduction to the core concepts of GenAI Processors.\n*   [Create Your Own Processor](https://colab.research.google.com/github/google-gemini/genai-processors/blob/main/notebooks/create_your_own_processor.ipynb) -\n    a walkthrough of the typical steps to create a `Processor` or a\n    `PartProcessor`.\n*   [Work with the Live API](https://colab.research.google.com/github/google-gemini/genai-processors/blob/main/notebooks/live_processor_intro.ipynb) -\n    a couple of examples of real-time processors built from the Gemini Live API\n    using the `LiveProcessor` class.\n\n## 📖 Examples\n\nExplore the [examples/](examples/) directory for practical demonstrations:\n\n*   [Real-Time Live Example](examples/realtime_simple_cli.py) - an Audio-in\n    Audio-out Live agent with google search as a tool. It is a client-side\n    implementation of a Live processor (built with text-based\n    [Gemini API](https://ai.google.dev/gemini-api/docs) models) that\n    demonstrates the streaming and orchestration capabilities of GenAI\n    Processors.\n*   [Research Agent Example](examples/research/README.md) - a research agent\n    built with Processors, comprising 3 sub-processors, chaining, creating\n    `ProcessorPart`s, etc.\n*   [Live Commentary Example](examples/live/README.md) - a description of a live\n    commentary agent built with the\n    [Gemini Live API](https://ai.google.dev/gemini-api/docs/live), composed of\n    two agents: one for event detection and one for managing the conversation.\n\n## 🧩 Built-in Processors\n\nThe [core/](genai_processors/core/) directory contains a set of basic processors\nthat you can leverage in your own applications. It includes the generic building\nblocks needed for most real-time applications and will evolve over time to\ninclude more core components.\n\nCommunity contributions expanding the set of built-in processors are located\nunder [contrib/](genai_processors/contrib/) - see the section below on how to\nadd code to the GenAI Processor library.\n\n## 🤝 Contributing\n\nContributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for\nguidelines on how to contribute to this project.\n\n## 📜 License\n\nThis project is licensed under the Apache License, Version 2.0. See the\n[LICENSE](LICENSE) file for details.\n\n## Gemini Terms of Services\n\nIf you make use of Gemini via the Genai Processors framework, please ensure you\nreview the [Terms of Service](https://ai.google.dev/gemini-api/terms).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle-gemini%2Fgenai-processors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle-gemini%2Fgenai-processors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle-gemini%2Fgenai-processors/lists"}