make_litellm_lm
gepa.gepa_launcher.make_litellm_lm(model_name: str, **kwargs: Any) -> LanguageModel
Convert a LiteLLM model name string to a :class:LanguageModel callable.
The returned callable conforms to the LanguageModel protocol and
accepts a plain str prompt, a list[dict] chat-messages list, or
a multimodal messages list (with content arrays containing images).
Uses :class:gepa.lm.LM which handles reasoning model detection
(o1/o3/o4/gpt-5), retries with exponential backoff, truncation
warnings, and drop_params=True for cross-model compatibility.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name | str | LiteLLM model identifier (e.g. "openai/gpt-5"). | required |
**kwargs | Any | Extra keyword arguments forwarded to litellm.completion (e.g. reasoning_effort="high", temperature=0.7). | {} |
Source code in gepa/gepa_launcher.py
text
def make_litellm_lm(model_name: str, **kwargs: Any) -> LanguageModel:
"""Convert a LiteLLM model name string to a :class:`LanguageModel` callable.
The returned callable conforms to the ``LanguageModel`` protocol and
accepts a plain ``str`` prompt, a ``list[dict]`` chat-messages list, or
a multimodal messages list (with content arrays containing images).
Uses :class:`gepa.lm.LM` which handles reasoning model detection
(o1/o3/o4/gpt-5), retries with exponential backoff, truncation
warnings, and ``drop_params=True`` for cross-model compatibility.
Args:
model_name: LiteLLM model identifier (e.g. ``"openai/gpt-5"``).
**kwargs: Extra keyword arguments forwarded to ``litellm.completion``
(e.g. ``reasoning_effort="high"``, ``temperature=0.7``).
"""
from gepa.lm import LM
return LM(model_name, **kwargs)