Hook (1-2 sentences): You've got a Postman collection full of API endpoints, but translating each one into a consistently-styled Python function is tedious, error-prone, and — frankly — beneath you. Here's how to use a structured AI prompt, Python dataclasses, and your own code samples to auto-generate an entire function library in one shot.
Why It Matters (2-4 sentences): Without this, every new API endpoint means another handwritten function — and if you're the only one on your team who writes in snake_case, uses a specific auth object pattern, or knows to call client.get_data_sync instead of raw requests, that knowledge doesn't transfer. LLMs don't know your codebase, your conventions, or your API's quirks unless you teach them. By embedding your own code samples directly into the prompt, you turn a general-purpose LLM into a function-writing assistant that mimics your exact style — reliably, at scale.
What You'll Learn
- Understand why "just ask ChatGPT" fails for proprietary APIs and how pattern-injection fixes it
- Structure a Postman collection so it can be parsed and passed to an LLM prompt
- Build a Python dataclass schema to represent API endpoint metadata cleanly
- Craft a prompt that teaches an LLM your coding conventions (naming, auth patterns, parameter style)
- Generate a full library of typed, consistently-styled Python functions from a collection in one pass
Teaching an LLM to Write Like You
The core insight here isn't about AI — it's about prompting as a pattern-teaching exercise. An LLM doesn't know how to write Domo API functions. It knows how to guess the next word given enough context. So the job is giving it the right context: your existing functions, your snake_case naming rules, your O auth object, your client.get_data_sync call signature.
The workflow starts with a Postman collection — a structured JSON export of every API endpoint you care about. A Python parser reads each request's method, URL, headers, and body parameters, then maps them into a dataclass. That dataclass becomes the structured input to your LLM prompt, giving it a clean, consistent representation of each endpoint rather than raw Postman JSON.
The prompt itself does the heavy lifting of style transfer. You include two or three of your own existing functions as examples — not to explain what the code does, but to demonstrate how it's written. From that, the model learns to emit snake_case identifiers, thread the O auth object through, and match your docstring format without being told explicitly each time.
The payoff is that adding a new Domo API endpoint to your library goes from a 20-minute copy-paste-adjust task to a one-click generation. And because the output is anchored to real Postman documentation rather than the LLM's hallucinated assumptions about the API, the functions are actually correct — not just plausible-looking.
This pattern generalizes well: any team with a Postman collection, a house style, and a repeatable function structure can apply the same approach to bootstrap or extend their API client layer without writing boilerplate by hand.



