Query Intent Classifier (core/query-intent.ts)

oh-my-pi · packages/mnemopi/src/core/query-intent.ts · typescript · MIT
ai, search, lang:typescript, tag:intent, tag:classification

Classifies user queries into semantic intent categories and calculates retrieval bias weights.

// Source: https://github.com/can1357/oh-my-pi | License: MIT | Copyright 2025 Mario Zechner
// Provided via justclaw.it.com; keep this notice with the code.
export type QueryIntentCategory = "temporal" | "factual" | "entity" | "preference" | "procedural" | "general";

export interface QueryIntent {
	readonly category: QueryIntentCategory;
	readonly confidence: number;
	readonly signals: QueryIntentCategory[];
	readonly vec_bias: number;
	readonly fts_bias: number;
	readonly importance_bias: number;
}

export interface IntentWeights {
	readonly vec_bias: number;
	readonly fts_bias: number;
	readonly importance_bias: number;
}

type IntentPatternGroup = readonly [QueryIntentCategory, readonly RegExp[]];

export const INTENT_PATTERNS: readonly IntentPatternGroup[] = [
	[
		"temporal",
		[
		

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key