Skip to content

Commit

Permalink
Merge pull request #943 from xyloid/fix/ollama_copy
Browse files Browse the repository at this point in the history
fix(dspy): added `copy` to `OllamaLocal` to propagate `model`, `model_type`, `base_url` and `timeout_s`.
  • Loading branch information
arnavsinghvi11 authored May 5, 2024
2 parents 733a127 + c7d45b6 commit 7b76165
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions dsp/modules/ollama.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,15 @@ def __call__(
completions = [self._get_choice_text(c) for c in choices]

return completions

def copy(self, **kwargs):
"""Returns a copy of the language model with the same parameters."""
kwargs = {**self.kwargs, **kwargs}

return self.__class__(
model=self.model_name,
model_type=self.model_type,
base_url=self.base_url,
timeout_s=self.timeout_s,
**kwargs,
)

0 comments on commit 7b76165

Please sign in to comment.