Coder Social home page Coder Social logo

savantly-net / mainbot Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 2.81 MB

A chat bot for domain specific knowledge. Headless RAG for the enterprise. RAG as a service.

Home Page: https://blog.savantly.net/mainbot-headless-rag/

License: Apache License 2.0

Dockerfile 0.22% Makefile 0.36% Shell 0.95% Java 98.46% HTML 0.02%
ai langchain4j rag knowledge-delivery genai genai-chatbot gpt headless-chat-bot headless-rag

mainbot's Introduction

mainbot

knowledge-explosion

Multi-tenant headless RAG chat bot.

This is a simple implementation of a multi-tenant chat bot that uses the Retrieval Augmented Generation.

Some of this code came from Wanderling, but all the game specific functions and rules-engine has been trimmed out (not ready to open source that one yet)

Quick start

Copy the example.env file to .env
Update the values for openai and pinecone.

make dev

open http://localhost:8080/swagger-ui/index.html

Overview

Features

  • Namespaced vector storage for multi-tenant preparation
  • OAuth authentication via JWT header
  • User session isolation
  • User session history and continuation
  • Adding documents to vector storage with a simple embedding pipeline
  • Retrieval Augmented Generation as default chat experience

Authentication Options

  • Anonymous
  • JWT
  • OAuth2

Conversation Storage Options

  • H2
  • Postgres

Vector storage Options

  • Pinecone
  • OpenSearch
  • In Memory

Embedding pipeline Options

  • OpenAI
  • OpenSearch
  • Replicate

Swagger

swagger

Starting a session

start a session

Sending a message

send a message

Example Configurations

Spring Profiles are used to configure the application.
See some example configurations (./src/main/resources/)[./src/main/resources/]

The configuration can be set in YAML, Properties, or Environment variables.

OpenAI for Embedding and Pinecone for Vector Storage

OPENAI_ENABLED=true
OPENAI_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxx
OPENAI_CHAT_MODEL_ID=gpt-3.5-turbo
PINECONE_ENABLED=true
PINECONE_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
PINECONE_PROJECT_NAME=my-project
PINECONE_INDEX=my-index
PINECONE_ENVIRONMENT=us-east4-gcp
APP_SECURITY_ENABLED=false

OpenAI for Embedding and OpenSearch for Vector Storage

See the application configuration in application-opensearch.yml for more details.

SPRING_PROFILES_ACTIVE=opensearch
OPENAI_ENABLED=true
OPENAI_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxx
OPENAI_CHAT_MODEL_ID=gpt-3.5-turbo
OPENSEARCH_URL=https://localhost:9200

GitHub Action to upload

If you store documents in your repository, you can easily upload them to mainbot.
Leverage the GitHub Action to upload text/markdown files directly to mainbot.

name: Upload Files to Mainbot

on:
  workflow_dispatch: {} # Manually trigger the workflow
  push:
    branches:
      - main
    paths:
      - 'docs/**'
      - 'README.md'

jobs:
  upload:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
      
      - name: Upload Files
        uses: savantly-net/mainbot-github-action@main
        with:
          glob-patterns: '*.md'  # Set your file pattern here
          namespace: '/mainbot-documents'
          api-url: 'https://mainbot.my-company.apps.savantly.cloud'
          client-id: ${{ secrets.MAINBOT_CLIENT_ID }}
          client-secret: ${{ secrets.MAINBOT_CLIENT_SECRET }}
          token-endpoint: https://oidc.apps.savantly.cloud/realms/savantly/protocol/openid-connect/token

Backstage Integration

We've also built a Backstage plugin to integrate with mainbot.
Combining the Github action and the Techdocs plugin, you can make all of your documentation immediately available in Backstage and searchable in mainbot.

mianbot in backstage

mainbot's People

Contributors

jdbranham avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

missaouib

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.