This Telegram bot allows you to ask natural language questions about PDFs you want to consult, using Langchain and the OpenAI API to process and answer the questions.
- Node.js 18 or higher
- A Telegram account
- A OpenAI account
- A Pinecone account
- Clone this repository on your local machine.
$ git clone https://github.com/jesus-ale43/telegram-question-bot-langchain.git
- Install the required dependencies.
Note: You can use your own package manager if you prefer, just make sure to install the dependencies in the
package.json
file.
$ yarn install
- Create an index in Pinecone.
Dimension: 1536
Pod Type: P1 - Faster queries (Recommended)
- Set up your
.env
file.
Copy .env.example
into .env
Your .env
file should look like this:
TOKEN=
OPENAI_API_KEY=
PINECONE_API_KEY=
PINECONE_ENVIRONMENT=
PINECONE_INDEX_NAME=
This repository can load multiple PDF files
-
Inside
docs
folder, add your pdf files. -
Run the script
yarn ingest
toingest
and embed your docs. -
Check Pinecone dashboard to verify your vectors have been added.
Once you've verified that the embeddings and content have been successfully added to your Pinecone, you can run the script yarn dev
to launch the local dev environment, and then type /question <question>
in your Telegram bot chat.