Zero Shot Prompting
Why is it called ZERO SHOT Prompting? what does it mean and why do you need this format of prompts?
The code that I used in the Video:
############ Code Begins ###################################
import os
from openai import OpenAI
# Set your OpenAI API key (replace with your OpenAI Key)
os.environ["OPENAI_API_KEY"] = "sk-proj-1ZVz0vihj231JASXks0qT3BlbkFJmvmIDwd8Y1wjWt1Wge7V"
# Initialize OpenAI_Client
OpenAI_Client = OpenAI()
def ask_GPT_model(prompt: str):
"""Send a prompt to the GPT model and return the response."""
response = OpenAI_Client.chat.completions.create(
model="gpt-4o-mini", # or "gpt-4", "gpt-3.5-turbo"
messages=[{"role": "user", "content": prompt}],
temperature=0 # make it deterministic
)
return response.choices[0].message.content
############ Zero shot Prompt example-1 ############
zero_shot_prompt = '''Classify the sentiment of this review:
'The movie was amazing and full of surprises.' '''
print("Zero-shot response:")
print(ask_GPT_model(zero_shot_prompt))
############ Zero shot Prompt example-2 ############
zero_shot_prompt = '''
Extract phone numbers from this text:
'hello you can reach out to me at +91 9934256773' '''
print("Zero-shot response:")
print(ask_GPT_model(zero_shot_prompt))
############ Code Ends ###################################
In this series of shorts I am covering the absolute basics you must know before attending a GenAI interview. Subscribe the ThinkingNeuron channel for more such videos!
#zeroshot #prompt #promptengineering #ai #largelanguagemodels #genai #viralshorts #interview #techtips
Music from #Uppbeat (free for Creators!):
https://uppbeat.io/t/david-bullard/wanderlust
License code: RDSYIXMWRNHHUIIT
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
More on: Prompt Craft
View skill →Related AI Lessons
⚡
⚡
⚡
⚡
The missing layer in prompt engineering: thinking quality
Dev.to · Julien Avezou
The Complete Guide to Prompt Engineering: Unlock the Full Potential of AI
Medium · ChatGPT
Structuring Prompt Guide: Reusable Templates That Actually Work
Medium · JavaScript
Prompt Engineering Room Walkthrough Notes | TryHackMe
Medium · Cybersecurity
🎓
Tutor Explanation
DeepCamp AI