# Class PreferenceRouter

Preference-trained router that learns from human preference data.

- Defined in packages/nexus-agents/src/cli-adapters/preference-router.ts:48

##### Index

### Constructors

constructor

### Methods

route
recordPreference
getStats
hasMinimumData

## Constructors

### constructor

- new PreferenceRouter(
  config?: Partial<PreferenceRouterConfig>,
  dataStore?: IPreferenceDataStore,
  ): PreferenceRouter

  #### Parameters

  - config: Partial<PreferenceRouterConfig> = {}
  - `Optional` dataStore: IPreferenceDataStore

  #### Returns PreferenceRouter

  - Defined in packages/nexus-agents/src/cli-adapters/preference-router.ts:53

## Methods

### route

- route(query: string): PreferenceRoutingDecision

  Route a query to the optimal model based on learned preferences.

  #### Parameters

  - query: string

  #### Returns PreferenceRoutingDecision

  - Defined in packages/nexus-agents/src/cli-adapters/preference-router.ts:72

### recordPreference

- recordPreference(
  query: string,
  strongModelPreferred: boolean,
  strongModelQuality?: number,
  weakModelQuality?: number,
  ): PreferenceDataPoint

  Record a preference data point for online learning.

  #### Parameters

  - query: string
  - strongModelPreferred: boolean
  - `Optional` strongModelQuality: number
  - `Optional` weakModelQuality: number

  #### Returns PreferenceDataPoint

  - Defined in packages/nexus-agents/src/cli-adapters/preference-router.ts:107

### getStats

- getStats(): PreferenceModelStats

  Get statistics about the learned preference model.

  #### Returns PreferenceModelStats

  - Defined in packages/nexus-agents/src/cli-adapters/preference-router.ts:140

### hasMinimumData

- hasMinimumData(): boolean

  Check if the router has enough data to make informed decisions.

  #### Returns boolean

  - Defined in packages/nexus-agents/src/cli-adapters/preference-router.ts:147