Skip to content
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

EXTREMELY EARLY DRAFT:: Grules / Dynamic Routing #2047

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

dave-gray101
Copy link
Collaborator

@dave-gray101 dave-gray101 commented Apr 16, 2024

Pending the repair of channel refactor

This is a very early draft of some of my latest experiments for CI reasons // linking people demonstrations. It is not anywhere near ready for review // release, and this message will be updated eventually.

This feature branch is for a new dynamic routing layer. This is currently imagined as an advanced feature, potentially disabled by default. By introducing the grules rule engine, we will be able to have dynamic control between receiving a request and dispatching it to a backend.

Some examples of where I want to take this functionality:

  • Dynamic API Key Processing - limit models to api keys #2046 - rules will know what the key was, endpoint, source etc.
  • Backend Memory Management - see temporary file backend_rules_onlytwo.json, the ability to unload backends deterministically
  • Request Rewriting - Especially combined with the above two features, the core reason behind this work is the ability to have a request come in over HTTP, and if it's not immediately serviceable, enqueued onto MQTT for later processing
  • "Rules Engine Backend" - Why use a rule engine instead of a scripting language / hardcoding all of this? I have another idea in mind which is to expose the grule system as its own "retro ai backend" - since we already have pretty effective JSON generation capabilities, something that combines our store endpoints and grules may provide a simple way to afford models symbolic manipulation tools.

Signed-off-by: Dave Lee <dave@gray101.com>
Signed-off-by: Dave Lee <dave@gray101.com>
Signed-off-by: Dave Lee <dave@gray101.com>
Signed-off-by: Dave Lee <dave@gray101.com>
Signed-off-by: Dave Lee <dave@gray101.com>
Signed-off-by: Dave Lee <dave@gray101.com>
Signed-off-by: Dave Lee <dave@gray101.com>
Signed-off-by: Dave Lee <dave@gray101.com>
Signed-off-by: Dave Lee <dave@gray101.com>
Copy link

netlify bot commented Apr 16, 2024

Deploy Preview for localai canceled.

Name Link
🔨 Latest commit ef5b824
🔍 Latest deploy log https://app.netlify.com/sites/localai/deploys/661eae90267a6d0008b9fc6f

@@ -51,6 +51,8 @@ type RunCMD struct {
WatchdogIdleTimeout string `env:"LOCALAI_WATCHDOG_IDLE_TIMEOUT,WATCHDOG_IDLE_TIMEOUT" default:"15m" help:"Threshold beyond which an idle backend should be stopped" group:"backends"`
EnableWatchdogBusy bool `env:"LOCALAI_WATCHDOG_BUSY,WATCHDOG_BUSY" default:"false" help:"Enable watchdog for stopping backends that are busy longer than the watchdog-busy-timeout" group:"backends"`
WatchdogBusyTimeout string `env:"LOCALAI_WATCHDOG_BUSY_TIMEOUT,WATCHDOG_BUSY_TIMEOUT" default:"5m" help:"Threshold beyond which a busy backend should be stopped" group:"backends"`

EnableDynamicRouting bool `env:"LOCALAI_ENABLE_DYNAMIC_ROUTING,ENABLE_DYNAMIC_ROUTING" help:"Enable the advanced dynamic routing engine. Experimental!" group:"experimental"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for 2 environment variables on this one, they are just there for backwards compatibility. All future ones should be the LOCALAI_ ones

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.

None yet

2 participants