sohailshk commented on code in PR #41196:
URL: https://github.com/apache/beam/pull/41196#discussion_r4545928823
##########
sdks/python/apache_beam/ml/inference/anthropic_inference.py:
##########
@@ -116,6 +116,7 @@ def message_from_string(
inference_args: additional arguments passed to the messages.create call.
Common args include 'max_tokens', 'system', 'temperature', 'top_p'.
"""
+ inference_args = dict(inference_args)
max_tokens = inference_args.pop('max_tokens', 1024)
Review Comment:
Thanks! I tried the `.get` version first, but then `max_tokens` is still in
`inference_args`, so whenever a user sets it, `messages.create(max_tokens=...,
**inference_args)` raises `TypeError: got multiple values for keyword argument
'max_tokens'`.
I pushed 3408f45, which drops the copy instead: the 1024 default is passed
only when `inference_args` has no `max_tokens`, and `inference_args` is passed
through as is. The two new tests fail on master and pass with this;
`anthropic_inference_test.py` passes (25 tests).
--
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]