बाहरी संदर्भ शामिल करना

OpenAI API के साथ Prompt Engineering

Fouad Trad

Machine Learning Engineer

बाहरी संदर्भ की ज़रूरत

  • प्री-ट्रेंड लैंग्वेज मॉडल उस जानकारी को पहचानते हैं जिन पर इन्हें प्रशिक्षित किया गया है
  • और संदर्भ देना ज़रूरी है
  • अधिक सटीकता और प्रभावशीलता

मोबाइल फोन पर चैटबॉट का आइकन.

OpenAI API के साथ Prompt Engineering

LLMs में जानकारी की कमी

  • नॉलेज कट-ऑफ
system_prompt = "Act as a financial expert that knows about the latest trends."

user_prompt = "What are the top financial trends in 2023?"

print(get_response(system_prompt, user_prompt))
I apologize for any inconvenience, but as of my last knowledge update in 
September 2021, I don't have information about financial trends in 2023.
OpenAI API के साथ Prompt Engineering

LLMs में जानकारी की कमी

  • अनुरोधित गैर-सार्वजनिक जानकारी
system_prompt = "Act as a study buddy that helps me with my studies to succeed 
in exams."

user_prompt = "What is the name of my favorite instructor?" print(get_response(system_prompt, user_prompt))
I don't have personal information about you, including the name of your 
favorite instructor.
OpenAI API के साथ Prompt Engineering

अतिरिक्त जानकारी कैसे दें?

  • पिछली बातचीत के नमूने
  • सिस्टम का प्रॉम्प्ट

वार्तालाप दर्शाने वाले दो संदेश बॉक्स का आइकन.

OpenAI API के साथ Prompt Engineering

नमूना बातचीत

  • मॉडल को विशिष्ट प्रश्नों के उत्तर देने को निर्देशित करें
response = client.chat.completions.create(
  model="gpt-4o-mini",
  messages=[{"role": "system",
             "content": "You are a customer service chatbot that responds to user queries in a gentle way"},

{"role": "user", "content": "What services do you offer?"},
{"role": "assistant", "content": "We provide services for web application development, mobile app development, and custom software solutions."},
{"role": "user", "content": "How many services do you have?"}])
print(response.choices[0].message.content)
We have 3 services including web application development, mobile app development, and custom software solutions.
  • कमी: बहुत सारे नमूनों की ज़रूरत पड़ सकती है
OpenAI API के साथ Prompt Engineering

सिस्टम प्रॉम्प्ट

  • चैटबॉट उत्तरों के लिए जरूरी संदर्भ शामिल करें
services = "ABC Tech Solutions, a leading IT company, offers a range of services: 
application development, mobile app development, and custom software solutions."

system_prompt = f"""You are a customer service chatbot that responds to user queries in a gentle way. Some information about our services are delimited by triple backticks. ```{services}```"""
user_prompt = "How many services do you offer?" print(get_response(system_prompt, user_prompt))
We have 3 services including web application development, mobile app development, 
and custom software solutions.
OpenAI API के साथ Prompt Engineering

अंतिम नोट

  • छोटे संदर्भों के लिए पहले के तरीके अच्छे हैं
  • बड़े संदर्भों के लिए और उन्नत तकनीकें चाहिए

अलर्ट दर्शाने वाला आइकन.

OpenAI API के साथ Prompt Engineering

अभ्यास करते हैं!

OpenAI API के साथ Prompt Engineering

Preparing Video For Download...