LLM powered Python
Project description
Nerif
Program with both Python and Natural Language.
LLMs can be tricky to work with. They sometimes give overly formal responses or get confused when they're unsure, making them challenging to use in real applications.
That's why we built Nerif - a simple tool that connects LLMs with Python code. We want to make it better than existing tools like Langchain and Dify.
Nerif helps you:
- Control exactly how LLMs work in your code
- Convert LLM responses into usable data formats
- Track performance with metrics like cost and success rate
Our goal is to make LLMs easier to use for developers, turning complex AI capabilities into practical programming tools.
How to install
Pre-requisite
- Python >= 3.9
- Environment variable
OPENAI_API_KEYor other LLM API keys, for more details, see here - Set default model and embedding model with
NERIF_DEFAULT_LLM_MODELandNERIF_DEFAULT_EMBEDDING_MODEL, for more details, see here
Example:
export OPENAI_API_KEY=`your_api_key`
export NERIF_DEFAULT_LLM_MODEL=gpt-4o
export NERIF_DEFAULT_EMBEDDING_MODEL=text-embedding-3-small
Install
pip install nerif
QuickStart
from nerif.core import nerif
from nerif.model import SimpleChatModel
model = SimpleChatModel()
# Default model is `gpt-4o`
# Use nerif judge "natural language statement"
if nerif("the sky is blue"):
print("True")
else:
# Call a simple model
print("No", end=", ")
print(model.chat("what is the color of the sky?"))
Documentation
More detailed documentation is on the official website.
License
Nerif is licensed under the GNU General Public License v3.0.
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 nerif-0.9.4.tar.gz.
File metadata
- Download URL: nerif-0.9.4.tar.gz
- Upload date:
- Size: 45.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d5de8347ae5634ebbf7684df9c346511e9921e981bca7c9857631386ba69d5a
|
|
| MD5 |
572d0b4d9d143ede8787e6e6f0d85676
|
|
| BLAKE2b-256 |
a12f8de6dc05c92ba42ded5bc2abae91dd7a727434ef36c38aa42050b2effa2e
|
File details
Details for the file nerif-0.9.4-py3-none-any.whl.
File metadata
- Download URL: nerif-0.9.4-py3-none-any.whl
- Upload date:
- Size: 40.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcfaf8d249a07f97912636eb82dbc1f9a094fae92d535c354803cc8b021fc3b4
|
|
| MD5 |
e0a087d4145cd3e10f150d4fa345e59b
|
|
| BLAKE2b-256 |
119ad1b4e919a338e3386551ff1440b520c04d8390c598d3110d6e98e3fc74d9
|