A simple custom LLM wrapper for llama.cpp with LangChain compatibility.
Project description
real-llama-cpp-python
A simple custom wrapper for llama.cpp models in Python, support seamlessly interaction with LangChain. As the name suggests, it is truly a wrapper for llama.cpp, you should have installed llama.cpp into your machine prior to this.
Background
While it might seem intuitive that llama-cpp-python would seamlessly integrate with llama.cpp, the reality is that installing llama-cpp-python is a pain in the bum. It is NOT simple as described pip install llama-cpp-python.
Langchain, by default, supports llama-cpp-python. real-llama-cpp-python is a simplified and an alternative library designed to seamlessly integrate with LangChain while avoiding the pain of installing the library llama-cpp-python.
llama.cpp can be installed or built easily. The llama.cpp community is also very active that any issue with the installation can be resolved in a few days (unlike llama-cpp-python).
Installation
As the name said, it is truly a wrapper for llama.cpp, you should first install llama.cpp into your machine.
1 Install llama.cpp first
- Highly recommend this method Clone llama.cpp repository and build locally, see how to build
- On MacOS or Linux, install
llama.cppvia brew, flox or nix. Noted that, this brew install may not support GPU. - Use a
llama.cppDocker image, see documentation for Docker. - Have not tested yet Download pre-built binaries from releases.
After successfully built/installed llama.cpp. You want to add llama.cpp directory to your PATH permanently by editing your shell configuration file:
vim ~/.bashrc
or
source ~/.zshrc
Add the following line:
export PATH=$PATH:/path/to/your/llama.cpp/build/bin
Save and run source ~/.bashrc or source ~/.zshrc
You should be able to run llama-cli and llama-server from any directory. Verify the accessibility, run the following commands in any directory
llama-cli --help
llama-server --help
2 Install llama.cpp
Now, you can install real-llama-cpp-python by either install the stable version through pip install
pip install real-llama-cpp-python
or clone the github repository for the developing features.
git clone https://github.com/minhtran1309/real-llama-cpp-python.git
cd real-llama-cpp-python
pip install -e .
3 Running the tests
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 real_llama_cpp_python-0.1.1.tar.gz.
File metadata
- Download URL: real_llama_cpp_python-0.1.1.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc0f26e52fb0cf2229ffa15fe1eff1023e24e6ba4fd0e56910ba1a8f337679ea
|
|
| MD5 |
a6a8771888c0d489c7de56a2d5ea3ee7
|
|
| BLAKE2b-256 |
aa4f8566d4da350525d1b9611eb50fb2b7320901141f639cb697b37f9420352f
|
File details
Details for the file real_llama_cpp_python-0.1.1-py3-none-any.whl.
File metadata
- Download URL: real_llama_cpp_python-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fde124365b522d5e25cfc60c655ba4597ca45b4cc30f72ea714cfe83f0ac694
|
|
| MD5 |
fa03db16c9b72a8bb67d2a76c76e9284
|
|
| BLAKE2b-256 |
be8f26584c25224c9fd6cadf307e3629182a9ee6939a274ffc2df3fbb922ea0c
|