Metadata-Version: 2.4
Name: llmsays
Version: 0.1.2
Summary: One-line LLM queries with smart routing and provider failover
Author-email: Abhiraj Adhikary <abhirajadhikary06@gmail.com>, Anik Chand <anikchand461@gmail.com>, Rudra Bhowmick <bhowmickrudra07@gmail.com>
License: MIT License
        
        Copyright (c) 2025 [Your Name or Username]
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: openai
Requires-Dist: groq
Requires-Dist: openrouter
Requires-Dist: baseten
Requires-Dist: fireworks-ai
Requires-Dist: semantic-router[hybrid]>=0.0.50
Requires-Dist: sentence-transformers>=3.0.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: black>=24.0; extra == "dev"
Provides-Extra: test
Requires-Dist: pytest>=8.0; extra == "test"
Requires-Dist: pytest-mock>=3.0; extra == "test"
Dynamic: license-file
Dynamic: requires-python

# llmsays

One-line LLM calls with automatic prompt-tier routing and provider failover.

`llmsays` keeps usage simple:

```python
from llmsays import llmsays

response = llmsays("Explain quantum tunneling in simple words")
print(response)
```

## Why llmsays

- Single function API: `llmsays(prompt)`
- Smart routing with `sentence-transformers/paraphrase-MiniLM-L3-v2`
- Tier selection: `small`, `medium`, `large`, `extra_large`
- Provider failover: Groq, NIM, OpenRouter, Fireworks, Baseten
- Latency-aware provider ordering
- Optional parallel provider querying for faster first-response

## Installation

```bash
pip install llmsays
```

## Required Environment Variables

Set at least one provider key (multiple keys recommended for failover):

- `GROQ_API_KEY`
- `OPENROUTER_API_KEY`
- `NIVIDIA_API_KEY`
- `FIREWORKSAI_API_KEY`
- `BASETEN_API_KEY`

Example:

```bash
export GROQ_API_KEY="your_key"
export OPENROUTER_API_KEY="your_key"
```

## Quick Start

```python
from llmsays import llmsays

user_prompt = input("Here goes your prompt: ")
print(llmsays(user_prompt))
```

## Advanced Usage

Choose provider order:

```python
from llmsays import llmsays

print(
	llmsays(
		"Analyze this legal clause",
		provider_preference=["Groq", "Openrouter", "Fireworks"],
	)
)
```

Enable parallel provider queries (returns first successful response):

```python
from llmsays import llmsays

print(
	llmsays(
		"Design a production-ready architecture with tradeoffs",
		use_multiprocessing=True,
	)
)
```

## CLI Usage

```bash
llmsays "Explain transformers in simple terms"
llmsays "Analyze this legal clause" --providers Groq Openrouter
llmsays "Summarize this API contract" --use-multiprocessing
```

## How Routing Works

1. Heuristic pre-filter estimates complexity quickly.
2. Semantic routing refines tier selection.
3. Selected tier maps to provider-specific model choices.
4. If one provider fails, the next provider is attempted automatically.

## Notes

- Requires Python `>=3.9`
- Internet connection is required to call provider APIs
- Responses depend on the configured provider/model availability

## License

MIT

