Repository navigation
feat: add safe repr implementations for watsonx and litellm backends - #1359
Conversation
Added __repr__ and __str__ to show useful information with masked api_key Closes generative-computing#1317 Signed-off-by: Vishal V <[email protected]>
|
@cptnm3 thanks for the PR! If you don't mind, could you leave a comment on the issue so we can assign it to you? |
|
Done @psschwei . Sorry, in the contribution guidelines I did not see that I have to be assigned to an issue before working on it. Will keep in mind next time. Thanks! |
|
no worries! |
AngeloDanducci
left a comment
There was a problem hiding this comment.
Thanks for the contribution, @cptnm3! The implementation looks good overall and follows the existing OpenAIBackend pattern nicely.
I've left a few inline comments with some requested changes — mostly moving and mocking some of the tests, and a couple of small test improvements. Once those are addressed this should be good to go.
Watsonx repr tests moved to test_watsonx_repr.py — plain unit tests, no e2e/require_api_key markers. Fix inverted assertions in test_repr_no_key_shows_none; add test_repr_env_key_is_masked for env-resolved key path. Use _make_backend helper + mock Credentials to avoid real SDK init. LiteLLM repr test moved to test_litellm_repr.py. Add test_repr_omits_default_base_url and test_str_shows_model_id_and_base_url. Fix LiteLLMBackend.__repr__ to show base_url=None when caller omitted it. Signed-off-by: Vishal V <[email protected]>
|
Hi @AngeloDanducci. thanks for the review. I have made the suggested changes. Please take a look and let me know in case I have missed anything else |
There was a problem hiding this comment.
Thanks for the update - fixes all of the review feedback. Just need to move the new test file. Currently it's outside of the pytest testpaths so it won't run.
Once you move mellea/backends/test_litellm_repr.py to test/backends/test_litellm_repr.py it should be good to go.
Signed-off-by: Vishal V <[email protected]>
|
@AngeloDanducci thanks for catching that! it was an oversight on my end. Please take a look now. |
Pull Request
Issue
Fixes #1317
Description
Added
__repr__and__str__to show useful information with masked api_keyTesting
Attribution
Adding a new component, requirement, sampling strategy, or tool?
If your PR adds or modifies one of the types below, check the matching box. A checklist of type-specific review items will be posted as a comment.
NOTE: Please ensure you have an issue that has been acknowledged by a core contributor and routed you to open a pull request against this repository. Otherwise, please open an issue before continuing with this pull request.