java.lang.Object
org.nasdanika.ai.CachingEmbeddingGenerator<S,E,K>
org.nasdanika.ai.MapCachingEmbeddingGenerator<String,E,String>
org.nasdanika.ai.CachingTextEmbeddingGenerator<E>
- All Implemented Interfaces:
EmbeddingGenerator<String,,E> TextEmbeddingGenerator<E>
public class CachingTextEmbeddingGenerator<E>
extends MapCachingEmbeddingGenerator<String,E,String>
implements TextEmbeddingGenerator<E>
Caches text embeddings in a map which can be loaded and saved between runs
Uses text digest as caching key
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.nasdanika.ai.EmbeddingGenerator
EmbeddingGenerator.Requirement -
Field Summary
Fields inherited from class org.nasdanika.ai.MapCachingEmbeddingGenerator
cacheFields inherited from class org.nasdanika.ai.CachingEmbeddingGenerator
target -
Constructor Summary
ConstructorsConstructorDescriptionCachingTextEmbeddingGenerator(TextEmbeddingGenerator<E> target, Map<String, E> cache) Uses SHA-512 algorithmCachingTextEmbeddingGenerator(TextEmbeddingGenerator<E> target, Map<String, E> cache, String algorithm) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcomputeKey(String input) Computes caching key from source.protected CharsetMethods inherited from class org.nasdanika.ai.MapCachingEmbeddingGenerator
create, generate, get, putMethods inherited from class org.nasdanika.ai.CachingEmbeddingGenerator
generateAsyncMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.nasdanika.ai.EmbeddingGenerator
adapt, generate, generate, generateAsync, generateAsync, then
-
Constructor Details
-
CachingTextEmbeddingGenerator
public CachingTextEmbeddingGenerator(TextEmbeddingGenerator<E> target, Map<String, E> cache, String algorithm) -
CachingTextEmbeddingGenerator
Uses SHA-512 algorithm- Parameters:
cache-
-
-
Method Details
-
computeKey
Description copied from class:MapCachingEmbeddingGeneratorComputes caching key from source.- Specified by:
computeKeyin classMapCachingEmbeddingGenerator<String,E, String> - Returns:
-
getCharset
-