Where answers come from

Some pages can ask a language model questions. Set this up once; your choice is remembered in this browser for the whole site.

Model source
Use another source instead

Smallest-to-largest weight downloads. Qwen3.5 0.8B is our starting choice for page Q&A. GPU estimates are not total RAM: leave room for the browser, context and temporary buffers. Hardware changes speed and capacity; answers still need checking.

Session-only loading avoids saving model weights, uses extra RAM and downloads again after unloading. Turn it off to save downloads. Delete-data-on-exit or private browsing may impose a much smaller storage limit than the displayed estimate.

You sign in on OpenRouter; it gives this page a key for your account.

A free account does not make every model free. Choose a model with a listed :free variant; merely adding that suffix does not create one. Check free-model availability and pricing.

Chat

AI assistant, not Shawn Hartsock. It does not speak for him.

Inspect the page excerpt

Up to 4,800 characters, not the whole site. Recent conversation turns are retained within the model’s context limit.

Ask about this page, or just say hello.

Ready when you are.

Not saved or uploaded automatically. Closing keeps this conversation in this tab; changing pages starts a new one. Model replies can be wrong.

GenericRulesEngine: an Abstract Class

Originally published .

This is my take on how to implement rules engines in a project. I’m still working a few things out but you get the idea.


package com.vifprogram.tie;

import java.io.InputStream;

import java.rmi.RemoteException;

import javax.rules.InvalidRuleSessionException;

import javax.rules.RuleRuntime;

import javax.rules.RuleServiceProvider;

import javax.rules.RuleServiceProviderManager;

import javax.rules.StatelessRuleSession;

import javax.rules.admin.LocalRuleExecutionSetProvider;

import javax.rules.admin.RuleAdministrator;

import javax.rules.admin.RuleExecutionSet;

import javax.rules.admin.RuleExecutionSetDeregistrationException;

import org.drools.jsr94.rules.RuleServiceProviderImpl;

/**

* This is the base class for you to write your own rules driven things.

* @author shawn

*

*/

public abstract class GenericRulesEngine {

 private final String RULE_SERVICE_PROVIDER = "http://drools.org/";

 protected String RULE_URI = null;

 protected StatelessRuleSession _statelessRuleSession;

 protected RuleAdministrator _ruleAdministrator;

 private boolean _clean = false;

 public GenericRulesEngine() {

  super();

  RULE_URI = getRuleURI();

 }

 /**

  * Returns the string such as MyClassName.drl

  * @return

  */

 protected abstract String getRuleURI();

 /**

  * you could implement just this...

  *  return AssignmentManager.class.getResourceAsStream(RULE_URI);

  * or invent some fancier method of loading the resources...

  * @return

  */

 protected abstract InputStream getRules();

 /**

  * runs the cleanup

  */

 protected void finalize() throws Throwable {

  if(!_clean) {

   cleanUp();

  }

 }

 /**

  * set up the rules engine

  *

  */

 protected void prepare() throws Exception {

     RuleServiceProviderManager.registerRuleServiceProvider(

             RULE_SERVICE_PROVIDER, RuleServiceProviderImpl.class );

     RuleServiceProvider ruleServiceProvider =

             RuleServiceProviderManager.getRuleServiceProvider(RULE_SERVICE_PROVIDER);

     _ruleAdministrator = ruleServiceProvider.getRuleAdministrator( );

     LocalRuleExecutionSetProvider ruleSetProvider =

             _ruleAdministrator.getLocalRuleExecutionSetProvider(null);

     /*

      * This is the point at which the rules file is loaded. If you wanted

      * the rules file to load from a different location you would change

      * this here:

      */

     InputStream rules = getRules();

     RuleExecutionSet ruleExecutionSet =

             ruleSetProvider.createRuleExecutionSet(rules, null);

     _ruleAdministrator.registerRuleExecutionSet(RULE_URI, ruleExecutionSet, null);

     RuleRuntime ruleRuntime = ruleServiceProvider.getRuleRuntime();

     _statelessRuleSession =

             (StatelessRuleSession) ruleRuntime.createRuleSession(

                     RULE_URI, null, RuleRuntime.STATELESS_SESSION_TYPE );

 }

 /**

  * @throws RemoteException

  * @throws InvalidRuleSessionException

  * @throws RuleExecutionSetDeregistrationException

  */

 private void cleanUp() throws InvalidRuleSessionException, RemoteException, RuleExecutionSetDeregistrationException {

  _clean = true;

  _statelessRuleSession.release();

  _ruleAdministrator.deregisterRuleExecutionSet(RULE_URI, null);

 }

BTW: I ripped off most of this I’m sure. I just can’t remember who from.

Explore the map · Browse by topic and date