Powrót do bloga
AutomationAIBusiness

AI is Not Magic, It's Engineering. How to Squeeze Real Money Out of AI Using Prompt Engineering?

Everyone talks about AI, but few know how to deploy it reliably and profitably. The key is Prompt Engineering. We show you how to create professional prompts that turn AI into a predictable business tool, not a toy.

7 minAutor: Codessa

Podsumuj ten artykuł z AI

Kliknij na wybrany AI, aby otrzymać podsumowanie tego artykułu

AI: Cool Toy, But How Do I Make Money With It?

As a CEO, CTO, or E-commerce Manager, you're probably watching the AI revolution with a mix of excitement and skepticism. You see ChatGPT writing poems and generating images, but you have one question in mind: 'Okay, but how does this actually increase my profit or lower my operational costs?' How do you go from a creative toy to a reliable tool you can plug into your company's processes?

The answer is Prompt Engineering. It's not, as commonly believed, 'the art of asking questions.' In a business context, it's a hard engineering discipline of 'programming' language models using natural language to perform narrow, repetitive, and predictable tasks.

The Difference: ChatGPT Prompt vs. Application API Prompt

This is a fundamental difference. When you ask ChatGPT for a 'product description,' you expect creativity. When your application asks an API (e.g., `gemini-2.5-pro`) for a 'product description,' you expect a predictable structure, like a JSON object, with no introductions, goodbyes, or 'Here is the description you asked for:'. There is no room for confabulation in business.

Anatomy of a Professional Prompt

To make AI a reliable brick in your application, the prompt must be treated like a technical specification. It must contain 5 key elements:

  1. 1. Role (Persona): You command the AI what to be. Instead of 'Write something...', you say: `You are a precise data extraction bot.`
  2. 2. Context & Task: You give it the exact task to perform on the input data. `Analyze the following customer email.`
  3. 3. Strict Constraints: The most important part. These are your `if` conditions. `You MUST reply ONLY in JSON format. Do NOT add any explanations. Do NOT invent information that is not in the text.`
  4. 4. Output Format: You define the exact response structure. `The response MUST be a JSON object matching the schema: {"category": "...", "sentiment": "..."}.`
  5. 5. Examples (Few-Shot Learning): You show it 2-3 examples of how to behave. `EXAMPLE INPUT: '...' EXAMPLE OUTPUT: '{...}'`

Practical AI Applications That Solve Real Problems

Here are four business problems that are hard to program conditionally (`if/else`) but are perfect for an AI solution using prompt engineering.

Application 1: Smart Email Tagging & Routing (Customer Service)

Business Problem: An employee manually reads every email in the support inbox and assigns it to a department (Returns, Complaints, Product Inquiry, Invoices). This is a bottleneck and a waste of time.

AI Solution: An automaton (e.g., in Node.js) connected to the inbox, which passes the content of each new email through an AI for categorization. We use a fast model, like `gemini-2.5-flash-lite`.

text

You are a precise email categorization bot for a customer support system.

TASK: Analyze the following customer email and return a JSON object.

INPUT DATA:
"""
[Paste customer email content here, e.g., "Hello, package 12345 arrived, but the product is broken. I want to return it, how do I do that?"]
"""

CONSTRAINTS:
1.  Your response MUST be exclusively a JSON object. No text before or after.
2.  Sentiment MUST be one of the values: "POSITIVE", "NEUTRAL", "NEGATIVE".
3.  Category MUST be one of the FOLLOWING list: "PRODUCT_INQUIRY", "SHIPPING_INQUIRY", "RETURN", "COMPLAINT", "BILLING", "OTHER".
4.  If the category does not fit any on the list, return "OTHER".

OUTPUT FORMAT:
{
  "category": "string",
  "sentiment": "string"
}

EXAMPLE:
INPUT: "Hi, where is my package 999?"
OUTPUT: {"category": "SHIPPING_INQUIRY", "sentiment": "NEUTRAL"}

Now, process the INPUT DATA.

Handling Unexpected Events (Gotchas):

  • What if the AI returns non-JSON? Your application (your code) MUST wrap the AI's response in a `try...catch(e)` block. If the JSON parsing fails, the email must be flagged for manual review.
  • What if the AI returns a wrong category? We've constrained this by providing an allowed list. This drastically reduces the risk of confabulation. In the worst case, it returns "OTHER", which is still better than an error.
  • What if the email is spam? You can add a "SPAM" category and teach the AI to recognize it.

Application 2: Data Extraction from Invoices or Orders (B2B Automation)

Business Problem: Manually re-typing data from supplier invoices (PDF/email) into an ERP/accounting system. Tedious, expensive, and error-prone.

AI Solution: A script that extracts text from a PDF (e.g., with `pdf-parse`) and then asks an AI to extract *only* the required fields.

text

You are an OCR bot for precise data extraction from invoice text.

TASK: Extract EXACTLY the following fields from the input text.

INPUT DATA:
"""
[Paste raw text from PDF here, e.g., "...Invoice No. FA/123/2025 dated 2025-10-22... Buyer: ... Subtotal: 1200.00, VAT: 276.00, Total: 1476.00... Due Date: 30.10.2025..."]
"""

CONSTRAINTS:
1.  Your response MUST be exclusively a JSON object.
2.  Do NOT invent data. If a field is not present in the text, return `null` for it.
3.  Amounts must be returned as a number (float), using a dot as the decimal separator.
4.  Dates MUST be in YYYY-MM-DD format.

OUTPUT FORMAT:
{
  "invoice_number": "string | null",
  "issue_date": "string | null",
  "due_date": "string | null",
  "total_amount": "number | null"
}

Now, process the INPUT DATA.

Handling Unexpected Events (Gotchas):

  • Key Risk: Amount Hallucination. The AI might misread `1476.00` as `147.60`. This is why your application MUST have validation rules on the code side. E.g., `if (total_amount < 0 || total_amount > 1000000) { flag_for_review; }`.
  • Date Format Risk: The AI might get confused and return `DD.MM.YYYY`. Your application must validate the date format (e.g., with a regex) before saving to the database. If the format is wrong, reject the result.

Application 3: Product Review Moderation (E-commerce)

Business Problem: Manually moderating hundreds of customer reviews. You need to catch profanity, spam (e.g., links to competitors), and personal data (e.g., "Mrs. Anna from support helped me, her number is 123456789").

AI Solution: An automaton that checks every new review and returns a moderation decision.

text

You are a review moderator for an online store. Your task is to evaluate reviews based on the store's policy.

TASK: Analyze the following review and return a JSON object.

REVIEW:
"""
[Review content, e.g., "This product is a failure. I don't recommend it. Your customer service is terrible, especially that bot on your chat. Better to buy at www.competitor.com"]
"""

CONSTRAINTS:
1.  Your response MUST be exclusively a JSON object.
2.  The "decision" field MUST be one of: "APPROVE", "REJECT", "NEEDS_REVIEW".
3.  Return "REJECT" if the review contains profanity or links to other websites.
4.  Return "NEEDS_REVIEW" if the review contains personal data (phone number, email, employee name).
5.  The "reason" field MUST briefly describe the reason for the decision or be `null`.

OUTPUT FORMAT:
{
  "decision": "string",
  "reason": "string | null"
}

EXAMPLE:
INPUT: "Great product, I recommend it! call me at 123-456-789"
OUTPUT: {"decision": "NEEDS_REVIEW", "reason": "Potential personal data detected (phone number)"}

Now, process the REVIEW.

Handling Unexpected Events (Gotchas):

  • Risk: False Positives. The AI might flag innocent words. This is why in your application, a `REJECT` decision should not delete the review, but rather move it to a 'Rejected' folder, giving a manager a chance to review it.
  • Reliability: In this case, 95% automation is good enough. The time saved by auto-approving 95% of valid reviews is worth the manual check of the remaining 5%.

Conclusion: AI is an Employee, and the Prompt is Their Contract

Stop thinking of AI as a magic orb. Start treating it like an employee you're hiring for a very specific task. The prompt is your contract—it must be precise, have a clear deliverable (the JSON format), and define the terms and conditions (the constraints).

The real value of AI in business isn't generating poems, but taking over boring, repetitive tasks based on language analysis. The key to success is not the AI model itself, but the reliable application code that can handle AI errors, validate its response, and flag uncertain results for a human to review. That is the pragmatic and profitable implementation of AI that delivers real savings.

Potrzebujesz pomocy z automatyzacją?

Skontaktuj się z nami! Pomagamy firmom w automatyzacji procesów biznesowych i tworzeniu dedykowanych rozwiązań.

AI to nie magia, to inżynieria. Jak wycisnąć z AI realne pieniądze za pomocą Inżynierii Promptowej? | Codessa Blog