@alnliang/tlv
Version:
Lightweight AI-powered tool for verifying and correcting translations in JSON language files using any OpenAI-compatible API
58 lines (57 loc) • 1.6 kB
TypeScript
export interface RAGDocument {
id: string;
content: string;
metadata: {
sourceLanguage: string;
targetLanguage: string;
domain?: 'api' | 'ui' | 'documentation' | 'error-messages' | 'general';
context?: string;
sourceFile?: string;
confidence?: number;
};
}
export interface RAGSearchOptions {
maxResults?: number;
scoreThreshold?: number;
filters?: Record<string, any>;
languagePair?: {
source: string;
target: string;
};
}
export interface RAGResult {
document: RAGDocument;
score: number;
snippet?: string;
}
export interface RAGProvider {
initialize(config: RAGProviderConfig): Promise<void>;
search(query: string, options?: RAGSearchOptions): Promise<RAGResult[]>;
addDocuments?(documents: RAGDocument[]): Promise<void>;
getStatus?(): Promise<RAGProviderStatus>;
}
export interface RAGProviderConfig {
credentials: Record<string, any>;
indexName?: string;
namespace?: string;
providerSpecific?: Record<string, any>;
}
export interface RAGProviderStatus {
isHealthy: boolean;
documentsCount?: number;
lastUpdated?: Date;
providerInfo?: Record<string, any>;
}
export interface TranslationContext {
sourceText: string;
targetLanguage: string;
sourceLanguage: string;
stringId: string;
domain?: string;
}
export interface RAGEnhancedVerificationOptions {
enableTranslationMemory?: boolean;
enableTerminologyConsistency?: boolean;
enableContextualGuidance?: boolean;
ragSearchOptions?: RAGSearchOptions;
}