Skip to content

Add llama-index-postprocessor-heroku-rerank integration#20605

Open
dsouza-anush wants to merge 1 commit intorun-llama:mainfrom
dsouza-anush:add-heroku-rerank
Open

Add llama-index-postprocessor-heroku-rerank integration#20605
dsouza-anush wants to merge 1 commit intorun-llama:mainfrom
dsouza-anush:add-heroku-rerank

Conversation

@dsouza-anush
Copy link

Summary

Adds llama-index-postprocessor-heroku-rerank package for Heroku Inference API reranking support.

Description

This integration enables LlamaIndex users to rerank retrieved documents using Heroku's managed inference service, which provides access to Cohere reranking models.

Features

  • HerokuRerank class extending LlamaIndex BaseNodePostprocessor
  • Support for cohere-rerank-3-5 model
  • Configurable top_n for limiting reranked results
  • Full sync and async support
  • Seamless integration with LlamaIndex query engines

Usage

from llama_index.postprocessor.heroku_rerank import HerokuRerank

reranker = HerokuRerank(
    api_key="your-heroku-inference-key",
    model="cohere-rerank-3-5",
    top_n=5,
)

# Use with query engine
query_engine = index.as_query_engine(
    node_postprocessors=[reranker],
    similarity_top_k=20,  # Retrieve 20, rerank to top 5
)

Testing

  • 10 unit tests with mocked HTTP responses
  • Tested with real Heroku Inference API

Related

🤖 Generated with Claude Code

Adds reranking postprocessor for Heroku Inference API using Cohere models.

Features:
- HerokuRerank class for document reranking
- Support for cohere-rerank-3-5 model
- Configurable top_n for result limiting
- Full sync/async support

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Feb 1, 2026
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this pyproject is lacking many things and using poetry instead of hatchling + uv.

You should probably modify it taking this pyproject as reference:

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[dependency-groups]
dev = [
    "black[jupyter]<=23.9.1,>=23.7.0",
    "codespell[toml]>=v2.2.6",
    "diff-cover>=9.2.0",
    "ipython==8.10.0",
    "jupyter>=1.0.0,<2",
    "mypy==0.991",
    "pre-commit==3.2.0",
    "pylint==2.15.10",
    "pytest==7.2.1",
    "pytest-asyncio>=0.23.8",
    "pytest-cov>=6.1.1",
    "pytest-mock==3.11.1",
    "ruff==0.11.11",
    "types-Deprecated>=0.1.0",
    "types-PyYAML>=6.0.12.12,<7",
    "types-protobuf>=4.24.0.4,<5",
    "types-redis==4.5.5.0",
    "types-requests==2.28.11.8",
    "types-setuptools==67.1.0.0",
]

[project]
name = "llama-index-llms-upstage"
version = "0.7.0"
description = "llama-index llms upstage integration"
authors = [{name = "Your Name", email = "you@example.com"}]
requires-python = ">=3.9,<4.0"
readme = "README.md"
license = "AGPL-3.0"
dependencies = [
    "tokenizers>=0.19.1,<0.20",
    "llama-index-core>=0.14.3,<0.15",
    "llama-index-llms-openai>=0.6.0,<0.7",
    "llama-index-readers-upstage>=0.4.0,<0.5",
]

[tool.codespell]
check-filenames = true
check-hidden = true
# Feel free to un-skip examples, and experimental, you will just need to
# work through many typos (--write-changes and --interactive will help)
skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb"

[tool.hatch.build.targets.sdist]
include = ["llama_index/"]

[tool.hatch.build.targets.wheel]
include = ["llama_index/"]

[tool.llamahub]
contains_example = false
import_path = "llama_index.llms.upstage"

[tool.llamahub.class_authors]
Upstage = "llama-index"

[tool.mypy]
disallow_untyped_defs = true
# Remove venv skip when integrated with pre-commit
exclude = ["_static", "build", "examples", "notebooks", "venv"]
ignore_missing_imports = true
python_version = "3.8"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants