rails-llm-app

Chatbot using API call from open AI

Stars
0
Committers
2

ChatBot LLM

This project is an attempt to develop a chatbot app, using Ruby on Rails and an API call from a Large Language Model such as OpenAI (ChtGTP) and Meta (Ollama)

Versions utilized for this project:

System Install Command Version
ruby ruby -v 3.3.0
rails rails -v 7.0.8.4
redis redis-cli -v 6.0.16
postgreSQL psql -V 14.12

GEMS used other than rails daefault:

  • Note: to install these gems cd into your app directory and run those install commands
  • Obs: When creating a new rails project you can set your DataBase to the one you want, default is SQLite, to set postgreSQL or other you should add the flag --database=DB_YOU_WANT_TO_USE .
Gem Install Command Gem Version
devise bundle add devise 4.2
foreman bundle add foreman 0.87.2
redis bundle add redis 5.2
postgreSQL bundle add pg 1.5
sidekiq bundle add sidekiq 7.1
ruby-openAI bundle add ruby-openai 7.1

Set up

Clone this Repo of fork it

git clone https://github.com/your-username/chatbot-llm.git
cd chatbot-llm

Install Dependencies

bundle install

Set up Data Base

bin/rails db:prepare or bin/rails db:create db:migrate

Set ENV file

  • You will need to settup your .env file with you redis url and port.
  • If you were to use Open AI API KEY, you shoud set in this file, do not share it. GIT does not ignore .env file by default, but it's good practice to add to do so.
    First create your .env file inside your application directory by runnin touch .env, populate it with your API KEY from OpenAI and redis (port, URL), should look something like:
REDIS_PORT=xxxxx
REDIS_URL=xxxxx
OPENAI_API_KEY=sk=xxxxxxxxxxxxx

Note: save your API KEY in a safe place do not share it, also OPENAI does not let you copy your key a second time. Then into your app directory and run echo "/ .env" >> .gitignore", this will ensure your environment configurations does not go to your public repository.

Rails Server

Run: bin/rails s to start To start the server with foreman i recomend reading this gide

///// construction in progress /////