DEV Community

Roberto Luna
Roberto Luna

Posted on

TL;DR

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, decommissioning old models, and integrating the meta-llama/llama-4-scout-17b-16e-instruct model.

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, including the use of deprecated models like llama3-70b-8192.

What I Tried First

My first approach was to update the craft_publisher.py to handle the array payload. I modified the _create_document function to include the documents key in the payload:

def _create_document(
    self,
    title: str,
    content: str,
    tags: Optional[List[str]] = None,
) -> Optional[str]:
    """Creates document in Craft. Returns doc ID or None."""
    payload = {
        "title": title,
        "content": content,
        "tags": tags,
    }
    # ...
Enter fullscreen mode Exit fullscreen mode

However, this change alone did not resolve the issue, as the payload was not being formatted correctly.

The Implementation

To fix the issue, I updated the craft_publisher.py to correctly format the payload:

def _create_document(
    self,
    title: str,
    content: str,
    tags: Optional[List[str]] = None,
) -> Optional[str]:
    """Creates document in Craft. Returns doc ID or None."""
    payload = {
        "documents": [
            {
                "title": title,
                "content": content,
                "tags": tags,
            }
        ]
    }
    response = self.client.post(
        f"{self.base_url}/entries",
        json=payload,
    )
    # ...
Enter fullscreen mode Exit fullscreen mode

I also decommissioned old models, including llama3-70b-8192, and integrated the meta-llama/llama-4-scout-17b-16e-instruct model. This involved updating the main.py and settings.yml files:

# settings.yml
models:
  - meta-llama/llama-4-scout-17b-16e-instruct
Enter fullscreen mode Exit fullscreen mode
# main.py
from settings import models

def generate_content(model_id):
    # ...
    model = models[0]
    # ...
Enter fullscreen mode Exit fullscreen mode

Key Takeaway

The key takeaway from this experience is the importance of correctly formatting payloads when working with APIs. In this case, the Craft API required an array in the documents payload, which was not initially provided. By updating the craft_publisher.py to handle this requirement, I was able to resolve the issue and improve the overall integration.

What's Next

Next, I plan to focus on improving the model management and adding more features to the content-automation repository. This includes exploring the use of other models and integrating additional APIs.

Tags

vibecoding #buildinpublic #AI #Productivity #CraftAPI #ModelManagement


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

Top comments (0)