Add shellgen core and backends modules

This commit is contained in:
2026-01-29 12:42:42 +00:00
parent 4b83e5bc5b
commit 697328ec62

View File

@@ -0,0 +1,52 @@
"""Abstract base class for LLM backends."""
from abc import ABC, abstractmethod
from typing import Optional
class LLMBackend(ABC):
"""Abstract base class for LLM backends."""
@abstractmethod
def generate(self, prompt: str) -> str:
"""Generate a response from the LLM.
Args:
prompt: The prompt to send to the LLM.
Returns:
The generated response text.
"""
pass
@abstractmethod
def is_available(self) -> bool:
"""Check if the backend is available.
Returns:
True if the backend can be used.
"""
pass
@abstractmethod
def get_model_name(self) -> str:
"""Get the name of the currently loaded model.
Returns:
Model name string.
"""
pass
@abstractmethod
def set_model(self, model: str) -> None:
"""Set the model to use.
Args:
model: Name of the model to load.
"""
pass
@abstractmethod
def close(self) -> None:
"""Clean up resources."""
pass