Fix CI: properly define response variable in ollama_client.py
Some checks failed
CI / test (push) Failing after 13s

This commit is contained in:
2026-02-04 18:43:52 +00:00
parent 1ebc45808e
commit edd15de989

View File

@@ -1,6 +1,9 @@
"""Ollama client wrapper for LLM interactions."""
import ollama as ollama_lib
from ollama import ChatResponse, ListResponse
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ollama import ChatResponse, ListResponse
class OllamaClient:
@@ -39,7 +42,7 @@ class OllamaClient:
True if model is available, False otherwise.
"""
try:
response: ListResponse = ollama_lib.list()
response = ollama_lib.list()
return any(m["name"] == model or m["name"].startswith(model)
for m in response.get("models", []))
except Exception:
@@ -58,7 +61,7 @@ class OllamaClient:
Returns:
Generated commit message.
"""
response: ChatResponse = ollama_lib.chat(
response = ollama_lib.chat(
model=model or self.model,
messages=[
{
@@ -87,7 +90,7 @@ class OllamaClient:
Returns:
Generated changelog.
"""
response: ChatResponse = ollama_lib.chat(
response = ollama_lib.chat(
model=model or self.model,
messages=[
{
@@ -110,7 +113,7 @@ class OllamaClient:
List of available models with their details.
"""
try:
response: ListResponse = ollama_lib.list()
response = ollama_lib.list()
return response.get("models", [])
except Exception:
return []