The AI Chat App is a Node.js application that integrates OpenAI's GPT-3.5 Turbo model. It offers an interactive platform for AI-based chat, search, and question-answer functionalities. This application is designed to showcase the integration of various AI tools and APIs in a single, cohesive project.
Before beginning, make sure you have:
- An API key from OpenAI. Go to OpenAI Platform to get your key. You'll receive a $5 credit, and token usage is generally very low.
- Node.js installed on your system, as it's essential for running the application.
Follow these steps to set up your development environment:
- Install dotenv, which helps in managing environment variables and keeps your API key secure:
npm i dotenv
- Istall the OpenAI package to enable chat functionalities within your app:
npm i openai
- To enhance your app's search capabilities, install langchain:
npm i langchain
- For the QA feature, you'll need additional libraries like pdf-parse and YouTube transcript APIs:
npm i pdf-parse youtube-transcript-api youtubei.js
Use xbox.pdf and OpenAI video transcripts as sources for the QA functionality.
#The application's core functionalities include:
-Loading a combined memory vector store for data handling. -Performing semantic similarity searches using the questions provided. -Integrating with OpenAI's GPT-3.5 Turbo model to generate answers from the search results. -Displaying AI-generated answers, alongside sources from YouTube videos or PDF documents.
To use the chat bot:
- Insert your questions in
index.js
. - Run the script
node index.js
To perform a search:
- Add your search query inside
search.js
. For example:
console.log(await search('your query'))
Execute the script node search.js
To interact with the QA feature of the app, use the following command:
node qa "your question here"
Replace "your question here" with your actual query.