Skip to content

Commit 7b76165

Browse files
Merge pull request #943 from xyloid/fix/ollama_copy
fix(dspy): added `copy` to `OllamaLocal` to propagate `model`, `model_type`, `base_url` and `timeout_s`.
2 parents 733a127 + c7d45b6 commit 7b76165

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

dsp/modules/ollama.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,15 @@ def __call__(
180180
completions = [self._get_choice_text(c) for c in choices]
181181

182182
return completions
183+
184+
def copy(self, **kwargs):
185+
"""Returns a copy of the language model with the same parameters."""
186+
kwargs = {**self.kwargs, **kwargs}
187+
188+
return self.__class__(
189+
model=self.model_name,
190+
model_type=self.model_type,
191+
base_url=self.base_url,
192+
timeout_s=self.timeout_s,
193+
**kwargs,
194+
)

0 commit comments

Comments
 (0)