VOOZH about

URL: https://dev.to/shashank_ms_6a35baa4be138/llms-for-natural-language-generation-m2p

⇱ LLMs for Natural Language Generation - DEV Community


I recently shipped a small internal tool that turns raw product specs into ready-to-publish marketing copy. In this tutorial we will rebuild that generator, wire it to Oxlo.ai, and batch-process a catalog so you never have to write boilerplate descriptions by hand again. Because Oxlo.ai charges per request rather than per token, feeding it long style guides and bulky product briefs does not inflate the bill; see https://oxlo.ai/pricing for current plan details.

What you'll need

1. Configure the client and prepare the catalog

First I point the OpenAI SDK at Oxlo.ai and load a few sample products.

from openai import OpenAI

client = OpenAI(base_url="https://api.oxlo.ai/v1", api_key="YOUR_OXLO_API_KEY")

products = [
 {
 "name": "StellarDB",
 "specs": "Redis-compatible, sub-millisecond latency, auto-sharding, 99.99% SLA"
 },
 {
 "name": "EdgeVision",
 "specs": "ONNX runtime, 4K input, 30 FPS inference on ARM"
 }
]

2. Lock down the generation rules with a system prompt

The system prompt is the contract. It forces three tone variants and bans fluff adjectives.

SYSTEM_PROMPT = """You are a product copywriter.
For every product you receive, write exactly three variants:
1. Professional: formal, suited for enterprise landing pages.
2. Casual: conversational, suited for Twitter or LinkedIn.
3. Technical: dense, spec-heavy, suited for Hacker News launch posts.

Rules:
- Output only the three variants, separated by blank lines.
- No em-dashes. Use commas, periods, or hyphens only.
- Never use the words "revolutionary" or "cutting-edge".
- Keep each variant under 80 words."""

3. Build the generation function

I wrap the API call in a small function so I can swap models later. I use Llama 3.3 70B for consistent instruction following.

from openai import OpenAI

client = OpenAI(base_url="https://api.oxlo.ai/v1", api_key="YOUR_OXLO_API_KEY")

def generate_copy(product_name: str, specs: str) -> str:
 user_message = f"Product: {product_name}\nSpecs: {specs}"
 response = client.chat.completions.create(
 model="llama-3.3-70b",
 messages=[
 {"role": "system", "content": SYSTEM_PROMPT},
 {"role": "user", "content": user_message},
 ],
 )
 return response.choices[0].message.content

4. Batch process the catalog

Finally I loop over the products and print the results. In production I would write these to a CMS, but stdout is enough to verify quality.

if __name__ == "__main__":
 for item in products:
 print(f"=== {item['name']} ===")
 copy = generate_copy(item["name"], item["specs"])
 print(copy)
 print()

Run it

Save the file as generate_copy.py, export your key, and run:

export OXLO_API_KEY="sk-oxlo.ai-..."
python generate_copy.py

You should see output similar to this:

=== StellarDB ===
Professional: StellarDB delivers Redis-compatible caching with sub-millisecond latency and auto-sharding, backed by a 99.99% SLA. It is built for teams that need reliable, scalable performance without operational overhead.

Casual: Need caching that just works? StellarDB is Redis-compatible, stupid fast, and auto-shards so you do not have to babysit nodes. Plus that 99.99% SLA means you can actually sleep through the night.

Technical: Redis-compatible API, sub-ms p99 latency, automatic rebalancing shards, 99.99% uptime SLA. Drop-in replacement for ElastiCache with none of the vendor friction.

=== EdgeVision ===
Professional: EdgeVision brings production-grade computer vision to ARM devices, processing 4K streams at 30 FPS via the ONNX runtime. Ideal for edge deployments where latency and accuracy matter.

Casual: Running vision models on edge hardware usually means compromise. Not here. EdgeVision handles 4K at 30 FPS on ARM using ONNX. Plug it in and go.

Technical: Native ONNX runtime, 4K input support, 30 FPS sustained inference on ARM SoCs. No GPU required, minimal memory footprint, production-ready for edge vision pipelines.

Next steps

Two concrete ways to extend this.

First, add a second pass with deepseek-v3.2 or qwen-3-32b that scores each variant for clarity and picks the winner, giving you a self-improving pipeline without manual review.

Second, switch the output to JSON mode by adding response_format={"type": "json_object"} to the chat completion call, then pipe the structured variants directly into your storefront CMS or marketing automation tool.