27 Commits
Author SHA1 Message Date
armistace e8040e2ba8 unleash client 2025-09-17 09:25:55 +10:00
armistace f2b95935bb Prompt enhancement to produce content
Create Blog Article if new notes exist / prepare_blog_drafts_and_push (push) Successful in 5m14s
2025-06-24 13:05:15 +10:00
armistace bce439921f Generate tags around context
Create Blog Article if new notes exist / prepare_blog_drafts_and_push (push) Successful in 22m46s
2025-06-16 10:35:21 +10:00
armistace 2de2d0fe3a Merge pull request 'prompt enhancement' (#16) from prompt_fix into master
Create Blog Article if new notes exist / prepare_blog_drafts_and_push (push) Successful in 11m44s
Reviewed-on: #16
2025-06-06 12:04:44 +10:00
armistace cf795bbc35 prompt enhancement 2025-06-06 12:04:19 +10:00
armistace a6ed20451a Merge pull request 'pipeline_creation' (#15) from pipeline_creation into master
Create Blog Article if new notes exist / prepare_blog_drafts_and_push (push) Successful in 25m13s
Reviewed-on: #15
2025-06-05 09:22:50 +10:00
armistace 7fd32b3024 improve notification prompt 2025-06-05 09:22:28 +10:00
armistace a88d233c6b remove tail and improve notification prompt 2025-06-05 09:22:19 +10:00
armistace 2abc39e3ac Merge pull request 'pipeline_creation' (#14) from pipeline_creation into master
Create Blog Article if new notes exist / prepare_blog_drafts_and_push (push) Successful in 30m33s
Reviewed-on: #14
2025-06-05 08:43:23 +10:00
armistace f430998137 typo 2025-06-05 08:42:45 +10:00
armistace 8dceb79d91 remove repo reference 2025-06-05 08:41:32 +10:00
armistace 6c5b0f778d remove trailing slash 2025-06-05 08:41:32 +10:00
armistace 37ed8fd0f9 fix git for pipeline" 2025-06-05 08:40:59 +10:00
armistace 0594ea54aa remove repo reference
Create Blog Article if new notes exist / prepare_blog_drafts_and_push (push) Failing after 27m5s
2025-06-05 01:02:42 +10:00
armistace 60f7473297 remove trailing slash
Create Blog Article if new notes exist / prepare_blog_drafts_and_push (push) Has been cancelled
2025-06-05 01:00:58 +10:00
armistace ec69e8e4f7 Merge pull request 'do it right' (#13) from pipeline_creation into master
Create Blog Article if new notes exist / prepare_blog_drafts_and_push (push) Failing after 8m58s
Reviewed-on: #13
2025-06-05 00:47:05 +10:00
armistace 62b1175aeb do it right 2025-06-05 00:46:45 +10:00
armistace 41f804a1eb Merge pull request 'pipeline_creation' (#12) from pipeline_creation into master
Create Blog Article if new notes exist / prepare_blog_drafts_and_push (push) Has been cancelled
Reviewed-on: #12
2025-06-05 00:45:53 +10:00
armistace f50d076164 cleanup 2025-06-05 00:45:39 +10:00
armistace fc4f9c5053 dealing with pipeline weirdness 2025-06-05 00:44:57 +10:00
armistace e3262cd366 Merge pull request 'weird trailing newline"' (#11) from pipeline_creation into master
Create Blog Article if new notes exist / prepare_blog_drafts_and_push (push) Failing after 10m26s
Reviewed-on: #11
2025-06-05 00:12:04 +10:00
armistace 341f3d8623 weird trailing newline"
"
2025-06-05 00:11:44 +10:00
armistace e2c29204fa Merge pull request 'pipeline_creation' (#10) from pipeline_creation into master
Create Blog Article if new notes exist / prepare_blog_drafts_and_push (push) Has been cancelled
Reviewed-on: #10
2025-06-04 23:48:10 +10:00
armistace f0e6a0cb52 load_dotenv work different? 2025-06-04 23:47:53 +10:00
armistace 7f0b0376d1 load_dotenv work different? 2025-06-04 23:47:05 +10:00
armistace 44b5ea6a68 Merge pull request 'load_dotenv work different?' (#9) from pipeline_creation into master
Create Blog Article if new notes exist / prepare_blog_drafts_and_push (push) Failing after 9m17s
Reviewed-on: #9
2025-06-04 22:55:26 +10:00
armistace a49457094d load_dotenv work different? 2025-06-04 22:54:09 +10:00
5 changed files with 48 additions and 23 deletions
+19 -16
View File
@@ -21,30 +21,33 @@ jobs:
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
git config --global user.name "Blog Creator"
git config --global user.email "ridgway.infrastructure@gmail.com"
git config --global push.autoSetupRemote true
- name: Create .env
shell: bash
run: |
echo "TRILIUM_HOST=${{ vars.TRILIUM_HOST }}" > .env
echo "TRILIUM_PORT=${{ vars.TRILIUM_PORT }}" >> .env
echo "TRILIUM_PROTOCOL=${{ vars.TRILIUM_PROTOCOL }}" >> .env
echo "TRILIUM_PASS=${{ secrets.TRILIUM_PASS }}" >> .env
echo "TRILIUM_TOKEN=${{ secrets.TRILIUM_TOKEN }}" >> .env
echo "OLLAMA_PROTOCOL=${{ vars.OLLAMA_PROTOCOL }}" >> .env
echo "OLLAMA_HOST=${{ vars.OLLAMA_HOST }}" >> .env
echo "OLLAMA_PORT=${{ vars.OLLAMA_PORT }}" >> .env
echo "EMBEDDING_MODEL=${{ vars.EMBEDDING_MODEL }}" >> .env
echo "EDITOR_MODEL=${{ vars.EDITOR_MODEL }}" >> .env
echo "CONTENT_CREATOR_MODELS='${{ vars.CONTENT_CREATOR_MODELS }}'" >> .env
echo "GIT_PROTOCOL=${{ vars.GIT_PROTOCOL }}" >> .env
echo "GIT_REMOTE=${{ vars.GIT_REMOTE }}" >> .env
echo "GIT_USER=${{ vars.GIT_USER }}" >> .env
echo "TRILIUM_PORT='${{ vars.TRILIUM_PORT }}'" >> .env
echo "TRILIUM_PROTOCOL='${{ vars.TRILIUM_PROTOCOL }}'" >> .env
echo "TRILIUM_PASS='${{ secrets.TRILIUM_PASS }}'" >> .env
echo "TRILIUM_TOKEN='${{ secrets.TRILIUM_TOKEN }}'" >> .env
echo "OLLAMA_PROTOCOL='${{ vars.OLLAMA_PROTOCOL }}'" >> .env
echo "OLLAMA_HOST='${{ vars.OLLAMA_HOST }}'" >> .env
echo "OLLAMA_PORT='${{ vars.OLLAMA_PORT }}'" >> .env
echo "EMBEDDING_MODEL='${{ vars.EMBEDDING_MODEL }}'" >> .env
echo "EDITOR_MODEL='${{ vars.EDITOR_MODEL }}'" >> .env
export PURE='["${{ vars.CONTENT_CREATOR_MODELS_1 }}", "${{ vars.CONTENT_CREATOR_MODELS_2 }}", "${{ vars.CONTENT_CREATOR_MODELS_3 }}", "${{ vars.CONTENT_CREATOR_MODELS_4 }}"]'
echo "CONTENT_CREATOR_MODELS='$PURE'" >> .env
echo "GIT_PROTOCOL='${{ vars.GIT_PROTOCOL }}'" >> .env
echo "GIT_REMOTE='${{ vars.GIT_REMOTE }}'" >> .env
echo "GIT_USER='${{ vars.GIT_USER }}'" >> .env
echo "GIT_PASS='${{ secrets.GIT_PASS }}'" >> .env
echo "N8N_SECRET='${{ secrets.N8N_SECRET }}'" >> .env
echo "N8N_WEBHOOK_URL='${{ vars.N8N_WEBHOOK_URL }}'" >> .env
echo "CHROMA_HOST=${{ vars.CHROMA_HOST }}" >> .env
echo "CHROMA_PORT=${{ vars.CHROMA_PORT }}" >> .env
tail .env -n 100
echo "CHROMA_HOST='${{ vars.CHROMA_HOST }}'" >> .env
echo "CHROMA_PORT='${{ vars.CHROMA_PORT }}'" >> .env
- name: Create Blogs
shell: bash
+1
View File
@@ -6,3 +6,4 @@ chromadb
langchain-ollama
PyJWT
dotenv
UnleashClient
+10 -4
View File
@@ -11,6 +11,8 @@ class OllamaGenerator:
self.inner_title = inner_title
self.content = content
self.response = None
print("In Class")
print(os.environ["CONTENT_CREATOR_MODELS"])
try:
chroma_port = int(os.environ['CHROMA_PORT'])
except ValueError as e:
@@ -31,7 +33,7 @@ class OllamaGenerator:
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}
<blog>{self.content}</blog>
"""
def split_into_chunks(self, text, chunk_size=100):
@@ -123,11 +125,13 @@ class OllamaGenerator:
writing a 3000 word blog article. You like when they use almost no code examples.
You are also Australian. The content may have light comedic elements,
you are more professional and will attempt to tone these down
As this person produce and an amalgamtion of this blog as a markdown document.
As this person produce the final version of this blog as a markdown document
keeping in mind the context provided by the previous drafts.
You are to produce the content not placeholders for further editors
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}
<blog>{self.content}</blog>
"""
try:
query_embed = self.ollama_client.embed(model=self.embed_model, input=prompt_system)['embeddings']
@@ -136,7 +140,9 @@ class OllamaGenerator:
print("Showing pertinent info from drafts used in final edited edition")
pertinent_draft_info = '\n\n'.join(collection.query(query_embeddings=query_embed, n_results=100)['documents'][0])
#print(pertinent_draft_info)
prompt_human = f"Generate the final document using this information from the drafts: {pertinent_draft_info} - Only output in markdown, do not wrap in markdown tags"
prompt_human = f"""Generate the final, 3000 word, draft of the blog using this information from the drafts: <context>{pertinent_draft_info}</context>
- Only output in markdown, do not wrap in markdown tags, Only provide the draft not a commentary on the drafts in the context
"""
print("Generating final document")
messages = [("system", prompt_system), ("human", prompt_human),]
self.response = self.llm.invoke(messages).text()
+5 -3
View File
@@ -6,6 +6,7 @@ import string,os
from datetime import datetime
from dotenv import load_dotenv
load_dotenv()
print(os.environ["CONTENT_CREATOR_MODELS"])
tril = tn.TrilumNotes()
@@ -29,7 +30,7 @@ for note in tril_notes:
ai_gen = omg.OllamaGenerator(os_friendly_title,
tril_notes[note]['content'],
tril_notes[note]['title'])
blog_path = f"/blog_creator/generated_files/{os_friendly_title}.md"
blog_path = f"generated_files/{os_friendly_title}.md"
ai_gen.save_to_file(blog_path)
@@ -49,9 +50,10 @@ for note in tril_notes:
git_branch_url = f'https://git.aridgwayweb.com/armistace/blog/src/branch/{os_friendly_title}/src/content/{os_friendly_title}.md'
n8n_system_prompt = f"You are a blog creator notifiying the final editor of the final creation of blog available at {git_branch_url}"
n8n_prompt_human = f"""
Generate an informal 150 word
Generate an informal 100 word
summary describing {ai_gen.response}.
Don't address it or use names. ONLY OUTPUT THE RESPONSE
Don't address it or use names. ONLY OUTPUT THE RESPONSE.
ONLY OUTPUT IN PLAINTEXT STRIP ALL MARKDOWN
"""
notification_message = ai_gen.generate_system_message(n8n_system_prompt, n8n_prompt_human)
secret_key = os.environ['N8N_SECRET']
+13
View File
@@ -0,0 +1,13 @@
from UnleashClient import UnleashClient
import asyncio
client = UnleashClient(
url="http://192.168.178.160:30007/api/",
app_name="unleash-onboarding-python",
custom_headers={'Authorization': 'default:development.6uQIie4GdslTxgYAWVu35sRBjjBMPRRKw6vBj6mFsgFfvdXuy73GgLQg'}) # in production use environment variable
client.initialize_client()
while True:
print(client.is_enabled("crew_ai_integration"))
asyncio.run(asyncio.sleep(1))