Git Product home page Git Product logo

pod42's Introduction

hasura-pod42

A Discord bot to answer questions based on docs using the latest ChatGPT API, built on Hasura GraphQL Engine and LangChain.

You can try the bot on our Discord, read more about the annoucement here.

Its features include:

  • Asynchronous architecture based on the Hasura events system with rate limiting and retries.
  • Performant Discord bot built on Hasura's streaming subscriptions.
  • Ability to ingest your content to the bot.
  • Prompt to make GPT-3 answer with sources while minimizing bogus answers.

Made with ❤️ by Hasura


Motivation

We at Hasura always believe that we are better at caring for plumbing so they can focus on their core problems. Hence, when text-davinci-003 came out, we saw an opportunity to resolve our user's query on Discord.

We had the following objectives when creating the bot,

  • Use Hasura's docs/blogs/learning courses.
  • Always list sources when answering.
  • Better to say "I don't know" over an incorrect answer.
  • Capture user feedback and iterate quickly.

Pod42 Demo

Table of contents

Installation

Steps to Setup Hasura Pod42

  • Setup pod42-server

  • You can use the one-click to deploy on Hasura Cloud to get started quickly:

    Deploy to Hasura Cloud

Architecture

Pod42 Arch Pod42 is based on 3-factor architecture

Discord Bot:

  • Uses real-time GraphQL API from Hasura.
  • Minimal state and code.
  • Instant feedback.
  • Easily Scalable.

Tasks:

  • Collect questions from users and persist them via Hasura's GraphQL API.
  • Listen for answers in real-time using subscriptions.

Hasura:

  • Completely asynchronous orchestrator using event triggers and subscriptions.
  • Event triggers handle retry and rate limit to webhook.
  • Subscriptions allow us to deliver instant answers to the Discord bot.

Tasks:

  • Trigger workflow when a new question comes.
  • When the Answer arrives, notify the clients through subscription.

Serverless Functions/Containers:

  • Stateless easily be deployed as a function on the cloud.

Tasks:

  • Fetch top K-related docs excerpts from the vector store.
  • Combine them in one document along with the question to OpenAI.
  • Persist the answer using Hasura's GraphQL API.

Comparison: text-davinci-003 vs gpt-3.5-turbo

For Hasura's use case, we want to emphasize the correctness of the answers; it's better for us if Pod42 says "I Don't Know" instead of bluffing an answer. We see that gpt-3.5-turbo does much better in that regard. It's also more verbose, but many new users like the details, and in terms of latency, gpt-3.5-turbo was ~60% faster.

Also, We found that passing information part user role in the prompt is more effective at the moment vs. the system role.

All the examples use the same prompt and vector store data.

Example: When the answer exists in Docs

text-davinci-003: Pod42 text-davinci-003

gpt-3.5-turbo: Pod42 gpt-3.5-turbo

Example: When Question is Misunderstood

text-davinci-003: Pod42 text-davinci-003

The above answer is entirely false; it misunderstood the question as Discord passed a user-id instead of the text @Cache.

gpt-3.5-turbo: Pod42 gpt-3.5-turbo

The above is a much better answer; it might prompt the user to ask the question better and at which point you get the following outcome.

gpt-3.5-turbo: Pod42 gpt-3.5-turbo

Example: Answer Quality

text-davinci-003: Pod42 text-davinci-003

gpt-3.5-turbo: Pod42 gpt-3.5-turbo

Example: Answer Verbosity

text-davinci-003: Pod42 text-davinci-003

gpt-3.5-turbo: Pod42 gpt-3.5-turbo

Maintained with ❤️ by Hasura

pod42's People

Contributors

who828 avatar

Stargazers

 avatar Robert Washbourne avatar Peter C. avatar Idowu Ayoola avatar Matthew Schulz avatar Bharath avatar Chakshu Gautam avatar Trung Ng avatar Axel Walsleben avatar  avatar  avatar Samuel Chan avatar Mirza Pasic avatar Johan Eliasson avatar Anirudh Vyas avatar Piyush Makhija avatar Adrian Ursu avatar Aman Kumar avatar Manikandan Sivanesan` avatar Sathish avatar Dhruvit Diyora avatar Raul Melo avatar Mac Chic avatar Porramate Lim avatar Warren Uniewski avatar hujili avatar Jong Hyeon Yeo avatar  avatar Kenn Ejima avatar Pawel Solyga avatar Abhishek Mishra avatar

Watchers

Aaron Johnson avatar  avatar Rajoshi Ghosh avatar Raul Melo avatar Manas Agarwal avatar Vamshi Surabhi avatar  avatar  avatar Kailash Sudhakar avatar

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.