Skip to content

options

dandy.llm.config.options

LlmConfigOptions

Source code in dandy/llm/config/options.py
def __init__(
    self,
    seed: int | None = None,
    randomize_seed: bool | None = None,
    max_input_tokens: int | None = None,
    max_output_tokens: int | None = None,
    temperature: float | None = None,
    prompt_retry_count: int | None = None,
):
    self._seed = seed
    self._randomize_seed = randomize_seed
    self._max_input_tokens = max_input_tokens
    self._max_output_tokens = max_output_tokens
    self._temperature = temperature
    self._prompt_retry_count = prompt_retry_count

seed property

randomize_seed property

max_input_tokens property

max_output_tokens property

temperature property

prompt_retry_count property

update_values

Source code in dandy/llm/config/options.py
def update_values(self, **kwargs):
    for key, value in kwargs.items():
        if hasattr(self, key) and value is not None:
            setattr(self, key, value)

merge_to_copy

Merges the current instance with another secondary instance Current instance attributes that are not none will take precedence over the secondary instance

Source code in dandy/llm/config/options.py
def merge_to_copy(self, secondary_options: Self) -> Self:
    """
    Merges the current instance with another secondary instance
    Current instance attributes that are not none will take precedence over the secondary instance
    """

    merged_dict = {
        **{
            key: value
            for key, value in secondary_options.__dict__.items()
            if value is not None
        },
        **{key: value for key, value in self.__dict__.items() if value is not None},
    }

    return self.__class__(
        **{
            key.removeprefix('_'): value
            for key, value in merged_dict.items()
        }
    )