gopidesupavan commented on code in PR #68372:
URL: https://github.com/apache/airflow/pull/68372#discussion_r3416798536


##########
providers/common/ai/src/airflow/providers/common/ai/durable/storage.py:
##########
@@ -99,32 +99,46 @@ def _save_cache(self) -> None:
         path.parent.mkdir(parents=True, exist_ok=True)
         path.write_text(json.dumps(self._cache))
 
-    def save_model_response(self, key: str, response: ModelResponse) -> None:
-        """Serialize and store a ModelResponse in the cache."""
+    def save_model_response(
+        self, key: str, response: ModelResponse, *, fingerprint: str | None = 
None
+    ) -> None:
+        """Serialize and store a ModelResponse with the request fingerprint 
that produced it."""
         cache = self._load_cache()
-        cache[key] = ModelMessagesTypeAdapter.dump_json([response]).decode()
+        data = ModelMessagesTypeAdapter.dump_json([response]).decode()
+        cache[key] = json.dumps({"fingerprint": fingerprint, "data": data})

Review Comment:
   the data field becomes double JSON encoding, any intention behind this? or 
should make data field python dump . 
`ModelMessagesTypeAdapter.dump_python([response], mode="json")` and finally 
json.dumps?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to