Skip to content

Commit

Permalink
fix bug,fix#modelscope#487
Browse files Browse the repository at this point in the history
  • Loading branch information
杨堃 committed Jun 13, 2024
1 parent fe1bc43 commit 4a8204e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion modelscope_agent/llm/ollama.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@ def __init__(self, model: str, model_server: str, **kwargs):
host = kwargs.get('host', 'http://localhost:11434')
self.client = ollama.Client(host=host)
self.model = model
self.client.pull(self.model)
try:
logger.debug(f'Pulling model {self.model}')
self.client.pull(self.model)
except Exception as e:
logger.warning(
f'Warning: Failed to pull model {self.model} from {host}: {e}')

logger.info(
f'Initialization of OllamaLLM with model {self.model} done')

def _chat_stream(self,
messages: List[Dict],
Expand Down

0 comments on commit 4a8204e

Please sign in to comment.