Compare commits
17
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8040e2ba8
|
||
|
|
f2b95935bb | ||
|
|
bce439921f | ||
|
|
2de2d0fe3a | ||
|
|
cf795bbc35 | ||
|
|
a6ed20451a | ||
|
|
7fd32b3024 | ||
|
|
a88d233c6b | ||
|
|
2abc39e3ac | ||
|
|
f430998137 | ||
|
|
8dceb79d91 | ||
|
|
6c5b0f778d | ||
|
|
37ed8fd0f9 | ||
|
|
0594ea54aa | ||
|
|
60f7473297 | ||
|
|
ec69e8e4f7 | ||
|
|
62b1175aeb |
@@ -21,6 +21,9 @@ jobs:
|
|||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip install -r requirements.txt
|
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
|
- name: Create .env
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -35,7 +38,7 @@ jobs:
|
|||||||
echo "OLLAMA_PORT='${{ vars.OLLAMA_PORT }}'" >> .env
|
echo "OLLAMA_PORT='${{ vars.OLLAMA_PORT }}'" >> .env
|
||||||
echo "EMBEDDING_MODEL='${{ vars.EMBEDDING_MODEL }}'" >> .env
|
echo "EMBEDDING_MODEL='${{ vars.EMBEDDING_MODEL }}'" >> .env
|
||||||
echo "EDITOR_MODEL='${{ vars.EDITOR_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 }}"]
|
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 "CONTENT_CREATOR_MODELS='$PURE'" >> .env
|
||||||
echo "GIT_PROTOCOL='${{ vars.GIT_PROTOCOL }}'" >> .env
|
echo "GIT_PROTOCOL='${{ vars.GIT_PROTOCOL }}'" >> .env
|
||||||
echo "GIT_REMOTE='${{ vars.GIT_REMOTE }}'" >> .env
|
echo "GIT_REMOTE='${{ vars.GIT_REMOTE }}'" >> .env
|
||||||
@@ -45,7 +48,6 @@ jobs:
|
|||||||
echo "N8N_WEBHOOK_URL='${{ vars.N8N_WEBHOOK_URL }}'" >> .env
|
echo "N8N_WEBHOOK_URL='${{ vars.N8N_WEBHOOK_URL }}'" >> .env
|
||||||
echo "CHROMA_HOST='${{ vars.CHROMA_HOST }}'" >> .env
|
echo "CHROMA_HOST='${{ vars.CHROMA_HOST }}'" >> .env
|
||||||
echo "CHROMA_PORT='${{ vars.CHROMA_PORT }}'" >> .env
|
echo "CHROMA_PORT='${{ vars.CHROMA_PORT }}'" >> .env
|
||||||
tail .env -n 100
|
|
||||||
|
|
||||||
- name: Create Blogs
|
- name: Create Blogs
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
@@ -6,3 +6,4 @@ chromadb
|
|||||||
langchain-ollama
|
langchain-ollama
|
||||||
PyJWT
|
PyJWT
|
||||||
dotenv
|
dotenv
|
||||||
|
UnleashClient
|
||||||
@@ -33,7 +33,7 @@ class OllamaGenerator:
|
|||||||
The title for the blog is {self.inner_title}.
|
The title for the blog is {self.inner_title}.
|
||||||
Do not output the title in the markdown.
|
Do not output the title in the markdown.
|
||||||
The basis for the content of the blog is:
|
The basis for the content of the blog is:
|
||||||
{self.content}
|
<blog>{self.content}</blog>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def split_into_chunks(self, text, chunk_size=100):
|
def split_into_chunks(self, text, chunk_size=100):
|
||||||
@@ -125,11 +125,13 @@ class OllamaGenerator:
|
|||||||
writing a 3000 word blog article. You like when they use almost no code examples.
|
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 also Australian. The content may have light comedic elements,
|
||||||
you are more professional and will attempt to tone these down
|
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}.
|
The title for the blog is {self.inner_title}.
|
||||||
Do not output the title in the markdown. Avoid repeated sentences
|
Do not output the title in the markdown. Avoid repeated sentences
|
||||||
The basis for the content of the blog is:
|
The basis for the content of the blog is:
|
||||||
{self.content}
|
<blog>{self.content}</blog>
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
query_embed = self.ollama_client.embed(model=self.embed_model, input=prompt_system)['embeddings']
|
query_embed = self.ollama_client.embed(model=self.embed_model, input=prompt_system)['embeddings']
|
||||||
@@ -138,7 +140,9 @@ class OllamaGenerator:
|
|||||||
print("Showing pertinent info from drafts used in final edited edition")
|
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])
|
pertinent_draft_info = '\n\n'.join(collection.query(query_embeddings=query_embed, n_results=100)['documents'][0])
|
||||||
#print(pertinent_draft_info)
|
#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")
|
print("Generating final document")
|
||||||
messages = [("system", prompt_system), ("human", prompt_human),]
|
messages = [("system", prompt_system), ("human", prompt_human),]
|
||||||
self.response = self.llm.invoke(messages).text()
|
self.response = self.llm.invoke(messages).text()
|
||||||
|
|||||||
+4
-3
@@ -30,7 +30,7 @@ for note in tril_notes:
|
|||||||
ai_gen = omg.OllamaGenerator(os_friendly_title,
|
ai_gen = omg.OllamaGenerator(os_friendly_title,
|
||||||
tril_notes[note]['content'],
|
tril_notes[note]['content'],
|
||||||
tril_notes[note]['title'])
|
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)
|
ai_gen.save_to_file(blog_path)
|
||||||
|
|
||||||
|
|
||||||
@@ -50,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'
|
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_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"""
|
n8n_prompt_human = f"""
|
||||||
Generate an informal 150 word
|
Generate an informal 100 word
|
||||||
summary describing {ai_gen.response}.
|
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)
|
notification_message = ai_gen.generate_system_message(n8n_system_prompt, n8n_prompt_human)
|
||||||
secret_key = os.environ['N8N_SECRET']
|
secret_key = os.environ['N8N_SECRET']
|
||||||
|
|||||||
@@ -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))
|
||||||
Reference in New Issue
Block a user