Skip to content

Commit a6d7b40

Browse files
committed
fix: added error catching
1 parent 5dd50b3 commit a6d7b40

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/ai/LLM/Stretegies/OLLAMAService.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,12 @@ def init_pull_model(self) -> None:
9292
:return: None
9393
"""
9494
payload = {"name": self.model_name}
95-
response = httpx.post(self.pull_url, json=payload, timeout=60 * 10) # 10 minutes timeout
96-
response.raise_for_status()
95+
try:
96+
response = httpx.post(self.pull_url, json=payload, timeout=60 * 10) # 10 minutes timeout
97+
response.raise_for_status()
98+
except httpx.ConnectError as e:
99+
logger.error(f"Failed to connect to the OLLAMA server: {e}")
100+
logger.info(f"Ollama URL is {self.pull_url}")
97101

98102
def get_model_name(self) -> str:
99103
"""

0 commit comments

Comments
 (0)