Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

ChatLLM

An AI-powered chatbot with agentic web search capabilities, built with Node.js, Express, and the Groq API.

Features

  • Conversational AI powered by LLM (Groq API)
  • Agentic tool use — the model autonomously decides when to search the web for real-time information
  • Per-thread conversation history with 24-hour caching
  • Web frontend with a clean dark UI
  • Command-line interface for terminal-based chat

Tech Stack

Layer Technology
Runtime Node.js (ES Modules)
Backend Express.js
LLM Groq API ("openai/gpt-oss-20b")
Web Search Tavily API
Caching node-cache (24h TTL)
Frontend Vanilla HTML/CSS/JS + Tailwind CSS

Prerequisites

Getting Started

  1. Install dependencies

    cd backend
    pnpm install
  2. Configure environment variables

    cp .env.example .env

    Edit .env and add your API keys:

    GROQ_API_KEY=your_groq_api_key
    TAVILY_API_KEY=your_tavily_api_key
    
  3. Run the web server

    pnpm dev

    The server starts on http://localhost:3001.

  4. Open the frontend

    Open frontend/index.html in your browser.

CLI Mode

Run the chatbot directly in the terminal:

pnpm cli

Type your message and press Enter. Type bye to exit.

Project Structure

chatllm/
├── backend/
│   ├── src/
│   │   ├── server.js               # Express HTTP server
│   │   ├── chatbot.js              # Core agentic chatbot logic
│   │   └── commandline-chatllm.js  # CLI chat interface
│   ├── .env.example                # Environment variable template
│   └── package.json
├── frontend/
│   ├── index.html                  # Chat UI
│   └── script.js                   # Client-side logic
└── README.md

How It Works

  1. User sends a message via the web UI or CLI
  2. The backend forwards the message to the Groq LLM with a system prompt and a webSearch tool definition
  3. If the model determines it needs real-time information, it calls the webSearch tool
  4. The backend executes the search via the Tavily API and returns results to the model
  5. The model synthesizes an answer and sends it back to the user
  6. Conversation history is cached per thread for context continuity

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages