From 697328ec6224e700cefbafcab465cd215f89110e Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Thu, 29 Jan 2026 12:42:42 +0000 Subject: [PATCH] Add shellgen core and backends modules --- app/shellgen/backends/base.py | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 app/shellgen/backends/base.py diff --git a/app/shellgen/backends/base.py b/app/shellgen/backends/base.py new file mode 100644 index 0000000..94fb11d --- /dev/null +++ b/app/shellgen/backends/base.py @@ -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