Skip to main content

Multimodal orchestration for LLM analysis

Project description

Pollux

Multimodal orchestration for LLM APIs.

You describe what to analyze. Pollux handles source patterns, context caching, and multimodal complexity—so you don't.

Documentation · Quickstart · Cookbook

PyPI CI codecov Testing: MTMT Python License

Quick Start

import asyncio
from pollux import Config, Source, run

result = asyncio.run(
    run(
        "What are the key findings?",
        source=Source.from_text(
            "Pollux supports fan-out, fan-in, and broadcast source patterns. "
            "It also supports context caching for repeated prompts."
        ),
        config=Config(provider="gemini", model="gemini-2.5-flash-lite"),
    )
)
print(result["answers"][0])
# "The key findings are: (1) three source patterns (fan-out, fan-in,
#  broadcast) and (2) context caching for token and cost savings."

run() returns a ResultEnvelope dict — answers is a list with one entry per prompt.

To use OpenAI instead: Config(provider="openai", model="gpt-5-nano"). For Anthropic: Config(provider="anthropic", model="claude-haiku-4-5").

For a full 2-minute walkthrough (install, key setup, success checks), see the Quickstart.

Why Pollux?

  • Multimodal-first: PDFs, images, video, YouTube URLs, and arXiv papers—same API
  • Source patterns: Fan-out (one source, many prompts), fan-in (many sources, one prompt), and broadcast (many-to-many)
  • Context caching: Upload once, reuse across prompts—save tokens and money
  • Structured output: Get typed responses via Options(response_schema=YourModel)
  • Built for reliability: Async execution, automatic retries, concurrency control, and clear error messages with actionable hints

Installation

pip install pollux-ai

API Keys

Get a key from Google AI Studio, OpenAI Platform, or the Anthropic Console, then:

# Gemini
export GEMINI_API_KEY="your-key-here"

# OpenAI
export OPENAI_API_KEY="your-key-here"

# Anthropic
export ANTHROPIC_API_KEY="your-key-here"

Usage

Multi-Source Analysis

import asyncio

from pollux import Config, Source, run_many

async def main() -> None:
    config = Config(provider="gemini", model="gemini-2.5-flash-lite")
    sources = [
        Source.from_file("paper1.pdf"),
        Source.from_file("paper2.pdf"),
    ]
    prompts = ["Summarize the main argument.", "List key findings."]

    envelope = await run_many(prompts, sources=sources, config=config)
    for answer in envelope["answers"]:
        print(answer)

asyncio.run(main())

YouTube and arXiv Sources

from pollux import Source

lecture = Source.from_youtube("https://www.youtube.com/watch?v=dQw4w9WgXcQ")
paper = Source.from_arxiv("2301.07041")

Pass these to run() or run_many() like any other source — Pollux handles the rest.

Structured Output

import asyncio

from pydantic import BaseModel

from pollux import Config, Options, Source, run

class Summary(BaseModel):
    title: str
    key_points: list[str]
    sentiment: str

result = asyncio.run(
    run(
        "Summarize this document.",
        source=Source.from_file("report.pdf"),
        config=Config(provider="gemini", model="gemini-2.5-flash-lite"),
        options=Options(response_schema=Summary),
    )
)
parsed = result["structured"]  # Summary instance
print(parsed.key_points)

Configuration

from pollux import Config

config = Config(
    provider="gemini",
    model="gemini-2.5-flash-lite",
)

See the Configuration Guide for details.

Provider Differences

Pollux does not force strict feature parity across providers in v1.0. See the capability matrix: Provider Capabilities.

Documentation

Contributing

See CONTRIBUTING and TESTING.md for guidelines.

Built during Google Summer of Code 2025 with Google DeepMind. Learn more

License

MIT

Project details


Download files

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

Source Distribution

pollux_ai-1.3.0.tar.gz (546.2 kB view details)

Uploaded Source

Built Distribution

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

pollux_ai-1.3.0-py3-none-any.whl (51.3 kB view details)

Uploaded Python 3

File details

Details for the file pollux_ai-1.3.0.tar.gz.

File metadata

  • Download URL: pollux_ai-1.3.0.tar.gz
  • Upload date:
  • Size: 546.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pollux_ai-1.3.0.tar.gz
Algorithm Hash digest
SHA256 aa9be615b756b7ad2a39c92861eb0874625b70d3b8cc4e0de4ffab184b3c351e
MD5 798393e260f648fe355b9b2684e9a182
BLAKE2b-256 6b9e3722a543a84138c43fbea70163d5d5fe3fad28df8794c4cdb7cbb918cce0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pollux_ai-1.3.0.tar.gz:

Publisher: release.yml on seanbrar/pollux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pollux_ai-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: pollux_ai-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 51.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pollux_ai-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4305eaab4e7514e4a01ab08ebdfa79e9c50283c7daafe8fadfa7b86baf0c80d5
MD5 644312edd4dd54d66623c0d8c38d75bc
BLAKE2b-256 434f185658a48cf6708dd66a90c178c32c8274f6badd2a697515db25ec8ff186

See more details on using hashes here.

Provenance

The following attestation bundles were made for pollux_ai-1.3.0-py3-none-any.whl:

Publisher: release.yml on seanbrar/pollux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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