summaryrefslogtreecommitdiff
path: root/rag/generator
diff options
context:
space:
mode:
Diffstat (limited to 'rag/generator')
-rw-r--r--rag/generator/abstract.py8
-rw-r--r--rag/generator/ollama.py9
2 files changed, 1 insertions, 16 deletions
diff --git a/rag/generator/abstract.py b/rag/generator/abstract.py
index 71edfc4..1beacfb 100644
--- a/rag/generator/abstract.py
+++ b/rag/generator/abstract.py
@@ -1,5 +1,5 @@
from abc import abstractmethod
-from typing import Any, Dict, Generator, List
+from typing import Any, Generator
from .prompt import Prompt
@@ -16,9 +16,3 @@ class AbstractGenerator(type):
@abstractmethod
def generate(self, prompt: Prompt) -> Generator[Any, Any, Any]:
pass
-
- @abstractmethod
- def chat(
- self, prompt: Prompt, messages: List[Dict[str, str]]
- ) -> Generator[Any, Any, Any]:
- pass
diff --git a/rag/generator/ollama.py b/rag/generator/ollama.py
index 77f8304..b72d763 100644
--- a/rag/generator/ollama.py
+++ b/rag/generator/ollama.py
@@ -39,12 +39,3 @@ class Ollama(metaclass=AbstractGenerator):
metaprompt = self.__metaprompt(prompt)
for chunk in ollama.generate(model=self.model, prompt=metaprompt, stream=True):
yield chunk["response"]
-
- def chat(
- self, prompt: Prompt, messages: List[Dict[str, str]]
- ) -> Generator[Any, Any, Any]:
- log.debug("Generating answer with ollama...")
- metaprompt = self.__metaprompt(prompt)
- messages.append({"role": "user", "content": metaprompt})
- for chunk in ollama.chat(model=self.model, messages=messages, stream=True):
- yield chunk["message"]["content"]