Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@nicksan222
Copy link
Contributor

Description

This PR introduces a new communication architecture for our microservices-based system, using Redis Pub/Sub. The system is designed to be extensible with a plugin system, where each plugin can act as a publisher, subscriber, or both, and interact with other services via Pub/Sub. At this stage, only the subscriber plugin has been implemented.

Related Issue: N/A (if applicable, add the issue number here)

Motivation: The main motivation for these changes is to give users the opportunity to customize the workflow and create a plugin ecosystem. The new architecture provides greater flexibility for users to extend the system with their own functionality, and the use of Redis Pub/Sub allows for more efficient and scalable communication between plugins.

System Operation

Here is a simplified explanation of how these microservices run:

  1. Initialization: Each microservice, when started, initializes a connection with a central Redis server. The services could be either publishers, subscribers, or both, depending on their roles. If they are publishers, they are assigned a priority that dictates the order in which they can publish messages.

  2. Publishing: If a service is a publisher, it can create messages and publish them to a specific topic. The message is sent to the Redis server, which handles distributing the message to all subscribers of that topic.

  3. Subscribing: If a service is a subscriber, it listens to one or more topics on the Redis server. When a message is published to a topic it is subscribed to, the Redis server sends the message to the service.

  4. Processing and Republishing: Once a service receives a message, it processes the message based on its internal logic. If the service is both a subscriber and a publisher, it may modify the message and republish it to the same topic. The modified message is then passed down to the next lower priority service in the chain for further processing. This functionality is not yet implemented.

  5. Scaling: This architecture supports scaling by adding more instances of services. Each instance would have its own connection to the Redis server and can independently publish and/or subscribe to messages.

  6. Plugin System: The architecture is designed to be extensible with a plugin system. Each plugin is essentially a microservice that can publish, subscribe, or both. The system allows for easy addition or removal of plugins, providing a lot of flexibility in customizing the workflow.

All services and plugins are Docker-based containers, which allows them to be written in any language that has a Redis SDK, providing even more flexibility.

Pending Features and Requests for Feedback

  • Implementation of publisher plugins and the "pass to the lower system" functionality is pending.
  • Test coverage has not yet been implemented, as we are seeking feedback on the current feature set first.
  • Suggestions on how to better structure the system would be greatly appreciated.

Checklist before requesting a review

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged

Screenshots (if appropriate):

N/A

Please review these changes and provide feedback.

@vercel
Copy link

vercel bot commented Jul 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 18, 2023 6:47am

@vercel
Copy link

vercel bot commented Jul 15, 2023

@santinicholas is attempting to deploy a commit to the Quivr-app Team on Vercel.

A member of the Team first needs to authorize it.

@StanGirard
Copy link
Collaborator

Very interesting change!

I need to think about it. The main goal would be to move towards a more micro service architecture ? Or is there anything you had in mind ?

@nicksan222
Copy link
Contributor Author

Very interesting change!

I need to think about it. The main goal would be to move towards a more micro service architecture ? Or is there anything you had in mind ?

For now i am am thinking about placing callbacks before/after some events so the user can create simple callbacks and do stuff

One of the first things i am thinking is a Telegram bot plugin that uses some hooks to send and receive text

The main infostructure Might remain the Same for now, since i Will be working over a fully implemented "read only" plugin

@nicksan222
Copy link
Contributor Author

nicksan222 commented Jul 15, 2023

Very interesting change!

I need to think about it. The main goal would be to move towards a more micro service architecture ? Or is there anything you had in mind ?

But yes i think maybe it could become a microservices based event chaining if you like the idea

So everyone can Write its own interpreter as pluggable elements

Also make multiple consecutive agents with different purposes

For example use the default agent and then pass it down to a translator plugin
Then pass it down to the next which Might be a rss feed publisher
So it would implement an automatic blogging System over docs

This leads at the end to a composable framework for making agents with docs knowledge and customized actions

Maybe if you like this idea i will switch over a "composable" fastapi routes, so that we can make a queue for each step of the request and pass Also files and not only text. This would allow for example a plugin that automatically uploads files whenever in a network folder there is a new document

The Sky would be the limit🚀

@nicksan222
Copy link
Contributor Author

nicksan222 commented Jul 16, 2023

This is how i am thinking the architecture of a single plugin

Senza titolo-2023-07-16-1044

I think this might be a pretty simple plugin architecture and would allow every programming language to work with the quivr main workflow

Of course i will implement a UI but first i want to make sure everything works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants