MCPcopy
hub / github.com/openai/openai-python / apply_optional_remediation

Function apply_optional_remediation

src/openai/lib/_validators.py:574–589  ·  view source on GitHub ↗

This function will apply an optional remediation to a dataframe, based on the user input.

(
    df: pd.DataFrame, remediation: Remediation, auto_accept: bool
)

Source from the content-addressed store, hash-verified

572
573
574def apply_optional_remediation(
575 df: pd.DataFrame, remediation: Remediation, auto_accept: bool
576) -> tuple[pd.DataFrame, bool]:
577 """
578 This function will apply an optional remediation to a dataframe, based on the user input.
579 """
580 optional_applied = False
581 input_text = f"- [Recommended] {remediation.optional_msg} [Y/n]: "
582 if remediation.optional_msg is not None:
583 if accept_suggestion(input_text, auto_accept):
584 assert remediation.optional_fn is not None
585 df = remediation.optional_fn(df)
586 optional_applied = True
587 if remediation.necessary_msg is not None:
588 sys.stdout.write(f"- [Necessary] {remediation.necessary_msg}\n")
589 return df, optional_applied
590
591
592def estimate_fine_tuning_time(df: pd.DataFrame) -> None:

Callers 1

apply_validatorsFunction · 0.85

Calls 1

accept_suggestionFunction · 0.85

Tested by

no test coverage detected