Neural Sync Active
Prompt Engineering
Registry Synced
Prompt Engineering
71 words
1 min read
Prompt Engineering
Techniques
| Technique | Description | Example |
|---|---|---|
| Zero-shot | No examples, just instruction | "Classify this review as positive or negative" |
| Few-shot | Provide 2-5 examples | Show 3 examples before asking |
| Chain-of-thought | Step-by-step reasoning | "Let's think step by step" |
| Role prompting | Assign persona | "You are an expert mathematician" |
python# Example using OpenAI API import openai response = openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=[ {"role": "system", "content": "You are a helpful tutor."}, {"role": "user", "content": "Explain gradient descent."} ] ) print(response.choices[0].message.content)