karthik-0306 opened a new pull request, #41718:
URL: https://github.com/apache/beam/pull/41718

   Fixes #41712
   
   The OpenAI, Anthropic, Gemini and Vertex AI model handlers read `env_vars` 
with `kwargs.get(...)`, which left it in `kwargs`, and then passed `**kwargs` 
to `RemoteModelHandler.__init__`, which doesn't accept it. So passing 
`env_vars` raised `TypeError: RemoteModelHandler.__init__() got an unexpected 
keyword argument 'env_vars'`, although it's documented for all model handlers.
   
   This takes `env_vars` out of `kwargs` with `kwargs.pop(...)` in the four 
handlers, so `RunInference` sets the variables on the worker before the client 
is created, as with the other handlers. The four docstrings now document 
`env_vars`.
   
   Testing:
   - Added a test for each handler. The OpenAI, Anthropic and Gemini tests run 
a pipeline whose `request_fn` returns the value of the variable on the worker; 
the Vertex AI test checks `set_environment_vars()`. The new tests fail on 
master with the `TypeError` and pass with the fix.
   - `openai_inference_test.py`, `anthropic_inference_test.py`, 
`gemini_inference_test.py`, `vertex_ai_inference_test.py`: 97 passed.
   - yapf and ruff are clean on the touched files.
   
   R: @jrmccluskey


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

  • [PR] [RunInference] Accept env... karthik-0306 (via GitHub) via github

Reply via email to