serverless-chat-langchainjs  by Azure-Samples

Serverless AI chat app with RAG using LangChain.js and Azure

created 1 year ago
820 stars

Top 44.2% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides a serverless AI chat application leveraging Retrieval-Augmented Generation (RAG) with LangChain.js, TypeScript, and Azure services. It's designed for developers looking to build enterprise-grade chatbots that can answer questions based on custom document sets, offering a scalable and cost-effective solution.

How It Works

The application utilizes a serverless architecture with Azure Static Web Apps for the frontend and Azure Functions for the backend API. LangChain.js orchestrates the RAG process, interacting with Azure Cosmos DB for NoSQL to store document embeddings and chat history. Azure Blob Storage is used for source document storage. This approach simplifies AI application development by abstracting infrastructure management and providing a robust framework for integrating language models with external data.

Quick Start & Requirements

  • Local Development (Ollama):
    • Install Ollama and pull llama3.1:latest and nomic-embed-text:latest models.
    • Run npm install.
    • Start the application with npm start.
    • Upload documents with npm run upload:docs.
    • Access at http://localhost:8000.
  • Azure Deployment:
    • Requires an Azure account with access to Azure OpenAI Service and appropriate permissions.
    • Run azd auth login and azd up to deploy resources and the application.
  • Prerequisites: Node.js (>=20), Azure Developer CLI, Git, PowerShell 7+ (Windows).
  • Documentation: Official Learn documentation

Highlighted Details

  • Full serverless deployment on Azure Static Web Apps and Azure Functions.
  • RAG implementation using LangChain.js and Azure Cosmos DB for vector storage.
  • Supports local development with Ollama for cost-free testing.
  • Includes chat session history persistence.

Maintenance & Community

Licensing & Compatibility

  • Licensed under the MIT License.
  • Permissive license suitable for commercial use and integration into closed-source projects.

Limitations & Caveats

Local models may not perfectly adhere to advanced formatting instructions for citations and follow-up questions, which is an expected limitation of smaller local models.

Health Check
Last commit

2 weeks ago

Responsiveness

Inactive

Pull Requests (30d)
1
Issues (30d)
0
Star History
22 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.