• Get or generate embedding with content-addressable caching

    Checks if an embedding with the same contentHash already exists. If yes, increments usage count and returns cached embedding. If no, generates new embedding and stores in cache.

    Parameters

    • contentHash: string

      Hash of embedding text

    • embeddingText: string

      Text to embed

    • db: Surreal

      SurrealDB instance

    Returns Promise<number[]>

    Embedding vector