Giter Club home page Giter Club logo

b0bot's Introduction

B0Bot - CyberSecurity News API



Forks Stars Commit Activity License MIT

B0Bot is a CyberSecurity News API tailored for automated bots on social media platforms. It is a cutting-edge Flask-based API that grants seamless access to the latest cybersecurity and hacker news. Users can effortlessly retrieve news articles either through specific keywords or without, streamlining the information acquisition process. Once a user requests our API, it retrieves news data from our knowledge base and feeds it to the LLM. After the LLM processes the data, the API obtains the response and returns it in JSON format. The API is powered by LangChain and a Huggingface endpoint, ensuring that users receive accurate and up-to-date information.

App Screenshots

Home Page LLM Page News Page
Home Page LLM Page News Page

Setup

  1. Install all necessary packages

pip install -r ./requirements.txt

  1. Set up your MongoDB Atlas database
https://www.mongodb.com/atlas/database
  1. Set up your HuggingFace account
https://huggingface.co/
  1. Add huggingface token in .env file
# HuggingFace
HUGGINGFACE_TOKEN='[Your_hugging_face_token_here]'

# MongoDB Atlas
DB_PASSWORD='[Your database password here]'
  1. Remember to replace the MongoDB connection string
# Example
client = MongoClient(f"mongodb+srv://b0bot:{DB_PASSWORD}@cluster0.zqgexb4.mongodb.net/") # Replace the string with yours
  1. Enrich/Update news data into your database

Run ./db_update/Update.py as a worker on a cloud service (e.g. heroku). Or, run ./db_update/Update.py manually in local.

  1. Run the flask app

flask --app app.py run

By default, the home page will open. The routes have to be defined manually.

  1. We have added support for the following routes:
/llama          # Loads the Meta-Llama-3-8B-Instruct
/gemma          # Loads the Gemma-2b
/mistralai      # Loads the Mistral-7B-Instruct-v0.2

Note

The Huggingface token you are using must have access to the LLama3 model listed above. You can do so by visiting this link.

  1. Two available url paths
/<llm-name>/news
/<llm-name>/news_keywords?keywords=[Place news keywords here]

Important

The interface will only work if you specify the one of the avaialble paths above.

High-Level Architecture Diagram

Our API lives inside a Flask API and is powered by LangChain and a Huggingface endpoint.

In addition, to keep the knowledge base of news up to date, a scheduled script will be executed on a regular interval to retrieve the most recent cybersecurity news by scraping a list of target news websites and store them into the MongoDB Atlas Database. Everytime a user requests the API, news in the database will be read into LangChain's memory and fed to the LLM. Then, answers will be generated based on both the selected LLM and our knowledge base.

image image

The API will continuely run as a serverless function (hosted on Render) and it will record a successfull operation in a monitoring dashboard set up in Better Uptime.

Licensing

The MIT License 2023

b0bot's People

Contributors

cotoyo avatar hardik1408 avatar niweera avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

b0bot's Issues

Use open LLMs instead of openai

Is your feature request related to a problem? Please describe.
It is expensive to use openai credentials in an open source project. Moreover, getting free credits is also not viable.

Describe the solution you'd like
I propose to use open LLMs like mistral,llama,gemma etc. We can use ollama to deploy these LLMs.
Would like to start working on the same.

Initialise Flask API

Is your feature request related to a problem? Please describe.
"Setup initial Flask API" is in "Developer Road Map" (README section) and there is none setup yet.

Describe the solution you'd like
I'll initialise the project with a Flask boilerplate to get started with.

Greeting from participant of GSoC

Dear sir,

I am Tingyuan, a CS student in Boston University.
I just saw this project in the GSoC project board and I felt really interested in it . I think it would be a wonderful and meaningful project to work on. I know this project is still in its infancy, so maybe I could have some voluntary contribution in previous to not only help me have a better knowledge of this project, but also push the project forward.

Thank you and hope to hear from you soon.

Add Roadmap according to project requirements

I reviewed the project requirements and the README.md and saw that the project Roadmap isn't completed. Opened a PR with the changes mentioned above. @Niweera, please have a look and let me know if you would like me to add/remove/edit anything. Thanks!

devconatiner not working i want to fix it

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Setup initial Flask API

Describe the solution you'd like
This code creates a Flask application with a single endpoint /bot that accepts a POST request with a JSON payload containing the text of the tweet to be posted. It then uses the Tweepy library to authenticate with the Twitter API and post the tweet. Finally, it returns a JSON response with a success message.

Additional context
The twitter_bot() function - it extracts the tweet text from the request data and posts it to Twitter using Tweepy.

Need to replace the consumer_key, consumer_secret, access_token, and access_token_secret variables with your own Twitter API credentials in order for the bot to work.

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.