put

suspend fun put(prompt: String, response: String, scope: String = DEFAULT_SCOPE, metadata: Map<String, String> = emptyMap(), tags: Set<String> = emptySet()): String

Caches response as the answer to prompt and returns the new entry's id.

Costs one Embedder.embed call. Prefer getOrPut, which embeds once for the lookup and the write together.

The returned id is the one assigned to the entry. If a CachePolicy vetoes the write, no entry is stored and the id names nothing — the veto is reported as CacheEvent.WriteVetoed and counted in CacheStats.writesVetoed, which is where a caller that needs to know should look. The return type is kept as-is rather than made nullable because narrowing it would break every existing caller for a case that only arises once a policy is configured.