game-analysis-types
Version:
Common TypeScript types and utilities for game analysis tools.
33 lines • 1.18 kB
TypeScript
export interface EmbeddingResult {
embedding: number[];
dimensions: number;
}
/**
* Service for generating text embeddings using a pre-trained transformer model.
* Designed to be a singleton or instantiated once per model needed.
*/
export declare class EmbeddingService {
private extractor;
private modelName;
private modelDimensions;
constructor(modelName?: string);
/**
* Initializes the embedding model pipeline.
* Must be called before generateEmbedding.
*/
initializeModel(): Promise<void>;
/**
* Generates an embedding for the given text.
* Ensures the model is initialized.
* @param text The text to embed.
* @returns An EmbeddingResult containing the vector and its dimensions, or null if error.
*/
generateEmbedding(text: string): Promise<EmbeddingResult | null>;
/**
* Gets the expected dimensions of the embeddings produced by the model.
* Caches the result after the first successful embedding generation.
* @returns The number of dimensions, or null if not determined yet.
*/
getModelDimensions(): Promise<number>;
}
//# sourceMappingURL=EmbeddingService.d.ts.map