How can I use a document (JSON) to guide AI writing style in my n8n workflow?

Hey ATBV!
There are a couple ways to accomplish this depending on the project outcome you want.

My recommendation (easy, consistent):
In most projects, you want the content to be consistent. So the easiest way to accomplish this is to just reverse engineer the style and content guidelines you want ahead of time, and fine tune your system prompt in your AI nodes.
Just drop a couple of you favorite articles into your AI chat of choice and say “generate a system prompt that would create writing like this”, and then compare those results across the articles you like to tune it.

Idea #2 (still pretty easy, dynamic)
I’ve been using OpenAI mostly but assume you could do the same with other models. You can pass article contents as part of the AI prompt as additional prompts so that if you workflow is passing different articles based on context you can achieve the correct results.
Example:
{
“model”: “gpt-4o-mini”,
“messages”: [
{
“role”: “system”,
“content”: “You are a journalist writing for The New York Times. Maintain analytical, elegant prose consistent with NYT’s editorial style.”
},
{
“role”: “system”,
“content”: “Relevant style reference excerpts: {{input JSON variable}}”
},
{
“role”: “user”,
“content”: “Write an article about tattoos.”
}
],
“temperature”: 0.7,
“max_tokens”: 1200
}

Idea #3 (hard, maybe better results)
If you have a large number of articles you want as context, you could put them in a vector database, and with each query retrieve only the top 3ish documents that are relevant to the query to then insert into the AI node.

Hope this helps.