Prompt Cache Key
Implement prompt_cache_key(model, version, messages). Return a lowercase SHA-256 hex digest of the UTF-8 JSON encoding of [model, version, messages], using json.dumps(..., ensure_ascii=False, separators=(',', ':')) and Python's standard library. messages is a list of [role, content] pairs. Preserve message order. The model and version must be part of the key to prevent stale cross-version cache hits.
Examples
A guided view of the published example, not a trace of your code.
["model-a","v1",[]]"58603cc7e71fb369a5bb6d3396c47035e54765e95dbe57d6496767a9decddf42"Start with the input values shown in this example.
Input: model = "model-a", version = "v1", messages = []
Output: "58603cc7e71fb369a5bb6d3396c47035e54765e95dbe57d6496767a9decddf42"
Explanation: empty conversation
Input: model = "model-a", version = "v2", messages = []
Output: "0addcd15424a82161d590cdee241baf78f97673069281023351d120b74c57508"
Explanation: new version
Hint 1
Serialize one list containing all three inputs.
Hint 2
Use ensure_ascii=False and compact separators exactly as specified.