Giter VIP home page Giter VIP logo

event-driven-ai's Introduction

Event-Driven AI

This is the typical sentiment AI example, but Kafka and Debezium are used instead of synchronous calls.

The sentiment analysis example analyzes a comment made on a product, analyzes the sentiment, and rates it from 1 to 5 stars.

Regarding architecture, there are two services implemented in Quarkus: one manages the product reviews, and another contains the HuggingFace model for analyzing the content.

Kafka and Debezium indirectly manage the communication between both services, which is the correct way to avoid the double-writes problem.

Debezium reacts to this event (Change Data Capture) when a new comment is stored in the MongoDB database and places the data into a Kafka topic.

Then, the sentiment service gets the event, processes it, and sends it to another topic.

Finally, the first service consumes the event and updates the stars counter.

The following schema summarizes the architecture:

eventai

Deploying

This example works in any Kubernetes cluster; in the deployment directory, you can find the manifests ordered by execution.

The only specific manifest is the 10_openshift_routes.yaml that creates the OpenShift routes to access the service.

Moreover, if you don’t want to execute all the manifests individually, the deploy_openshift.sh script is provided to manage all at once.

Red Hat Developer Sandbox

This example works on Red Hat Developer Sandbox, with free access to a shared OpenShift and Kubernetes cluster.

After you are registered, run the oc login in a terminal window, and then the script will deploy the solution.

Kafka UI

Apart from the solution, Kafka UI is deployed so you can access Kafka topics visually.

REST API

This solution doesn’t come with a frontend; it offers two important endpoints to interact with the solution:

// Returns the information of the products with the comments and the ratings

curl "$reviewUrl/productsWithComments"

// Generates a random comment to a random product

curl "$reviewUrl/review/generate"

Clean Up

There are shell scripts to undeploy the solution. These scripts are clean_kubernetes.sh and clean_openshift.sh.

event-driven-ai's People

Contributors

hpgrahsl avatar lordofthejars avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  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.