Fix CI: properly define response variable in ollama_client.py
Some checks failed
CI / test (push) Failing after 13s
Some checks failed
CI / test (push) Failing after 13s
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
"""Ollama client wrapper for LLM interactions."""
|
"""Ollama client wrapper for LLM interactions."""
|
||||||
import ollama as ollama_lib
|
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:
|
class OllamaClient:
|
||||||
@@ -39,7 +42,7 @@ class OllamaClient:
|
|||||||
True if model is available, False otherwise.
|
True if model is available, False otherwise.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
response: ListResponse = ollama_lib.list()
|
response = ollama_lib.list()
|
||||||
return any(m["name"] == model or m["name"].startswith(model)
|
return any(m["name"] == model or m["name"].startswith(model)
|
||||||
for m in response.get("models", []))
|
for m in response.get("models", []))
|
||||||
except Exception:
|
except Exception:
|
||||||
@@ -58,7 +61,7 @@ class OllamaClient:
|
|||||||
Returns:
|
Returns:
|
||||||
Generated commit message.
|
Generated commit message.
|
||||||
"""
|
"""
|
||||||
response: ChatResponse = ollama_lib.chat(
|
response = ollama_lib.chat(
|
||||||
model=model or self.model,
|
model=model or self.model,
|
||||||
messages=[
|
messages=[
|
||||||
{
|
{
|
||||||
@@ -87,7 +90,7 @@ class OllamaClient:
|
|||||||
Returns:
|
Returns:
|
||||||
Generated changelog.
|
Generated changelog.
|
||||||
"""
|
"""
|
||||||
response: ChatResponse = ollama_lib.chat(
|
response = ollama_lib.chat(
|
||||||
model=model or self.model,
|
model=model or self.model,
|
||||||
messages=[
|
messages=[
|
||||||
{
|
{
|
||||||
@@ -110,7 +113,7 @@ class OllamaClient:
|
|||||||
List of available models with their details.
|
List of available models with their details.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
response: ListResponse = ollama_lib.list()
|
response = ollama_lib.list()
|
||||||
return response.get("models", [])
|
return response.get("models", [])
|
||||||
except Exception:
|
except Exception:
|
||||||
return []
|
return []
|
||||||
|
|||||||
Reference in New Issue
Block a user