getting gemma3 in the mix

This commit is contained in:
=
2025-03-17 16:33:16 +10:00
parent c80f692cb0
commit e57d6eb6b6
4 changed files with 65 additions and 17 deletions
+7 -12
View File
@@ -5,23 +5,23 @@ import chromadb, time
class OllamaGenerator:
def __init__(self, title: str, content: str, model: str):
def __init__(self, title: str, content: str, model: str, inner_title: str):
self.title = title
self.inner_title = inner_title
self.content = content
self.chroma = chromadb.HttpClient(host="172.18.0.2", port=8000)
ollama_url = f"{os.environ["OLLAMA_PROTOCOL"]}://{os.environ["OLLAMA_HOST"]}:{os.environ["OLLAMA_PORT"]}"
self.ollama_client = Client(host=ollama_url)
self.ollama_model = model
self.embed_model = "snowflake-arctic-embed2:latest"
self.agent_models = ["openthinker:7b", "deepseek-r1:7b", "qwen2.5:7b", "deepseek-coder-v2:16b"]
self.agent_models = ["openthinker:7b", "deepseek-r1:7b", "qwen2.5:7b", "gemma3:latest"]
self.prompt_inject = f"""
You are a journalist Software Developer and DevOps expert
who has transistioned in Developer Relations
You are a journalist, Software Developer and DevOps expert
writing a 1000 word draft blog for other tech enthusiasts.
You like to use almost no code examples and prefer to talk
in a light comedic tone. You are also Australian
As this person write this blog as a markdown document.
The title for the blog is {self.title}.
The title for the blog is {self.inner_title}.
Do not output the title in the markdown.
The basis for the content of the blog is:
{self.content}
@@ -95,13 +95,12 @@ class OllamaGenerator:
prompt = f"""
You are an editor taking information from {len(self.agent_models)} Software
Developers and Data experts
who have transistioned into Developer Relations
writing a 3000 word blog for other tech enthusiasts.
You like when they use almost no code examples and the
voice is in a light comedic tone. You are also Australian
As this person produce and an amalgamtion of this blog as a markdown document.
The title for the blog is {self.title}.
Do not output the title in the markdown.
The title for the blog is {self.inner_title}.
Do not output the title in the markdown. Avoid repeated sentences
The basis for the content of the blog is:
{self.content}
"""
@@ -110,10 +109,6 @@ class OllamaGenerator:
collection = self.load_to_vector_db()
collection_query = collection.query(query_embeddings=query_embed, n_results=100)
print("Showing pertinent info from drafts used in final edited edition")
for document in collection_query:
print (document['ids'])
print (document['embeddings'])
print (document['documents'])
pertinent_draft_info = '\n\n'.join(collection.query(query_embeddings=query_embed, n_results=100)['documents'][0])
prompt_enhanced = f"{prompt} - Generate the final document using this information from the drafts: {pertinent_draft_info} - ONLY OUTPUT THE MARKDOWN"
print("Generating final document")