Skip to content

Commit

Permalink
Improve handling around optional attrs (#3151)
Browse files Browse the repository at this point in the history
Summary:

After disccusion offline with lena-kashtelyan we decided that _none_throws_experiment() is a little verbose and it would be easier for developers to have a simple property with a short name to access attributes that may or may not be set on the Client. That being said we wanted to still keep them private as to not imply that it was supported behavior for users to call these functions and rely on their outputs' structure not changing.

With that in mind we're making the following changes:
1. All optional attrs are prefixed with _maybe ex. _experiment becomes _maybe_experiment
2. All optional attrs get a @/property where the maybe is dropped and none_throws is called
3. _generation_strategy and _early_stopping_strategy get special methods that either return either return the existing attr or instantiate some default, call client.set, and return. This is important so a user that is fine with defaults will not have to call client.configure_generation_strategy(GenerationStrategyConfig()) manually

Reviewed By: lena-kashtelyan

Differential Revision: D66833556
  • Loading branch information
mpolson64 authored and facebook-github-bot committed Dec 6, 2024
1 parent f0ad2e4 commit d27b349
Show file tree
Hide file tree
Showing 2 changed files with 160 additions and 184 deletions.
Loading

0 comments on commit d27b349

Please sign in to comment.