Artificial Intelligence, Automated Epistemology
Andrius: I detail for myself how to set up and run Artificial Intelligence programmatically on my computer.
Check Ollama
Study the Ollama documentation
Run the command: ollama
This should show the available commands. They include
- ollama list
- This lists the ollama versions on my computer. Currently, I have tinyllama:latest (637 MB) and gemma2:2b (1.6 GB)
- ollama run gemma2:2b
- This runs the ollama version interactively. If I just write: ollama run gemma2, then it will download and install the latest version, I presume. So I have to write in full the version I have.
Inside an interactive session, I can ask questions. Typing /? let's me see available commands such as /set (set session variables), /clear (clear session context), /save (save current session), /load (load early session). When I want to end the session, I type: /bye
Print ollama's answer to a file
curl http://localhost:11434/api/generate -d '{"model": "gemma2:2b","prompt":"Systematize the ways of figuring things out in chemistry."}' -o answer.txt
This is problematic because it outputs an array of single word answers.
Activate Python
On my computer I need to set up a virtual environment for Python. So I go to
kompas/langextract/langextract_env/bin
and I run:
source activate python3
Practice Python with the interpreter
x=2 y=3 x+y
This outputs 5.
Run a test file in the Python interpreter
In my virtual environment, I can run a program located elsewhere.
python3 /home/andrius/Darbalaukis/DirbtinisIntelektas/AI-test.py