[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-72577":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":22,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":34,"readmeContent":35,"aiSummary":36,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":37,"discoverSource":38},72577,"genai-processors","google-gemini\u002Fgenai-processors","google-gemini","GenAI Processors is a lightweight Python library that enables efficient, parallel content processing.","https:\u002F\u002Fgoogle-gemini.github.io\u002Fgenai-processors\u002F",null,"Python",2113,214,20,4,0,2,60.2,"Apache License 2.0",false,"main",true,[24,25,26,27,28,29,30,31,32,33],"agent","ai","asyncio","gemini","genai","generative-ai","language-model","multimodal","python","realtime","2026-06-12 04:01:06","# GenAI Processors Library 📚\n\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-Apache_2.0-blue.svg)](LICENSE)\n[![PyPI version](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fgenai-processors.svg)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fgenai-processors\u002F)\n[![Documentation](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FView-Documentation-blue?&logo=read-the-docs)](https:\u002F\u002Fgoogle-gemini.github.io\u002Fgenai-processors\u002F)\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. It addresses the fragmentation of LLM APIs through\nthree core pillars:\n\n1.  **Unified Content Model**: A single, consistent representation for inputs\n    and outputs across models, agents, and tools.\n2.  **Processors**: Simple, composable Python classes that transform content\n    streams using native `asyncio`.\n3.  **Streaming**: Asynchronous streaming capabilities built-in by default,\n    without added plumbing complexity.\n\nAt the ecosystem's core lies the `Processor`, which encapsulates a unit of work.\nThrough a \"dual-interface\" pattern, it handles the complexity of asynchronous,\nmultimodal data streaming while exposing a simple API to developers:\n\n```python\nfrom typing import AsyncIterable\nfrom genai_processors import content_api\nfrom genai_processors import processor\n\nclass EchoProcessor(processor.Processor):\n  # The PRODUCER interface (for the processor author):\n  # Takes a robust ProcessorStream as input, and yields part types.\n  async def call(\n      self, content: content_api.ProcessorStream\n  ) -> AsyncIterable[content_api.ProcessorPartTypes]:\n      # Process content as it streams in!\n      async for part in content:\n          yield part\n```\n\nApplying a `Processor` is just as straightforward. The CONSUMER interface\naccepts wide, forgiving input types and returns a powerful stream that can be\nawaited entirely or streamed chunk-by-chunk:\n\n```python\n# The CONSUMER interface (for the caller):\n# Provide input effortlessly. Strings are automatically cast into Parts.\ninput_content = [\"Hello \", content_api.ProcessorPart(\"World\")]\n\n# 1. Gather all outputs easily into one object:\nresult: content_api.ProcessorContent = await simple_text_processor(input_content).gather()\n\n# 2. Or for text-only agents, get the text directly:\nprint(await simple_text_processor(input_content).text())\n\n# 3. And for streaming use cases, iterate over the parts as they arrive:\nasync for part in simple_text_processor(input_content):\n  print(part.text, end=\"\")\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 (`\u002F\u002F`)\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 & Concurrent**: Built on Python's familiar `asyncio`\n    framework to orchestrate concurrent tasks (including network I\u002FO 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## Code generation\n\nGenerative models are often unaware of recent API and SDK updates and may\nsuggest outdated or legacy code.\n\nWe recommend using our [Code Generation instructions](llms.txt) when generating\ncode that uses GenAI Processors to guide your model towards using the more\nrecent SDK features. Copy and paste the instructions into your development\nenvironment to provide the model with the necessary context.\n\n## 🚀 Getting Started\n\nWe recommend to start with the\n[documentation microsite](https:\u002F\u002Fgoogle-gemini.github.io\u002Fgenai-processors\u002F)\nwhich covers the core concepts, development guides, and architecture.\n\nYou can also check the following colabs to get familiar with GenAI processors\n(we recommend following them in order):\n\n*   [Content API Colab](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fgoogle-gemini\u002Fgenai-processors\u002Fblob\u002Fmain\u002Fnotebooks\u002Fcontent_api_intro.ipynb) -\n    explains the basics of `ProcessorPart`, `ProcessorContent`, and how to\n    create them.\n*   [Processor Intro Colab](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fgoogle-gemini\u002Fgenai-processors\u002Fblob\u002Fmain\u002Fnotebooks\u002Fprocessor_intro.ipynb) -\n    an introduction to the core concepts of GenAI Processors.\n*   [Create Your Own Processor](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fgoogle-gemini\u002Fgenai-processors\u002Fblob\u002Fmain\u002Fnotebooks\u002Fcreate_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:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fgoogle-gemini\u002Fgenai-processors\u002Fblob\u002Fmain\u002Fnotebooks\u002Flive_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\u002F](examples\u002F) directory for practical demonstrations:\n\n*   [Real-Time Live Example](examples\u002Frealtime_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:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs) models) that\n    demonstrates the streaming and orchestration capabilities of GenAI\n    Processors.\n*   [Research Agent Example](examples\u002Fresearch\u002FREADME.md) - a research agent\n    built with Processors, comprising 3 sub-processors, chaining, creating\n    `ProcessorPart`s, etc.\n*   [Live Commentary Example](examples\u002Flive_commentator\u002FREADME.md) - a description of a live\n    commentary agent built with the\n    [Gemini Live API](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Flive), composed of\n    two agents: one for event detection and one for managing the conversation.\n\n## 🧩 Built-in Processors\n\nThe [core\u002F](genai_processors\u002Fcore\u002F) 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\u002F](genai_processors\u002Fcontrib\u002F) - 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:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fterms).\n","GenAI Processors 是一个轻量级的 Python 库，旨在实现高效并行的内容处理。其核心功能包括统一的内容模型、可组合的处理器以及内置的异步流处理能力，通过这些特性简化了生成式 AI 管道的构建过程。该库利用 `asyncio` 提供原生异步支持，使得开发者能够轻松地创建和管理复杂的数据流与多模态内容处理任务。适用于需要快速开发、测试及部署基于大语言模型（LLM）的应用场景，特别是在要求实时响应或高并发处理的情况下表现尤为出色。","2026-06-11 03:42:39","high_star"]