diff --git a/app/src/git_commit_generator/ollama_client.py b/app/src/git_commit_generator/ollama_client.py index 1c621b1..74fa68a 100644 --- a/app/src/git_commit_generator/ollama_client.py +++ b/app/src/git_commit_generator/ollama_client.py @@ -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 []