llm-sorter

A Python library that uses LLMs as comparators for semantic sorting. Sort any list by meaning, tone, complexity, urgency, or any criteria expressible in natural language. This library uses an OpenRouter API key to interface with LLM providers.

Installation

pip install llm-sorter

Requires Python 3.10+

Quick Start

from llm_sorter import LLMSorter

sorter = LLMSorter(api_key="your-openrouter-api-key")

# Sort by reading complexity
passages = [
"The quantum entanglement phenomenon demonstrates non-local correlations...",
"The cat sat on the mat.",
"Climate change affects global weather patterns in complex ways."
]
result = sorter.sort(
items=passages,
prompt="Sort by reading level, simplest first"
)

# Sort support tickets by urgency
tickets = [
"Lo...

Similar Posts

Loading similar posts...