get rid of think tags
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import os
|
||||
from ollama import Client
|
||||
|
||||
import re
|
||||
|
||||
class OllamaGenerator:
|
||||
|
||||
@@ -34,7 +34,9 @@ class OllamaGenerator:
|
||||
'content': f'{prompt}',
|
||||
},
|
||||
])
|
||||
return self.response['message']['content']
|
||||
|
||||
# the deepseek model returns <think> this removes those tabs from the output
|
||||
return re.sub(r"<think|.\n\r+?|([^;]*)\/think>",'',self.response['message']['content'])
|
||||
|
||||
except Exception as e:
|
||||
raise Exception(f"Failed to generate markdown: {e}")
|
||||
@@ -42,3 +44,4 @@ class OllamaGenerator:
|
||||
def save_to_file(self, filename: str) -> None:
|
||||
with open(filename, "w") as f:
|
||||
f.write(self.generate_markdown())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user