Class HashEmbeddingProvider

java.lang.Object
com.tnsai.llm.cache.HashEmbeddingProvider
All Implemented Interfaces:
EmbeddingProvider

public class HashEmbeddingProvider extends Object implements EmbeddingProvider
Simple hash-based embedding provider for testing and development.

This provider creates pseudo-embeddings by hashing the input text. It's NOT suitable for production semantic search, but useful for:

  • Unit testing cache functionality
  • Development without API keys
  • Exact-match caching scenarios

Limitations

Hash-based embeddings only match identical strings. For true semantic similarity (where "How are you?" matches "How're you doing?"), use a real embedding model like OpenAI or sentence-transformers.

  • Constructor Details

    • HashEmbeddingProvider

      public HashEmbeddingProvider()
    • HashEmbeddingProvider

      public HashEmbeddingProvider(int dimension)
  • Method Details