-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.0 // Ruby on Rails Mountable Engine #420
Draft
emorissettegregoire
wants to merge
59
commits into
master
Choose a base branch
from
3.0-mountable
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some light comments / thoughts.
Also, let's make a good practice to comment thoroughly on our new Stealth work. Nothing is better than seeing well articulated comments in OOS projects.
Update copyright.
Although, we should use dynamic service driver loading here. WIP!
We can start adding in things as we build out.
…N serialization issues
…erviceEvent class
* Added intent classifier * Rename prompts folder to intent_classifier * Added loading check for Intents file * Correct some configs * Added intents.rb file to generator * Removed unnecessary prompt
…on-locals Added ability to pass locals to step_to and update_session_to
Added locals logic
* Allow message deletion by passing the timestamp to the 'say' method * Use **args in say method * Structure dynamic arguments based on the current_service * Create a dedicated delete_message method
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Welcome to Stealth 3.0
The time has come to level up Stealth…
Stealth has served Mav and it's community very well over the last 5 years. However, with the evolution of Mav, the company needs features like native voice streaming, Slack integration, and eventing functionality. Stealth 1.X and 2.X has become unwieldy to maintain and shape to our needs.
Additionally, with the technological advancements in LLM technology, we’re leaving a lot on the table by not utilizing LLMs (and relying solely on NLP) within the Stealth pipeline.
Let’s change that and give back to the community what we believe our version of Conversational AI looks like in the world of Ruby, Rails, and LLMs.
Proposed 3.X
I think there are 3 new core principles that will drive Stealth 3.0. Let's dive in...
1. Stealth as a Ruby on Rails Engine
Instead of having Stealth remain a standalone Ruby rack app, let's transition it to be an Ruby on Rails engine (Mountable Plugin).
This would allow us to achieve a couple of interesting things:
The ability to “enable” conversational AI on top of any Ruby on Rails app is fantastic! Especially in this new LLM world where the Rails app can be the vector store. It feels much lighter weight (even more so with the new DSL) and easier to get up and started.
Via our route mount, e.g., mount Stealth::Engine => '/stealth', we can automatically attach a built-in developer web chat for building your bot. No longer are the days where you need to set up a messaging integration and ngrok just to say “hello world”. Note: This may or may not make V1.
We’ll be able to leverage the parent Rails app as a vector store for RAG implementation and/or a function caller for existing business logic.
💡 Note: We’d create some sort of generator to create the DSL folder structure in the parent app. Devise is actually a great example of an engine that we can model a lot off of.
2. Redesigned DSL
In an effort to make creating a conversational AI bot easier, Mauricio is created a sample DSL framework (codename B2). It includes new syntax that is more intuitive and a brand new eventing system that will allow developers to create omni-channel (SMS, Voice, Slack, etc) experiences much easier.
The highlights of the new DSL (B2) are:
Flows, states, helpers, replies, and events are main concepts in this new world. Click into each section to read a bit more on the example implementation.
The updated flows replace controllers and flow_state.rb. They are defined in a new flows top-level directory within the bot. The state-machine nature of Stealth is preserved, but flows now require a lot less boilerplate since they have been combined.
The updated states are defined directly flow file.
The updated helpers are automatically available for all flows.
The updated replies in our new DSL are completely overhauled and are essentially just ruby files.
Lastly, events are a new concept that replaces BotController#route and are capable of handling many types of events -- including events from voice and Slack. This eventing system is better suited to handling things like reactions, image uploads, and other non-text events.
3. LLM-First Architecture
Intent classification, entity recognition and sentiment analysis are core aspects to what makes a great conversational AI experience. Since it's inception Stealth has placed a heavy emphasis on on NLP technology. It's proven hard to train initially and very fickle to scale. AKA: you retrain one intent and it effects another.
Leveraging a LLM to take over these will allow developers to quickly the LLM scale and developer smarter more capable bots quicker.
The foundation for this will be Spectre our open source LLM prompting template library (with RAG support) that will allow developers to use, edit and create their own prompts to send to the LLM to return back a useable system or conversational response.
For Stealth, we'll create out of the box examples that will be included via our generator files, but I'd expect developers to quickly adapt and change their prompts.
These prompts will vary in structure. For example, for intent classification and entity recognition, we'll use a "few shot learning" prompt and you'll be able to access these in the flow files. For natural language generation and rephrasing we'll use a prompt that has access to chat history and intents you'll be able to access these in the flow and reply files.
Our initial focus will be:
- LLM Intent Classification - This can be used for both in scope responses (handle_response) to handle question responses and out of scope responses (I'm driving)to handle routing.
- LLM Entity Recognition - Let's try to handle dates and times out of the box. However, allowing the templates flexibility to create something specific like "insurance_providers"
- LLM Natural Language Generation (and rephrasing) - My gut tells me we'll create a couple of helpers to expand off say. For example,
say_nlg
andsay_nlg_rephrased("I'm sorry, I didn't understand)
.With much ✌️ and 🖤,
Mav Automation Ventures.