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
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 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 or OpenAI Platform, then:
# Gemini (recommended starting point — supports context caching)
export GEMINI_API_KEY="your-key-here"
# OpenAI
export OPENAI_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",
enable_caching=True, # Gemini-only in v1.0
)
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
- Quickstart — First result in 2 minutes
- Concepts — Mental model for source patterns and caching
- Sources and Patterns — Source constructors, run/run_many, ResultEnvelope
- Configuration — Providers, models, retries, caching
- Caching and Efficiency — TTL management, cache warming, cost savings
- Troubleshooting — Common issues and solutions
- API Reference — Entry points and types
- Cookbook — Scenario-driven, ready-to-run recipes
Contributing
See CONTRIBUTING and TESTING.md for guidelines.
Built during Google Summer of Code 2025 with Google DeepMind. Learn more
License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pollux_ai-1.2.0.tar.gz.
File metadata
- Download URL: pollux_ai-1.2.0.tar.gz
- Upload date:
- Size: 523.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0485909d0c0d71489deec6cec581b4e58a17f035258c9bb772a4f41f4b436424
|
|
| MD5 |
dbe69ba4621047440457b8e9cde0e3e3
|
|
| BLAKE2b-256 |
4853211d9daa06de408193512fa0eb95c2781e01ddbf8580972fe7f9f9c2f744
|
Provenance
The following attestation bundles were made for pollux_ai-1.2.0.tar.gz:
Publisher:
release.yml on seanbrar/pollux
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pollux_ai-1.2.0.tar.gz -
Subject digest:
0485909d0c0d71489deec6cec581b4e58a17f035258c9bb772a4f41f4b436424 - Sigstore transparency entry: 993411481
- Sigstore integration time:
-
Permalink:
seanbrar/pollux@453feef4ef28e5660b91608b34e3ac00682eadab -
Branch / Tag:
refs/heads/main - Owner: https://github.com/seanbrar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@453feef4ef28e5660b91608b34e3ac00682eadab -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pollux_ai-1.2.0-py3-none-any.whl.
File metadata
- Download URL: pollux_ai-1.2.0-py3-none-any.whl
- Upload date:
- Size: 40.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a4a7a9fa3f1ee2c710351c909940174b0063cbb22cf29cd203465c342727888
|
|
| MD5 |
5a09cdd006f143b33d2ea3c90d2f67b5
|
|
| BLAKE2b-256 |
a8e7172454616a5c2fee77a72d6f9ff37172e188718605a92b3604659d609c1a
|
Provenance
The following attestation bundles were made for pollux_ai-1.2.0-py3-none-any.whl:
Publisher:
release.yml on seanbrar/pollux
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pollux_ai-1.2.0-py3-none-any.whl -
Subject digest:
4a4a7a9fa3f1ee2c710351c909940174b0063cbb22cf29cd203465c342727888 - Sigstore transparency entry: 993411569
- Sigstore integration time:
-
Permalink:
seanbrar/pollux@453feef4ef28e5660b91608b34e3ac00682eadab -
Branch / Tag:
refs/heads/main - Owner: https://github.com/seanbrar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@453feef4ef28e5660b91608b34e3ac00682eadab -
Trigger Event:
workflow_dispatch
-
Statement type: