Skip to content

Commit

Permalink
Update installation instructions and use requirements.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Nov 10, 2023
1 parent 4762bb2 commit 58fd94d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ all:
python3 main.py || $(MAKE) deps

deps:
pip3 install rich inquirer python-dotenv openai litellm tokentrim
python -m pip install -r requirements.txt

install user-install:
ln -fs $(PWD)/main.py $(R2_USER_PLUGINS)/r2ai.py
Expand Down
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,33 @@ Run a language model in local, without internet, to entertain you or help answer

## Installation

The easiest way to run and install r2ai is by installing the latest r2 from git and run these lines:
This is optional ans system dependant. but on recent Debian/Ubuntu systems the `pip` tool is no longer working, because it conflicts with the system packages. The best way to do this is with `venv`:

```bash
r2pm -i rlang-python # optional
pip3 install rich inquirer llama-cpp tokentrim hugging_face appdirs
r2pm -ci r2ai
python -m venv r2ai
. r2ai/bin/activate
```

On recent Debian/Ubuntu systems the `pip` tool is no longer working, because it conflicts with the system packages. The best way to do this is with `venv`:

```bash
python -m venv r2ai
. r2ai/bin/activate
pip install rich inquirer llama-cpp-python tokentrim hugging_face appdirs
pip install -r requirements.txt
r2pm -r r2ai
```

Additionally you can get the `r2ai` command inside r2 to run as an rlang plugin by installing the bindings:

```bash
r2pm -i rlang-python
make user-install
```

On native Windows follow these instructions (no need to install radare2 or use r2pm), note that you need Python 3.8 or higher:

```cmd
git clone https://github.com/radareorg/r2ai
cd r2ai
set PATH=C:\Users\YOURUSERNAME\Local\Programs\Python\Python39\;%PATH%
python -m pip install rich inquirer llama-cpp-python tokentrim hugging_face appdirs pyreadline3
python -m pip -r requirements.txt
python -m pip install pyreadline3
python main.py
```

Expand Down
10 changes: 1 addition & 9 deletions r2ai/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
from .interpreter import Interpreter
from .models import models
import sys

# This is done so when users `import interpreter`,
# they get an instance of interpreter:
# **This is a controversial thing to do,** lets say is wrong and only allows us to have 1 instance
# because perhaps modules ought to behave like modules.

#sys.modules["r2ai"] = Interpreter()
#sys.modules["r2ai"].VERSION = "0.2.1"
sys.modules["r2ai"].models = models
VERSION = "0.2.2"
VERSION = "0.3.0"
6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
rich
inquirer
llama-cpp-python
tokentrim
hugging_face
appdirs

0 comments on commit 58fd94d

Please sign in to comment.