TL;DR
I recently made significant changes to the content-automation repository, focusing on improving the Craft API integration and model management. The changes include updating the craft_publisher.py to handle array payloads, migrating to the meta-llama/llama-4-scout-17b-16e-instruct model, and implementing dual endpoint fallback for Craft publisher.
The Problem
The initial problem was that the Craft API was expecting an array in the documents payload, but the current implementation was not providing it. This resulted in errors when trying to create documents in Craft. Additionally, there were issues with the model management, where the llama3-70b-8192 model was being used, but it was decided to migrate to the meta-llama/llama-4-scout-17b-16e-instruct model.
What I Tried First
Initially, I tried to update the craft_publisher.py to handle the array payload, but I encountered issues with the model management. I attempted to use the llama3-70b-8192 model, but it was not working as expected. I then decided to migrate to the meta-llama/llama-4-scout-17b-16e-instruct model, which required changes to the main.py and settings.yml files.
The Implementation
The implementation involved several changes:
Updating craft_publisher.py
def _create_document(
self,
title: str,
content: str,
tags: List[str],
author_id: Optional[int],
) -> Optional[str]:
"""Creates document in Craft. Returns doc ID or None."""
payload = {
"title": title,
"content": content,
"tags": tags,
"author_id": author_id,
}
# Changed to handle array payload
payload = {
"documents": [payload],
}
response = self.client.post(
f"{self.base_url}/entries",
json=payload,
)
if response.status_code == 201:
return response.json()["id"]
return None
Migrating to meta-llama/llama-4-scout-17b-16e-instruct model
# settings.yml
MODEL_SHORTFORM: meta-llama/llama-4-scout-17b-16e-instruct
# main.py
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "meta-llama/llama-4-scout-17b-16e-instruct"
model = AutoModelForCausalLM.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
Implementing dual endpoint fallback for Craft publisher
# craft_publisher.py
def publish(self, content: str):
try:
# Try primary endpoint
response = self.client.post(
f"{self.base_url}/primary-endpoint",
json=content,
)
if response.status_code == 200:
return
except Exception as e:
# Fallback to secondary endpoint
response = self.client.post(
f"{self.base_url}/secondary-endpoint",
json=content,
)
if response.status_code == 200:
return
raise Exception("Failed to publish content")
Key Takeaway
The key takeaway from this experience is the importance of handling array payloads in API requests and the need for proper model management. Additionally, implementing dual endpoint fallback can help improve the reliability of the system.
What's Next
The next step is to continue improving the Craft API integration and model management. This includes monitoring the performance of the meta-llama/llama-4-scout-17b-16e-instruct model and making adjustments as needed. Additionally, I plan to explore other models and techniques to further improve the content generation capabilities.
vibecoding #buildinpublic #AI #Productivity
Part of my Build in Public series β sharing the real process of building SaaS projects from Playa del Carmen, MΓ©xico.
Repo: zaerohell/content-automation Β· 2026-06-24
#playadev #buildinpublic







