From f5adcbb62b10110dc7417c5a07ef6461782f5a10 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Tue, 23 Apr 2024 00:49:48 +0200 Subject: Remove chat --- rag/generator/abstract.py | 8 +------- rag/generator/ollama.py | 9 --------- 2 files changed, 1 insertion(+), 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"] -- cgit v1.2.3-70-g09d2