jrmccluskey commented on code in PR #41196:
URL: https://github.com/apache/beam/pull/41196#discussion_r4587410059


##########
sdks/python/apache_beam/ml/inference/anthropic_inference.py:
##########
@@ -116,15 +116,17 @@ def message_from_string(
     inference_args: additional arguments passed to the messages.create call.
       Common args include 'max_tokens', 'system', 'temperature', 'top_p'.
   """
-  max_tokens = inference_args.pop('max_tokens', 1024)
+  # Pass the default only when the caller gave no max_tokens, without
+  # changing inference_args: RunInference reuses that dict for every batch.
+  default_args = {} if 'max_tokens' in inference_args else {'max_tokens': 1024}

Review Comment:
   Beyond the comment being unnecessary, this is really something that 
can/should be done once in the transform constructor rather than in every 
single inference function



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