Transform any LLM into a methodical thinker that excels at systematic reasoning like OpenAI o1 and DeepSeek R1
Project description
🤔 LLM-Reasoner
Transform any LLM into a methodical thinker that excels at systematic reasoning like OpenAI o1 and DeepSeek R1
🚀 Getting Started
Install LLM-Reasoner with pip:
pip install llm-reasoner
Configure your API keys:
# Using OpenAI? Pop this in:
export OPENAI_API_KEY="your-key"
# Team Google? Here you go:
export VERTEX_PROJECT="your-project"
export VERTEX_LOCATION="your-location"
# Claude fan? Got you covered:
export ANTHROPIC_API_KEY="your-key"
🎮 Quick Play
Try these commands to get started:
# Check out what models you can use
llm-reasoner models
# Ask it something cool
llm-reasoner reason "Why do planes stay up in the air?"
# Want a nice UI to play with?
llm-reasoner ui
🛠️ Using It In Your Code
Here's how to use LLM-Reasoner in your Python code:
from llm_reasoner import ReasonChain
import asyncio
async def main():
# Initialize with default model (GPT-3.5 Turbo)
chain = ReasonChain()
# Get reasoning steps with basic content
async for step in chain.generate("How does evolution work?"):
print(f"Step {step.number}: {step.content}")
asyncio.run(main())
For more detailed output and control:
from llm_reasoner import ReasonChain
chain = ReasonChain(
model="gpt-4", # Choose your model
max_tokens=750, # Set max tokens per response
temperature=0.2, # Control randomness
timeout=30.0 # Set API timeout in seconds
)
async def show_detailed_reasoning():
query = "How do computers learn?"
async for step in chain.generate_with_metadata(query):
print(f"\nStep {step.number}: {step.title}")
print(f"Confidence: {step.confidence:.2f}")
print(f"Thinking time: {step.thinking_time:.2f}s")
print(step.content)
if step.is_final:
print("\nFinal Answer!")
asyncio.run(show_detailed_reasoning())
📜 License
MIT License - See LICENSE file for details.
Made with ❤️ for those who believe AI should show its work! ✍️
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
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 llm_reasoner-0.1.5.tar.gz.
File metadata
- Download URL: llm_reasoner-0.1.5.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2c444b8a591c59c9b43bbc2fe7ed87879a51676db10d908fa90ec6e40383793
|
|
| MD5 |
c7a95a9df31e73513d12fca76fcad9cb
|
|
| BLAKE2b-256 |
2214a91eacaee972a834047bbd5321f6ab626b429ad9f249a0545579c18739ec
|
File details
Details for the file llm_reasoner-0.1.5-py3-none-any.whl.
File metadata
- Download URL: llm_reasoner-0.1.5-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0838e8fa5f7d108cacc25d249c7abaacb7711efbe0d812689b6fe310c8f77d8d
|
|
| MD5 |
ee03486469edc2f3eaefbe8e8d3a4b22
|
|
| BLAKE2b-256 |
20e695eb5eca2bec6a8a9e0d797ccd7f2504ac5bb296ddc93e575272a2a95c8b
|