Skip to content

Latest commit

 

History

History
69 lines (44 loc) · 2.02 KB

File metadata and controls

69 lines (44 loc) · 2.02 KB

Chat with any File

Nodejs a REST API is designed to provide users with an interactive chat interface where they can ask questions and receive responses generated by an AI model. The application utilizes OpenAI embeddings and Langchain to process the user's input and generate relevant responses based on the context of the conversation.

The backend of the application is built with Node.js,Express.js and uses Langchain's document loaders to load various file formats such as JSON, TXT, CSV, PDF, and DOCX. These documents are used to create a vector store, which is then used to retrieve relevant context for the user's query. The application uses OpenAI's language model to generate responses based on this context.

This REST API demonstrates how OpenAI embeddings and Langchain can be used to create a context-aware chatbot that can provide users with informative and relevant responses.

Installation

  1. Clone the repository:

    git clone https://github.com/Elite314Dev/Embedded-chatbot-using-Uploaded-files.git
  2. Install dependencies:

    cd Embedded-chatbot-using-Uploaded-files.git
    npm install

Usage

  1. Start the server:

    npm start
  2. Open your web browser and navigate to http://localhost:3000.

  3. Enter your message in the chat input field and press Enter.

  4. The server will process your input using OpenAI embeddings and return a response.

Configuration

Endpoint Details

Here are examples of how to make a request to the /chat API endpoint.

URL: /chat Method: POST Content-Type: application/json Request Body: JSON object with a userInput key containing the user's question.

Response: JSON object with a response key containing the chatbot's response. Example Request and Response

{
  "userInput": "What is the capital of France?"
}

Response:

{
  "response": "The capital of France is Paris."
}

upload your files to the data folder.

You can configure the prompt template and model by modifying the openai_embedings.js file.