arela
Version:
AI-powered CTO with multi-agent orchestration, code summarization, visual testing (web + mobile) for blazing fast development.
64 lines • 2.03 kB
TypeScript
import { MemoryLayer } from "../memory/hexi-memory.js";
import type { QueryType, ClassificationResult } from "./types.js";
/**
* QueryClassifier - Classifies user queries and determines which memory layers to query
*
* Supports two backends:
* 1. OpenAI (gpt-4o-mini) - Fast, cheap, reliable (~200ms, $0.0001/query)
* 2. Ollama (qwen2.5:3b) - Free, local, slower (~1.5s)
*
* Query types:
* - PROCEDURAL: "Continue working on...", "Implement..."
* - FACTUAL: "What is...", "How does..."
* - ARCHITECTURAL: "Show me structure...", "Dependencies..."
* - USER: "What's my preferred...", "My expertise..."
* - HISTORICAL: "What decisions...", "Why did we..."
* - GENERAL: Fallback
*/
export declare class QueryClassifier {
private readonly ollamaModel;
private readonly openaiModel;
private ollamaAvailable;
private openaiAvailable;
private openai?;
private preferOpenAI;
/**
* Initialize the classifier and check availability of backends
*/
init(): Promise<void>;
/**
* Classify a query using best available backend
* Priority: OpenAI (fast) > Ollama (free) > Fallback (keyword-based)
*/
classify(query: string): Promise<ClassificationResult>;
/**
* Classify using Ollama
*/
private classifyWithOllama;
/**
* Classify using OpenAI (gpt-4o-mini)
* Fast (~200ms) and cheap ($0.0001/query)
*/
private classifyWithOpenAI;
/**
* Fallback classification using simple keyword matching
*/
private fallbackClassification;
/**
* Normalize query type string to enum
*/
private normalizeQueryType;
/**
* Get routing rule for a query type
*/
private getRoutingRule;
/**
* Get suggested layers for a query type (public API)
*/
getSuggestedLayers(type: QueryType): MemoryLayer[];
/**
* Get layer weights for a query type (public API)
*/
getLayerWeights(type: QueryType): Record<MemoryLayer, number>;
}
//# sourceMappingURL=classifier.d.ts.map