Skip to content

ariba20-tech/backend

Repository files navigation

Travel & History Chatbot Backend

Backend API server for the Travel & History chatbot powered by Groq AI.

Features

  • Express.js REST API
  • Groq AI integration for natural language processing
  • TypeScript for type safety
  • Environment variable configuration

Prerequisites

  • Node.js 18 or higher
  • npm or yarn package manager
  • Groq API key

Installation

  1. Clone the repository
git clone https://github.com/yourusername/travel-history-chatbot-backend.git
cd travel-history-chatbot-backend
  1. Install dependencies
npm install
  1. Create a .env file in the root directory with the following variables:
PORT=3000
GROQ_API_KEY=your_groq_api_key_here

Development

To start the development server:

npm run dev

This will build the TypeScript code and start the server at http://localhost:3000.

API Endpoints

Health Check

  • GET /api/health: Check if the API is running

Chat

  • POST /api/chat: Send messages to the chatbot
    • Request body:
    {
      "messages": [
        {
          "role": "user",
          "content": "Tell me about the history of Rome"
        }
      ],
      "options": {
        "temperature": 0.7,
        "maxTokens": 1024,
        "model": "llama3-8b-8192"
      }
    }
    • Response:
    {
      "message": {
        "role": "assistant",
        "content": "Rome has a rich and fascinating history..."
      }
    }

Deployment

Build for production:

npm run build

Start the production server:

npm run start

License

ISC

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors