application allows you to ask questions about text that has been trained in the database using openai model.
- implemented opeai model,
- read pdf using langchain
- postgresml to create table and train model
npm install
npm startyou need to create .env file and add value:
POSTGRES_URL
POSTGRES_USER
POSTGRES_HOST
POSTGRES_DB
POSTGRES_PASS
POSTGRES_PORT
OPENAI_API_KEY
PORT=3000
- create account on https://postgresml.org/
- connect to your PostgreSQL Database: Use the psql command to connect to your PostgreSQL database.
psql -h your_host -U your_username -d your_database - create table
\i src/create.sql - show a list of tables in a PostgreSQL database
\dt - If you want to see more details about a specific table, you can use the
\d chat_pdf - you can read the rows by executing a SELECT query.
SELECT * FROM public.chat_pdf - select pdf you want and name it
embeddings.pdf - run
node embed.jsto insert loaded pdf content into table - run
node index.jsornpm start - you can send request
POST /api/chat/completionswith body{"input": "your question"}from Postman or custom front end