Utility object for generating cache keys using secure hashing. Keys are deterministic (the same inputs always produce the same key) and unambiguous: every part is prefixed with its length before hashing, so two different sequences of parts never hash the same input, whatever characters the parts contain.
The default embedding cache key: the text, the model name and the purpose of the request, each encoded as a part of its own, so a query and a document with the same text never share a key, and no model name or text can stand in for another.
The default embedding cache key: the text, the model name and the purpose of the request, each encoded as a part of its own, so a query and a document with the same text never share a key, and no model name or text can stand in for another.
Value parameters
model
The model name
purpose
Whether the text is embedded as a document or as a query
The SHA-256 of the given parts, each prefixed with its length and a colon (5:hello), so the encoding is unambiguous: sha256("a:b", "c") and sha256("a", "b:c") are different keys. Use it to build a key function of your own that adds parts, such as a tenant.
The SHA-256 of the given parts, each prefixed with its length and a colon (5:hello), so the encoding is unambiguous: sha256("a:b", "c") and sha256("a", "b:c") are different keys. Use it to build a key function of your own that adds parts, such as a tenant.