BHAGTANIDEEPAK 5186a99297 first commit
2025-04-14 17:38:18 +05:30

1.2 KiB

AI Internal Search Backend

This is the backend for the AI Internal Search project. It provides an API to interact with Mistral AI for generating responses based on department-specific documents stored in a MongoDB database.

Features

  • Fetches relevant documents from MongoDB based on the department.
  • Uses Mistral AI to generate responses based on the provided context and user query.
  • Provides a REST API for communication with the frontend.

Prerequisites

  • Node.js (v16 or later)
  • MongoDB database
  • Mistral AI API Key

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd AI-Internal-Search
    
  2. Install dependencies:

    npm i
    
  3. Create a .env file in the root directory and configure the following variables:

    PORT=3002
    MONGO_URI=<your-mongodb-connection-string>
    MISTRAL_API_KEY=<your-mistral-api-key>
    
  4. Start the server:

    npm start
    

Endpoints

http://localhost:3002/api/chat
  1. URL: /api/chat

  2. Method: POST

  3. Description: Sends a query to the AI assistant and retrieves a response based on department-specific documents.

  4. Request body:

{
  "department": "string",
  "message": "string"
}