fixing more merge conflicts
This commit is contained in:
@@ -3,6 +3,7 @@ from ollama import Client
|
||||
import chromadb
|
||||
from langchain_ollama import ChatOllama
|
||||
|
||||
|
||||
class OllamaGenerator:
|
||||
|
||||
def __init__(self, title: str, content: str, inner_title: str):
|
||||
@@ -125,6 +126,7 @@ class OllamaGenerator:
|
||||
{self.content}
|
||||
"""
|
||||
try:
|
||||
<<<<<<< HEAD
|
||||
query_embed = self.ollama_client.embed(model=self.embed_model, input=prompt_system)['embeddings']
|
||||
collection = self.load_to_vector_db()
|
||||
collection_query = collection.query(query_embeddings=query_embed, n_results=100)
|
||||
@@ -145,6 +147,18 @@ class OllamaGenerator:
|
||||
#print ("Markdown Generated")
|
||||
#print (self.response)
|
||||
return self.response#['message']['content']
|
||||
=======
|
||||
self.response = self.ollama_client.chat(model=self.ollama_model,
|
||||
messages=[
|
||||
{
|
||||
'role': 'user',
|
||||
'content': f'{prompt}',
|
||||
},
|
||||
])
|
||||
|
||||
# the deepseek model returns <think> this removes those tabs from the output
|
||||
return re.sub(r"<think|.\n\r+?|([^;]*)\/think>",'',self.response['message']['content'])
|
||||
>>>>>>> e1a24af (get rid of think tags)
|
||||
|
||||
except Exception as e:
|
||||
raise Exception(f"Failed to generate markdown: {e}")
|
||||
@@ -153,9 +167,12 @@ class OllamaGenerator:
|
||||
with open(filename, "w") as f:
|
||||
f.write(self.generate_markdown())
|
||||
|
||||
<<<<<<< HEAD
|
||||
def generate_commit_message(self):
|
||||
prompt_system = "You are a blog creator commiting a piece of content to a central git repo"
|
||||
prompt_human = f"Generate a 5 word git commit message describing {self.response}"
|
||||
messages = [("system", prompt_system), ("human", prompt_human),]
|
||||
commit_message = self.llm.invoke(messages).text()
|
||||
return commit_message
|
||||
=======
|
||||
>>>>>>> e1a24af (get rid of think tags)
|
||||
|
||||
Reference in New Issue
Block a user