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


##########
providers/anthropic/src/airflow/providers/anthropic/hooks/anthropic.py:
##########
@@ -409,17 +409,35 @@ def count_tokens(
             params["system"] = system
         return self.conn.messages.count_tokens(**params).input_tokens
 
-    def create_batch(self, requests: list[dict[str, Any]]) -> MessageBatch:
+    @staticmethod
+    def _apply_default_model(request: dict[str, Any], default_model: str) -> 
dict[str, Any]:
+        """
+        Fill ``params['model']`` from ``default_model`` when the request omits 
it.
+
+        The input dict is never mutated, and a request that sets its own 
``model`` is
+        returned unchanged, so a single batch can still mix models across 
requests.
+        """
+        params = request.get("params")
+        if not isinstance(params, dict) or params.get("model"):

Review Comment:
   ```suggestion
           if not isinstance(params, dict) and params.get("model"):
   ```
   Shouldn't this condition use and instead? With the current or, if params is 
None, the first condition evaluates to True and returns immediately, so we 
never get a chance to add the default model. Is that intentional?



-- 
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