Typhoon Logo
TyphoonPrompt Optimizer

Prompt Engineering Guidelines

The Art of Prompt Engineering for Typhoon: A Comprehensive Guide

Prompt engineering is both an art and a science. When working with Typhoon, our Thai large language model, the right prompting techniques can dramatically improve the quality of outputs. This guide will walk you through essential strategies, with practical examples to help you get the most out of Typhoon.

1. Be Clear and Concise

Your prompt should be easy to understand while providing sufficient context for the model to generate relevant output. Avoid unnecessary jargon or overly technical terms.

Example:

"Elucidate the variegated methodologies inherent in sustainable agricultural practices in Thailand's northeastern region."
"Explain the different sustainable farming methods used in northeastern Thailand."

2. Use Specific Examples

Providing concrete examples helps the model understand your expectations better.

Example:

"Write a Thai folk tale."
"Write a Thai folk tale about a clever rabbit who outsmarts a crocodile to cross a river. Include elements of traditional Thai storytelling such as moral lessons and natural settings."

3. Vary Your Prompts for Creative Responses

Different approaches to prompting can yield more diverse and creative outputs.

Example:

Prompt 1: "Write a poem about Bangkok in the rainy season."
Prompt 2: "Imagine you're a street vendor in Bangkok during monsoon season. Describe what you see, hear, and feel."
Prompt 3: "āļāļ™āļ•āļāđƒāļ™āļāļĢāļļāļ‡āđ€āļ—āļžāļŊ āļ—āļģāđƒāļŦāđ‰āļ„āļļāļ“āļĢāļđāđ‰āļŠāļķāļāļ­āļĒāđˆāļēāļ‡āđ„āļĢ? āđ€āļ‚āļĩāļĒāļ™āļšāļ—āļāļ§āļĩāļŠāļąāđ‰āļ™āđ† āđ€āļāļĩāđˆāļĒāļ§āļāļąāļšāļ„āļ§āļēāļĄāļĢāļđāđ‰āļŠāļķāļāļ™āļĩāđ‰"

4. Try and Refine

Start with a simple prompt, then iteratively add constraints or information to get closer to your desired result.

Example:

Initial prompt: "Summarize Thailand's economic outlook."
Refined prompt: "Summarize Thailand's economic outlook for 2025, focusing on tourism recovery and technology sectors."
Further refined: "Summarize Thailand's economic outlook for 2025, focusing on tourism recovery and technology sectors. Include key statistics and present in 5 bullet points."

5. Avoid Overly Complex Prompts

Complexity can reduce model performance rather than improve it.

Example:

"Analyze the multifaceted interplay between Thailand's political landscape, economic determinants, sociocultural factors, and geographical considerations to synthesize a comprehensive evaluation of potential investment opportunities in the eastern economic corridor while factoring in historical precedents, regulatory frameworks, and future projections according to various economic models."
"What are the main investment opportunities in Thailand's eastern economic corridor? Consider political, economic, and regulatory factors."

6. Structure Examples Wisely

Add one or two examples when the model isn't following your instructions, but don't overdo it.

Example:

"Translate the following English sentences to formal Thai.

Example:
English: I would like to schedule a meeting with you next week.
Thai: āļœāļĄāļ‚āļ­āļ™āļąāļ”āļ›āļĢāļ°āļŠāļļāļĄāļāļąāļšāļ„āļļāļ“āđƒāļ™āļŠāļąāļ›āļ”āļēāļŦāđŒāļŦāļ™āđ‰āļē

Now translate: The committee has decided to postpone the event until further notice."

7. Use English for Instructions, Thai for Content

Prompt in English, but include documents or user questions in Thai for better model understanding.

Example:

"Summarize the main points of this Thai news article:

[āļ‚āđˆāļēāļ§āđ€āļĻāļĢāļĐāļāļāļīāļˆāđ„āļ—āļĒ: āļ˜āļ™āļēāļ„āļēāļĢāđāļŦāđˆāļ‡āļ›āļĢāļ°āđ€āļ—āļĻāđ„āļ—āļĒāļ›āļĢāļ°āļāļēāļĻāļĄāļēāļ•āļĢāļāļēāļĢāđƒāļŦāļĄāđˆāđ€āļžāļ·āđˆāļ­āļāļĢāļ°āļ•āļļāđ‰āļ™āđ€āļĻāļĢāļĐāļāļāļīāļˆ...]"

8. Choose Language Based on Priority

If natural Thai language is more important than precise instruction following, prompt in Thai.

Example:

"Write a casual conversation between two Thai teenagers discussing their favorite music."
"āđ€āļ‚āļĩāļĒāļ™āļšāļ—āļŠāļ™āļ—āļ™āļēāļĢāļ°āļŦāļ§āđˆāļēāļ‡āļ§āļąāļĒāļĢāļļāđˆāļ™āđ„āļ—āļĒāļŠāļ­āļ‡āļ„āļ™āļ—āļĩāđˆāļāļģāļĨāļąāļ‡āļ„āļļāļĒāļāļąāļ™āđ€āļĢāļ·āđˆāļ­āļ‡āđ€āļžāļĨāļ‡āļ—āļĩāđˆāļŠāļ­āļš āđƒāļŠāđ‰āļ āļēāļĐāļēāļ§āļąāļĒāļĢāļļāđˆāļ™āļ—āļĩāđˆāđ€āļ›āđ‡āļ™āļ˜āļĢāļĢāļĄāļŠāļēāļ•āļī"

