Skip to content

A playground for LangChain.js, LangGraph, NewRelic GraphQL, Sentry, Slack, Model Context Protocol (MCP) and other LLM-related tools.

Notifications You must be signed in to change notification settings

chrisleekr/langchain-playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A LangChain playground using TypeScript

A playground for LangChain.js, LangGraph, Slack, Model Context Protocol (MCP) and other LLM-related tools.

This project provides both REST API endpoints or Slack bot integration for interacting with different language models and LangChain and LangGraph workflows.

Architecture

Core components

  • langchain.js: Framework for building applications with LLMs.
  • langgraph: Framework for building applications with advanced workflow orchestration for multi-step processes.
  • slack/bolt: Integration with Slack for building Slack apps.
  • Model Context Protocol (MCP): MCP is a protocol for building LLM-powered tools.

LLM providers

Document Loaders

Services

  • ollama: Ollama enables the execution of LLM models locally.
  • openweb-ui: OpenWeb UI is a self-hosted WebUI that interacts with Ollama.
  • unstructured-api: The Unstructured API is designed to ingest/digest files of various types and sizes.
  • qdrant: Qdrant serves as a vector database.
  • chroma: Chroma serves as an embedding database. Not used anymore.
  • redis: Redis is an open-source in-memory data structure store.

Server mode

  • fastify: serves as a web server in src/api
  • slack: serves as a Slack app in src/slack

Sentry log analysis

In this project, I used LangGraph to build a workflow to analyze Sentry logs.

The workflow in big picture is as follows:

  1. Get Sentry issue and first event
  2. Normalize the issue and event and extend the stacktrace to source code fetching from GitHub
  3. Generate a summary of the investigation using the normalized issue and event
Image

New Relic log analysis

In this project, I used LangGraph to build a workflow to analyze New Relic logs.

The workflow in big picture is as follows:

  1. Get New Relic logs
  2. Analyze New Relic logs to get the request timeline, service error logs and relevant URLs
  3. Generate a summary of the investigation by analyzing the request timeline, service error logs and relevant URLs
New Relic log analysis using LangGraph

Answer from Retriever-Augmented Generation (RAG)

In this project, there are following routes to answer user's question from the document RAG retrieval.

Routes:

  • DELETE /document/reset: Reset the document RAG retrieval.
  • PUT /document/load/directory: Load documents from a directory using Unstructured API + Parent document retriever.
  • PUT /document/load/confluence: Load documents from Confluence + Parent document retriever.
  • POST /document/query: Answer user's question from the document RAG retrieval.

Document loader process

Document loader process

Document query process

AWS Bedrock Knowledge Base

Image

Parent document retriever

Image

Slack integration

In this project, I used slack/bolt and LangGraph to build a Slack app.

  • When a user mentions the bot in a channel, the bot will respond with a message.
  • It will execute the following steps:
    • Intent classifier: Classify the intent of the user's message.
    • Intent router: Route the user's message to the appropriate node.
    • Get message history: Get the message history of the channel.
    • MCP tools: Use MCP tools to get information from Model Context Protocol.
    • Summarise thread: Summarise the thread.
    • Translate message: Translate the message to the user's language.
    • Find information: Find information from the RAG database.
    • General response: Generate a general response.
    • Final response: Respond to the user's message.

How to start

docker-compose up -d --build

Endpoints

TBD

Todo

  • Add more examples
  • Add tests
  • Make better documentations

About

A playground for LangChain.js, LangGraph, NewRelic GraphQL, Sentry, Slack, Model Context Protocol (MCP) and other LLM-related tools.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •