# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/dspy/dspy.utils.ipynb.

# %% auto 0
__all__ = ['log', 'configure_lm']

# %% ../../nbs/dspy/dspy.utils.ipynb 3
import os
import dspy

from ..logging import get_logger

log = get_logger(__name__)

# %% ../../nbs/dspy/dspy.utils.ipynb 4
def configure_lm(
    model: str = "openai/gpt-4o-mini",
    temperature: float = 0.0,
    cache: bool = False,
    **kwargs,
):
    lm = dspy.LM(
        model,
        temperature=temperature,
        cache=cache,
        api_base=os.getenv("OPENAI_BASE_URL"),
        api_key=os.getenv("OPENAI_API_KEY"),
        **kwargs,
    )
    dspy.configure(lm=lm)
    return lm