9. Limit Few-Shot Examples

Modern LLMs often perform better with clear instructions than with many examples. If needed, use no more than 5 few-shot examples.

Example:

"Classify these Thai restaurant reviews as positive, negative, or neutral.

Example 1:
Review: āļ­āļēāļŦāļēāļĢāļ­āļĢāđˆāļ­āļĒāļĄāļēāļ āļšāļĢāļīāļāļēāļĢāđ€āļĒāļĩāđˆāļĒāļĄ
Classification: Positive

Example 2:
Review: āļĢāļŠāļŠāļēāļ•āļīāļžāļ­āđƒāļŠāđ‰āđ„āļ”āđ‰ āđāļ•āđˆāļĢāļēāļ„āļēāđāļžāļ‡āđ„āļ›āļŦāļ™āđˆāļ­āļĒ
Classification: Neutral

Now classify: āļĢāļ­āļ™āļēāļ™āļĄāļēāļ āļ­āļēāļŦāļēāļĢāļāđ‡āđ„āļĄāđˆāļ­āļĢāđˆāļ­āļĒ āđ„āļĄāđˆāđāļ™āļ°āļ™āļģāđ€āļĨāļĒ"

10. Be Direct About Outputs

If you only want JSON, say so explicitly. This prevents the model from showing its reasoning process.

Example:

"Convert this Thai restaurant information to JSON format. Return ONLY valid JSON without any explanations or additional text:

āļŠāļ·āđˆāļ­āļĢāđ‰āļēāļ™: āļšāđ‰āļēāļ™āļŠāļ§āļ™
āļ—āļĩāđˆāļ­āļĒāļđāđˆ: āļŠāļļāļ‚āļļāļĄāļ§āļīāļ— 55
āđ€āļ§āļĨāļēāđ€āļ›āļīāļ”: 11:00 - 22:00
āļ›āļĢāļ°āđ€āļ āļ—āļ­āļēāļŦāļēāļĢ: āļ­āļēāļŦāļēāļĢāđ„āļ—āļĒ, āļ­āļēāļŦāļēāļĢāļ­āļĩāļŠāļēāļ™"

11. Use Code for Outputs Extraction

It's often easier to extract model outputs with code than to perfect your prompt.

Example:

const extractCodeBlock = (text) => {
  // Regular expression to match code blocks with their fences
  const codeBlockRegex = /```(?:[a-zA-Z0-9]+)?([sS]*?)```/gm;
  
  // Array to store all extracted code blocks
  const extractedBlocks = [];
  
  // Find all code blocks and extract their content
  let match;
  while ((match = codeBlockRegex.exec(text)) !== null) {
    // match[1] contains the content between the code fences
    extractedBlocks.push(match[1].trim());
  }
  
  // Return all extracted code blocks
  return extractedBlocks;
}

12. Use Reasoning Models for Complex Tasks

When your task requires multiple-step thinking or editing, use a reasoning-focused model.

Example:

"I need to create a comprehensive marketing strategy for a new Thai street food chain targeting tourists and locals. Please think step by step about market research, positioning, pricing, promotion channels, and cultural considerations."

13. Implement Feedback Loops

Many issues can be solved through iterative feedback and refinement.

Example:

Initial process: Input → LLM → Output
Refined process: JSON.parse(output) → error → LLM → Refined output

"Your previous response had a JSON parsing error. Please fix the following issue and return only valid JSON: Missing comma after the 'name' field."

14. Break Down Complex Tasks

For challenging tasks, use a divide-and-conquer approach.

Example: Instead of:

"Please create a presentation from this market research data." [large text dump]

Try:

Step 1: "Please identify the 5 key insights from this market research data." [data]
Step 2: "For insight #1, create a slide with a compelling headline, 3 supporting points, and a visualization suggestion."
Step 3: "Organize these 5 slides into a coherent narrative that flows logically."

15. Use Explicit Instructions

Be specific about style, format, and restrictions.

Example for Stylization:

"Explain blockchain technology in language a 5-year-old Thai child would understand."

Example for Formatting:

"Answer this question about Thai history and provide citations as numbers [1], [2], etc. Include the full references at the end of your response."

Example for Restrictions:

"Answer this healthcare question based only on information in the attached documents. If the documents don't contain relevant information, politely decline to answer."

16. Leverage External Data Sources

Use RAG (Retrieval-Augmented Generation) or web search capabilities to reduce hallucinations.

Example:

"Using the attached Thai medical guidelines, answer the following question about diabetes treatment protocols. Only include information that is explicitly mentioned in the documents."

By applying these techniques, you'll be able to craft more effective prompts for Typhoon and achieve better results for your specific use cases. Remember that prompt engineering is iterative – don't be afraid to experiment and refine your approach based on the outputs you receive.