DSPy: The framework for programming—not prompting—language models
Python
add kwargs back
chenmoneygithub4ef3841cf256
diff --git a/dspy/clients/lm.py b/dspy/clients/lm.pyindex 6dc32940e..39a7ff8b9 100644--- a/dspy/clients/lm.py+++ b/dspy/clients/lm.py@@ -17,12 +17,13 @@ if "LITELLM_LOCAL_MODEL_COST_MAP" not in os.environ:class LM:- def __init__(self, model, model_type="chat", temperature=0.0, max_tokens=1000, cache=True):+ def __init__(self, model, model_type="chat", temperature=0.0, max_tokens=1000, cache=True, **kwargs):self.model = modelself.model_type = model_typeself.cache = cacheself.temperature = temperatureself.max_tokens = max_tokens+ self.kwargs = kwargsself.history = []if "o1-" in model:@@ -34,7 +35,7 @@ class LM:# Build the request.cache = kwargs.pop("cache", self.cache)messages = messages or [{"role": "user", "content": prompt}]- kwargs = {"temperature": self.temperature, "max_tokens": self.max_tokens, **kwargs}+ kwargs = {"temperature": self.temperature, "max_tokens": self.max_tokens, **self.kwargs, **kwargs}# Make the request and handle LRU & disk caching.if self.model_type == "chat":