(ਇਸ ਪਾਠ ਦੀ ਵੀਡੀਓ ਦੇਖਣ ਲਈ ਉੱਪਰ ਦਿੱਤੀ ਤਸਵੀਰ ‘ਤੇ ਕਲਿੱਕ ਕਰੋ)
ਏਆਈ ਏਜੰਟਾਂ ਵਿੱਚ ਮੈਟਾਕੌਗਨੀਸ਼ਨ
ਏਆਈ ਏਜੰਟਾਂ ਵਿੱਚ ਮੈਟਾਕੌਗਨੀਸ਼ਨ ਦੇ ਪਾਠ ਵਿੱਚ ਤੁਹਾਡੇ ਸਵਾਗਤ ਹੈ! ਇਹ ਅਧਿਆਇ ਸ਼ੁਰੂਆਤੀ ਬੰਦਿਆਂ ਲਈ ਬਣਾਇਆ ਗਿਆ ਹੈ ਜੋ ਇਹ ਜ਼ਾਣਨਾ ਚਾਹੁੰਦੇ ਹਨ ਕਿ ਏਆਈ ਏਜੰਟ ਆਪਣੇ ਸੋਚਣ ਦੇ ਪ੍ਰਕਿਰਿਆਵਾਂ ਬਾਰੇ ਕਿਵੇਂ ਸੋਚ ਸਕਦੇ ਹਨ। ਇਸ ਪਾਠ ਦੇ ਅੰਤ ਵਿੱਚ, ਤੁਸੀਂ ਮੁੱਖ ਸੰਕਲਪਾਂ ਨੂੰ ਸਮਝ ਲਵੋਗੇ ਅਤੇ ਮੈਟਾਕੌਗਨੀਸ਼ਨ ਨੂੰ ਏਆਈ ਏਜੰਟ ਡਿਜ਼ਾਈਨ ਵਿੱਚ ਲਾਗੂ ਕਰਨ ਲਈ ਅਮਲੀ ਉਦਾਹਰਣਾਂ ਨਾਲ ਸਜਜਿਤ ਹੋਵੋਗੇ।
ਇਸ ਪਾਠ ਨੂੰ ਪੂਰਾ ਕਰਨ ਤੋਂ ਬਾਅਦ, ਤੁਸੀਂ ਸਮਰੱਥ ਹੋਵੋਗੇ:
ਮੈਟਾਕੌਗਨੀਸ਼ਨ ਉਦਾਹਰਨ ਦੇ ਲਈ ਉੱਚ-ਪੱਧਰੀ ਜ਼ਹਨਕਫ਼ੀ ਪ੍ਰਕਿਰਿਆਵਾਂ ਨੂੰ ਦਰਸਾਉਂਦਾ ਹੈ, ਜੋ ਆਪਣੇ ਆਪ ਦੀ ਸੋਚ ਬਾਰੇ ਸੋਚਣ ਨਾਲ ਸੰਬੰਧਿਤ ਹੁੰਦੀਆਂ ਹਨ। ਏਆਈ ਏਜੰਟਾਂ ਲਈ, ਇਸਦਾ ਮਤਲਬ ਹੈ ਕਿ ਉਹ ਆਪਣੇ ਕਾਰਜਾਂ ਦਾ ਅੰਦਾਜ਼ਾ ਲੱਗਾ ਸਕਦੇ ਹਨ ਅਤੇ ਪਿਛਲੇ ਅਨੁਭਵਾਂ ਅਤੇ ਸੁਝਾਅ ਦੇ ਆਧਾਰ ‘ਤੇ ਆਪਣੇ ਵਿਹਾਰ ਨੂੰ ਢਾਲ ਸਕਦੇ ਹਨ। ਮੈਟਾਕੌਗਨੀਸ਼ਨ ਜਾਂ “ਸੋਚ ਬਾਰੇ ਸੋਚਣ” ਏਜੰਟਿਕ ਏਆਈ ਪ੍ਰਣਾਲੀਆਂ ਦੇ ਵਿਕਾਸ ਵਿੱਚ ਇੱਕ ਮਹੱਤਵਪੂਰਨ ਸੰਕਲਪ ਹੈ। ਇਹ ਪ੍ਰਣਾਲੀਆਂ ਨੂੰ ਆਪਣੇ ਅੰਦਰੂਨੀ ਪ੍ਰਕਿਰਿਆਵਾਂ ਦੀ ਬੇਹੂਦੀ ਸਮਝ ਰੱਖਣ ਅਤੇ ਉਹਨਾਂ ਨੂੰ ਮਾਨੀਟਰ, ਨਿਯਮਿਤ ਅਤੇ ਢਾਲਣ ਦੀ ਸਮਰੱਥਾ ਦਿੰਦਾ ਹੈ। ਬਿਲਕੁਲ ਜਿਵੇਂ ਅਸੀਂ ਕਿਵੇਂ ਸਥਿਤੀ ਨੂੰ ਸਮਝਦੇ ਹਾਂ ਜਾਂ ਕਿਸੇ ਸਮੱਸਿਆ ਨੂੰ ਵੇਖਦੇ ਹਾਂ। ਇਹ ਸੁਆਰਥੀ ਸਮਝ ਏਆਈ ਸਿਸਟਮਾਂ ਨੂੰ ਬਿਹਤਰ ਫ਼ੈਸਲੇ ਕਰਨ, ਗਲਤੀਆਂ ਪਛਾਣਨ ਅਤੇ ਆਪਣੇ ਪ੍ਰਦਰਸ਼ਨ ਨੂੰ ਸਮੇਂ ਦੇ ਨਾਲ ਸੁਧਾਰਨ ਵਿੱਚ ਮਦਦ ਕਰਦੀ ਹੈ - ਜੋ ਮੁੜ ਕਰਕੇ ਟਿuringਰਿੰਗ ਟੈਸਟ ਅਤੇ ਏਆਈ ਦੇ ਕਬਜ਼ੇ ਦੇ ਬਹਸ ਨਾਲ ਜੁੜੀ ਹੈ।
ਏਜੰਟਿਕ ਏਆਈ ਪ੍ਰਣਾਲੀਆਂ ਦੇ ਸੰਦਰਭ ਵਿੱਚ, ਮੈਟਾਕੌਗਨੀਸ਼ਨ ਕਈ ਚੁਣੌਤੀਆਂ ਨੂੰ ਸੰਬੋਧਨ ਕਰਨ ਵਿੱਚ ਮਦਦਗਾਰ ਹੋ ਸਕਦੀ ਹੈ, ਜਿਵੇਂ ਕਿ:
ਮੈਟਾਕੌਗਨੀਸ਼ਨ ਜਾਂ “ਸੋਚ ਬਾਰੇ ਸੋਚਣਾ” ਇੱਕ ਉੱਚ-ਪੱਧਰੀ ਜ਼ਹਨਕਫ਼ੀ ਪ੍ਰਕਿਰਿਆ ਹੈ ਜੋ ਆਪਣੇ ਆਪ ਦੀ ਸੂਝ-ਬੂਝ ਅਤੇ ਆਪਣੇ ਜ਼ਹਨਕਫ਼ੀ ਪ੍ਰਕਿਰਿਆਵਾਂ ਦਾ ਨਿਯੰਤਰਣ ਰੱਖਣ ਨਾਲ ਸੰਬੰਧਿਤ ਹੈ। ਏਆਈ ਦੇ ਖੇਤਰ ਵਿੱਚ, ਮੈਟਾਕੌਗਨੀਸ਼ਨ ਏਜੰਟਾਂ ਨੂੰ ਆਪਣੀ ਰਣਨੀਤੀਆਂ ਅਤੇ ਕਾਰਵਾਈਆਂ ਦਾ ਅੰਦਾਜ਼ਾ ਲੱਗਾਉਣਾ ਅਤੇ ਢਾਲਣ ਦਾ ਸਮਰੱਥ ਬਣਾਉਂਦੀ ਹੈ, ਜਿਸ ਨਾਲ ਸਮੱਸਿਆ ਸੁਲਝਾਉਣ ਅਤੇ ਫ਼ੈਸਲਾ ਕਰਨ ਦੀ ਸਮਰੱਥਾ ਵਿੱਚ ਸੁਧਾਰ ਆਉਂਦਾ ਹੈ। ਮੈਟਾਕੌਗਨੀਸ਼ਨ ਨੂੰ ਸਮਝ ਕੇ, ਤੁਸੀਂ ਏਸ ਆਈ ਏਜੰਟ ਡਿਜ਼ਾਈਨ ਕਰ ਸਕਦੇ ਹੋ ਜੋ ਸਿਰਫ਼ ਵਧੀਆ ਬੁੱਧੀਮਾਨ ਹੀ ਨਹੀਂ, ਸਗੋਂ ਵੱਧ ਲਚਕੀਲੇ ਅਤੇ ਪ੍ਰਭਾਵਸ਼ਾਲੀ ਵੀ ਹੁੰਦੇ ਹਨ। ਸੱਚੀ ਮੈਟਾਕੌਗਨੀਸ਼ਨ ਵਿੱਚ, ਤੁਸੀਂ ਏਆਈ ਨੂੰ ਆਪਣੇ ਤਰਕ ਬਾਰੇ ਖੁੱਲ੍ਹ ਕੇ ਸੋਚਦਾ ਦੇਖੋਗੇ।
ਉਦਾਹਰਣ: “ਮੈਂ ਸਸਤੇ ਫਲਾਈਟਾਂ ਨੂੰ ਪ੍ਰਾਥਮਿਕਤਾ ਦਿੱਤੀ ਕਿਉਂਕਿ… ਮੈਂ ਸਿੱਧੀਆਂ ਫਲਾਈਟਾਂ ਤੋਂ ਰਹਿ ਸਕਦਾ ਹਾਂ, ਇਸ ਲਈ ਮੈਂ ਮੁੜ ਜਾਂਚ ਕਰਾਂਗਾ।”। ਕਿਵੇਂ ਜਾਂ ਕਿਉਂ ਇੱਕ ਨਿਰਧਾਰਿਤ ਰਸਤਾ ਚੁਣਿਆ ਗਿਆ, ਇਸਦਾ ਟਰੈਕ ਰੱਖਣਾ।
ਮੈਟਾਕੌਗਨੀਸ਼ਨ ਏਆਈ ਏਜੰਟ ਡਿਜ਼ਾਈਨ ਵਿੱਚ ਕਈ ਕਾਰਨਾਂ ਕਰਕੇ ਇੱਕ ਅਹਿਮ ਭੂਮਿਕਾ ਨਿਭਾਉਂਦਾ ਹੈ:

ਮੈਟਾਕੌਗਨੀਸ਼ਨ ਪ੍ਰਕਿਰਿਆਵਾਂ ਵਿੱਚ ਡੁੱਬਕੀ ਮਾਰਣ ਤੋਂ ਪਹਿਲਾਂ, ਏਆਈ ਏਜੰਟ ਦੇ ਮੂਲ ਭਾਗਾਂ ਨੂੰ ਸਮਝਣਾ ਜਰੂਰੀ ਹੈ। ਇੱਕ ਏਆਈ ਏਜੰਟ ਆਮ ਤੌਰ ‘ਤੇ ਇਨ੍ਹਾਂ ਵਿੱਚੋਂ ਬਣਿਆ ਹੁੰਦਾ ਹੈ:
ਇਹ ਘਟਕ ਇੱਕ “ਮਾਹਰਤਾ ਇਕਾਈ” ਦਾ ਸਿਰਜਣਾ ਕਰਦੇ ਹਨ ਜੋ ਖਾਸ ਕੰਮ ਕਰ ਸਕਦੀ ਹੈ।
ਉਦਾਹਰਣ: ਇੱਕ ਯਾਤਰਾ ਏਜੰਟ ਦੀ ਸੋਚੋ, ਜੋ ਨਾ ਸਿਰਫ ਤੁਹਾਡੀ ਛੁੱਟੀਆਂ ਦੀ ਯੋਜਨਾ ਬਣਾਉਂਦਾ ਹੈ ਪਰ ਅਸਲੀ ਸਮੇਂ ਦੇ ਡਾਟੇ ਅਤੇ ਪਿਛਲੇ ਗਾਹਕਾਂ ਦੇ ਯਾਤਰਾ ਅਨੁਭਵਾਂ ਦੇ ਆਧਾਰ ‘ਤੇ ਆਪਣਾ ਰਸਤਾ ਢਾਲਦਾ ਵੀ ਹੈ।
ਕਲਪਨਾ ਕਰੋ ਤੁਸੀਂ ਇੱਕ ਏਆਈ-ਸੰਚਾਲਿਤ ਯਾਤਰਾ ਏਜੰਟ ਸਰਵਿਸ ਡਿਜ਼ਾਈਨ ਕਰ ਰਹੇ ਹੋ। ਇਹ ਏਜੰਟ, “ਟ੍ਰੈਵਲ ਏਜੰਟ,” ਯੂਜ਼ਰਾਂ ਨੂੰ ਆਪਣੀਆਂ ਛੁੱਟੀਆਂ ਯੋਜਨਾ ਬਣਾਉਣ ਵਿੱਚ ਮਦਦ ਕਰਦਾ ਹੈ। ਮੈਟਾਕੌਗਨੀਸ਼ਨ ਸ਼ਾਮਿਲ ਕਰਨ ਲਈ, ਟ੍ਰੈਵਲ ਏਜੰਟ ਨੂੰ ਆਪਣੀਆਂ ਕਾਰਵਾਈਆਂ ਦਾ ਅੰਦਾਜ਼ਾ ਲੱਗਾਉਣਾ ਅਤੇ ਪਿਛਲੇ ਅਨੁਭਵਾਂ ਦੇ ਆਧਾਰ ‘ਤੇ ਢਾਲਣ ਲੋੜੀਂਦਾ ਹੈ। ਇੱਥੇ ਹੈ ਕਿ ਮੈਟਾਕੌਗਨੀਸ਼ਨ ਕਿਵੇਂ ਭੂਮਿਕਾ ਨਿਭਾ ਸਕਦੀ ਹੈ:
ਮੌਜੂਦਾ ਕੰਮ ਇਕ ਯੂਜ਼ਰ ਦੀ ਪੈਰਿਸ ਯਾਤਰਾ ਯੋਜਨਾ ਬਣਾਉਣ ਵਿੱਚ ਮਦਦ ਕਰਨਾ ਹੈ।
ਟ੍ਰੈਵਲ ਏਜੰਟ ਮੈਟਾਕੌਗਨੀਸ਼ਨ ਨੂੰ ਆਪਣੇ ਪ੍ਰਦਰਸ਼ਨ ਦਾ ਮੂਲਾਂਕਣ ਕਰਨ ਅਤੇ ਪਿਛਲੇ ਅਨੁਭਵਾਂ ਤੋਂ ਸਿੱਖਣ ਲਈ ਉਪਯੋਗ ਕਰਦਾ ਹੈ। ਉਦਾਹਰਨ ਵਜੋਂ:
ਇਹ ਰਹਿ ਗਿਆ ਇੱਕ ਸਰਲ ਉਦਾਹਰਣ ਕਿ ਮੈਟਾਕੌਗਨੀਸ਼ਨ ਸ਼ਾਮਿਲ ਕਰਨ ‘ਤੇ ਟ੍ਰੈਵਲ ਏਜੰਟ ਦਾ ਕੋਡ ਕਿਵੇਂ ਦਿਖ ਸਕਦਾ ਹੈ:
class Travel_Agent:
def __init__(self):
self.user_preferences = {}
self.experience_data = []
def gather_preferences(self, preferences):
self.user_preferences = preferences
def retrieve_information(self):
# ਪਸੰਦਾਂ ਅਨੁਸਾਰ ਉਡਾਣਾਂ, ਹੋਟਲਾਂ ਅਤੇ ਆਕਰਸ਼ਣਾਂ ਦੀ ਖੋਜ ਕਰੋ
flights = search_flights(self.user_preferences)
hotels = search_hotels(self.user_preferences)
attractions = search_attractions(self.user_preferences)
return flights, hotels, attractions
def generate_recommendations(self):
flights, hotels, attractions = self.retrieve_information()
itinerary = create_itinerary(flights, hotels, attractions)
return itinerary
def adjust_based_on_feedback(self, feedback):
self.experience_data.append(feedback)
# ਫੀਡਬੈਕ ਦਾ ਵਿਸ਼ਲੇਸ਼ਣ ਕਰੋ ਅਤੇ ਭਵਿੱਖ ਦੀਆਂ ਸਿਫਾਰਸ਼ਾਂ ਨੂੰ ਸਮਝੋ
self.user_preferences = adjust_preferences(self.user_preferences, feedback)
# ਉਦਾਹਰਨ ਵਜੋਂ ਵਰਤੋਂ
travel_agent = Travel_Agent()
preferences = {
"destination": "Paris",
"dates": "2025-04-01 to 2025-04-10",
"budget": "moderate",
"interests": ["museums", "cuisine"]
}
travel_agent.gather_preferences(preferences)
itinerary = travel_agent.generate_recommendations()
print("Suggested Itinerary:", itinerary)
feedback = {"liked": ["Louvre Museum"], "disliked": ["Eiffel Tower (too crowded)"]}
travel_agent.adjust_based_on_feedback(feedback)
ਮੈਟਾਕੌਗਨੀਸ਼ਨ ਸ਼ਾਮਿਲ ਕਰਕੇ, ਟ੍ਰੈਵਲ ਏਜੰਟ ਹੋਰ ਵਿਆਪਕ ਅਤੇ ਸਹੀ ਯਾਤਰਾ ਸਿਫਾਰਸ਼ਾਂ ਦੇ ਸਕਦਾ ਹੈ, ਜੋ ਕੁੱਲ ਮਿਲਾ ਕੇ ਯੂਜ਼ਰ ਅਨੁਭਵ ਨੂੰ ਸੁਧਾਰਦਾ ਹੈ।
ਯੋਜਨਾ ਬਣਾਉਣਾ ਏਆਈ ਏਜੰਟ ਦੇ ਵਿਹਾਰ ਦਾ ਮਹੱਤਵਪੂਰਨ ਭਾਗ ਹੈ। ਇਹ ਸਮਰੱਥਾ ਵਿੱਚ ਲਕੜੇ ਬਣਾਉਣਾ ਸ਼ਾਮਿਲ ਹੈ ਜੋਇਕ ਲਕੜ ਹੈ ਇਕ ਟੀਕਾ ਹਾਸਲ ਕਰਨ ਲਈ ਲੋੜੀਂਦੀਆਂ ਕਦਮਾਂ ਬਾਰੇ, ਮੌਜੂਦਾ ਸਥਿਤੀ, ਸਰੋਤ ਅਤੇ ਸੰਭਵ ਰੁਕਾਵਟਾਂ ਨੂੰ ਧਿਆਨ ਵਿੱਚ ਰੱਖਦੇ ਹੋਏ।
ਉਦਾਹਰਣ: ਇੱਥੇ ਉਹ ਕਦਮ ਹਨ ਜੋ ਟ੍ਰੈਵਲ ਏਜੰਟ ਇੱਕ ਯੂਜ਼ਰ ਦੀ ਯਾਤਰਾ ਨੂੰ ਪ੍ਰਭਾਵਸ਼ੀਲ ਤਰੀਕੇ ਨਾਲ ਯੋਜਨਾ ਬਣਾਉਣ ਲਈ ਲੈਣਾ ਚਾਹੀਦਾ ਹੈ:
class Travel_Agent:
def __init__(self):
self.user_preferences = {}
self.experience_data = []
def gather_preferences(self, preferences):
self.user_preferences = preferences
def retrieve_information(self):
flights = search_flights(self.user_preferences)
hotels = search_hotels(self.user_preferences)
attractions = search_attractions(self.user_preferences)
return flights, hotels, attractions
def generate_recommendations(self):
flights, hotels, attractions = self.retrieve_information()
itinerary = create_itinerary(flights, hotels, attractions)
return itinerary
def adjust_based_on_feedback(self, feedback):
self.experience_data.append(feedback)
self.user_preferences = adjust_preferences(self.user_preferences, feedback)
# ਬੂਇੰਗ ਬੇਨਤੀ ਦੇ ਅੰਦਰ ਉਦਾਹਰਨ ਵਰਤੋਂ
travel_agent = Travel_Agent()
preferences = {
"destination": "Paris",
"dates": "2025-04-01 to 2025-04-10",
"budget": "moderate",
"interests": ["museums", "cuisine"]
}
travel_agent.gather_preferences(preferences)
itinerary = travel_agent.generate_recommendations()
print("Suggested Itinerary:", itinerary)
feedback = {"liked": ["Louvre Museum"], "disliked": ["Eiffel Tower (too crowded)"]}
travel_agent.adjust_based_on_feedback(feedback)
ਸਭ ਤੋਂ ਪਹਿਲਾਂ ਆਓ ਅਸੀਂ RAG ਟੂਲ ਅਤੇ ਪ੍ਰੀ-ਐমਪਟਿਵ ਕਾਂਟੈਕਸਟ ਲੋਡ ਵਿੱਚ ਫਰਕ ਸਮਝੀਏ।

RAG ਇਕ ਰਿਟਰੀਵਲ ਸਿਸਟਮ ਨੂੰ ਜੈਨਰੇਟਿਵ ਮਾਡਲ ਨਾਲ ਜੋੜਦਾ ਹੈ। ਜਦੋਂ ਕੋਈ ਪ੍ਰਸ਼ਨ ਪੁੱਛਿਆ ਜਾਂਦਾ ਹੈ, ਰਿਟਰੀਵਲ ਸਿਸਟਮ ਬਾਹਰੀ ਸਰੋਤ ਤੋਂ ਸੰਬੰਧਤ ਦਸਤਾਵੇਜ਼ ਜਾਂ ਡਾਟਾ ਲਿਆਉਂਦਾ ਹੈ, ਅਤੇ ਇਹ ਪ੍ਰਾਪਤ ਜਾਣਕਾਰੀ ਜੈਨਰੇਟਿਵ ਮਾਡਲ ਦੇ ਇਨਪੁੱਟ ਨੂੰ ਵਧਾਉਂਦੀ ਹੈ। ਇਹ ਮਾਡਲ ਨੂੰ ਵਧੀਆ ਅਤੇ ਸੰਦਰਭ ਵਿਚ ਸੰਬੰਧਿਤ ਉੱਤਰ ਜਨਰੇਟ ਕਰਨ ਵਿੱਚ ਮਦਦ ਕਰਦਾ ਹੈ।
RAG ਸਿਸਟਮ ਵਿੱਚ, ਏਜੰਟ ਨੋਲਿਜ਼ ਬੇਸ ਤੋਂ ਲੋੜੀਂਦਾ ਜਾਣਕਾਰੀਆਂ ਲਿਆਉਂਦਾ ਹੈ ਅਤੇ ਉਨ੍ਹਾਂ ਦੀ ਵਰਤੋਂ ਹੋਂਦ ਬਹੁਤਰੇ ਸਬੰਧਤ ਕਾਰਵਾਈਆਂ ਜਾਂ ਜਵਾਬ ਜਨਰੇਟ ਕਰਨ ਲਈ ਕਰਦਾ ਹੈ।
ਸਹੀਕਰਣ RAG ਦ੍ਰਿਸ਼ਟੀਕੋਨ RAG ਤਕਨੀਕਾਂ ਦਾ ਉਪਯੋਗ ਕਰਕੇ ਏਆਈ ਏਜੰਟਾਂ ਦੀ ਗਲਤੀਆਂ ਨੂੰ ਠੀਕ ਕਰਨ ਅਤੇ ਸਹੀਅਤ ਵਿੱਚ ਸੁਧਾਰ ਕਰਨ ‘ਤੇ ਧਿਆਨ ਕੇਂਦਰਿਤ ਕਰਦਾ ਹੈ। ਇਸ ਵਿੱਚ ਸ਼ਾਮਿਲ ਹੈ:
ਇੱਕ ਖੋਜ ਏਜੰਟ ਦੀ ਸੋਚੋ ਜੋ ਯੂਜ਼ਰ ਦੇ ਪ੍ਰਸ਼ਨਾਂ ਦੇ ਜਵਾਬ ਦੇਣ ਲਈ ਵੈੱਬ ਤੋਂ ਜਾਣਕਾਰੀ ਲਿਆਉਂਦਾ ਹੈ। ਸਹੀਕਰਣ RAG ਦ੍ਰਿਸ਼ਟੀਕੋਨ ਸ਼ਾਮਿਲ ਕਰ ਸਕਦਾ ਹੈ:
ਸਹੀਕਰਣ RAG (ਰਿਟਰੀਵਲ-ਆਗਮੈਂਟਡ ਜੈਨਰੇਸ਼ਨ) ਏਆਈ ਦੀ ਸਮਰੱਥਾ ਨੂੰ ਜਾਣਕਾਰੀ ਲਿਆਉਣ ਅਤੇ ਜਨਰੇਟ ਕਰਨ ਨਾਲ ਨਾਲ ਗਲਤੀਆਂ ਨੂੰ ਠੀਕ ਕਰਨ ਵਿੱਚ ਬਹਿਤਰੀ ਲਿਆਉਂਦਾ ਹੈ। ਆਓ ਵੇਖੀਏ ਕਿ ਟ੍ਰੈਵਲ ਏਜੰਟ ਸਹੀਕਰਣ RAG ਦ੍ਰਿਸ਼ਟੀਕੋਨ ਦਿਆਰ ਕਰਕੇ ਕਿਵੇਂ ਹੋਰ ਸਹੀ ਅਤੇ ਪ੍ਰਸੰਗਿਕ ਯਾਤਰਾ ਸਿਫਾਰਸ਼ਾਂ ਦੇ ਸਕਦਾ ਹੈ।
ਇਸ ਵਿੱਚ ਸ਼ਾਮਿਲ ਹੈ:
ਉਦਾਹਰਣ:
preferences = {
"destination": "Paris",
"dates": "2025-04-01 to 2025-04-10",
"budget": "moderate",
"interests": ["museums", "cuisine"]
}
ਉਦਾਹਰਣ:
flights = search_flights(preferences)
hotels = search_hotels(preferences)
attractions = search_attractions(preferences)
ਉਦਾਹਰਣ:
itinerary = create_itinerary(flights, hotels, attractions)
print("Suggested Itinerary:", itinerary)
ਉਦਾਹਰਣ:
feedback = {
"liked": ["Louvre Museum"],
"disliked": ["Eiffel Tower (too crowded)"]
}
ਉਦਾਹਰਣ:
if "disliked" in feedback:
preferences["avoid"] = feedback["disliked"]
ਉਦਾਹਰਣ:
new_attractions = search_attractions(preferences)
new_itinerary = create_itinerary(flights, hotels, new_attractions)
print("Updated Itinerary:", new_itinerary)
ਉਦਾਹਰਣ:
def adjust_preferences(preferences, feedback):
if "liked" in feedback:
preferences["favorites"] = feedback["liked"]
if "disliked" in feedback:
preferences["avoid"] = feedback["disliked"]
return preferences
preferences = adjust_preferences(preferences, feedback)
ਇਹ ਰਹਾ ਟ੍ਰੈਵਲ ਏਜੰਟ ਵਿੱਚ ਸਹੀਕਰਣ RAG ਦ੍ਰਿਸ਼ਟੀਕੋਨ ਸ਼ਾਮਿਲ ਕਰਨ ਦੀ ਇੱਕ ਸਧਾਰਨ ਪਾਇਥਨ ਕੋਡ ਉਦਾਹਰਣ:
class Travel_Agent:
def __init__(self):
self.user_preferences = {}
self.experience_data = []
def gather_preferences(self, preferences):
self.user_preferences = preferences
def retrieve_information(self):
flights = search_flights(self.user_preferences)
hotels = search_hotels(self.user_preferences)
attractions = search_attractions(self.user_preferences)
return flights, hotels, attractions
def generate_recommendations(self):
flights, hotels, attractions = self.retrieve_information()
itinerary = create_itinerary(flights, hotels, attractions)
return itinerary
def adjust_based_on_feedback(self, feedback):
self.experience_data.append(feedback)
self.user_preferences = adjust_preferences(self.user_preferences, feedback)
new_itinerary = self.generate_recommendations()
return new_itinerary
# ਉਦਾਹਰਨ ਵਰਤੋਂ
travel_agent = Travel_Agent()
preferences = {
"destination": "Paris",
"dates": "2025-04-01 to 2025-04-10",
"budget": "moderate",
"interests": ["museums", "cuisine"]
}
travel_agent.gather_preferences(preferences)
itinerary = travel_agent.generate_recommendations()
print("Suggested Itinerary:", itinerary)
feedback = {"liked": ["Louvre Museum"], "disliked": ["Eiffel Tower (too crowded)"]}
new_itinerary = travel_agent.adjust_based_on_feedback(feedback)
print("Updated Itinerary:", new_itinerary)
ਪ੍ਰੀ-ਇਮਪਟੀਵ ਸੰਦਰਭ ਲੋਡ ਵਿੱਚ ਮਾਡਲ ਨੂੰ ਕਿਸੇ ਪੁੱਛਤਾਛ ਤੋਂ ਪਹਿਲਾਂ ਸਬੰਧਤ ਸੰਦਰਭ ਜਾਂ ਪਿੱਛੋਕੜ ਜਾਣਕਾਰੀ ਲੋਡ ਕਰਨਾ ਸ਼ਾਮਲ ਹੁੰਦਾ ਹੈ। ਇਸਦਾ ਮਤਲਬ ਹੈ ਕਿ ਮਾਡਲ ਕੋਲ ਸ਼ੁਰੂ ਤੋਂ ਇਹ ਜਾਣਕਾਰੀ ਉਪਲਬਧ ਹੁੰਦੀ ਹੈ, ਜੋ ਇਸਨੂੰ ਹੋਰ ਡਾਟਾ ਪ੍ਰਾਪਤ ਕਰਣ ਦੀ ਲੋੜ ਬਿਨਾਂ ਵਧੇਰੇ ਜਾਣਕਾਰੀ ਵਾਲੇ ਜਵਾਬ ਬਣਾਉਣ ਵਿੱਚ ਮਦਦ ਕਰ ਸਕਦੀ ਹੈ।
ਇੱਥੇ ਪਾਇਥਨ ਵਿੱਚ ਇੱਕ ਟ੍ਰੈਵਲ ਏਜੈਂਟ ਐਪਲੀਕੇਸ਼ਨ ਲਈ ਪ੍ਰੀ-ਇਮਪਟੀਵ ਸੰਦਰਭ ਲੋਡ ਕਿਵੇਂ ਦਿਖਾਈ ਦੇ ਸਕਦੀ ਹੈ, ਉਸਦਾ ਸਧਾਰਣ ਉਦਾਹਰਨ ਦਿੱਤਾ ਗਿਆ ਹੈ:
class TravelAgent:
def __init__(self):
# ਲੋਕਪ੍ਰਿਯ ਮੰਜਿਲਾਂ ਅਤੇ ਉਨ੍ਹਾਂ ਦੀ ਜਾਣਕਾਰੀ ਨੂੰ ਪਹਿਲਾਂ ਲੋਡ ਕਰੋ
self.context = {
"Paris": {"country": "France", "currency": "Euro", "language": "French", "attractions": ["Eiffel Tower", "Louvre Museum"]},
"Tokyo": {"country": "Japan", "currency": "Yen", "language": "Japanese", "attractions": ["Tokyo Tower", "Shibuya Crossing"]},
"New York": {"country": "USA", "currency": "Dollar", "language": "English", "attractions": ["Statue of Liberty", "Times Square"]},
"Sydney": {"country": "Australia", "currency": "Dollar", "language": "English", "attractions": ["Sydney Opera House", "Bondi Beach"]}
}
def get_destination_info(self, destination):
# ਪਹਿਲਾਂ ਲੋਡ ਕੀਤੇ ਸੰਦਰਭ ਤੋਂ ਮੰਜਿਲ ਦੀ ਜਾਣਕਾਰੀ ਲਵੋ
info = self.context.get(destination)
if info:
return f"{destination}:\nCountry: {info['country']}\nCurrency: {info['currency']}\nLanguage: {info['language']}\nAttractions: {', '.join(info['attractions'])}"
else:
return f"Sorry, we don't have information on {destination}."
# ਉਦਾਹਰਨ ਵਜੋਂ ਵਰਤੋਂ
travel_agent = TravelAgent()
print(travel_agent.get_destination_info("Paris"))
print(travel_agent.get_destination_info("Tokyo"))
ਆਰੰਭਿਕੀਕਰਨ (__init__ ਮੈਥਡ): TravelAgent ਕਲਾਸ ਇੱਕ ਡਿਕਸ਼ਨਰੀ ਨੂੰ ਪਹਿਲਾਂ ਹੀ ਲੋਡ ਕਰਦੀ ਹੈ ਜਿਸ ਵਿੱਚ ਲੋਕਪ੍ਰਿਯ ਮੰਜ਼ਿਲਾਂ ਬਾਰੇ ਜਾਣਕਾਰੀ ਹੁੰਦੀ ਹੈ ਜਿਵੇਂ ਕਿ ਪੈਰਿਸ, ਟੋਕੀਓ, ਨਿਊਯਾਰਕ, ਅਤੇ ਸਿਡਨੀ। ਇਸ ਡਿਕਸ਼ਨਰੀ ਵਿੱਚ ਹਰ ਮੰਜ਼ਿਲ ਲਈ ਦੇਸ਼, ਮੁਦਰਾ, ਭਾਸ਼ਾ, ਅਤੇ ਮੁੱਖ ਆਕਰਸ਼ਣ ਵਰਗੀ ਵਿਸਥਾਰਿਤ ਜਾਣਕਾਰੀ ਸ਼ਾਮਲ ਹੁੰਦੀ ਹੈ।
ਜਾਣਕਾਰੀ ਪ੍ਰਾਪਤ ਕਰਨਾ (get_destination_info ਮੈਥਡ): ਜਦੋਂ ਕੋਈ ਯੂਜ਼ਰ ਕਿਸੇ ਨਿਰਧਾਰਤ ਮੰਜ਼ਿਲ ਬਾਰੇ ਪੁੱਛਦਾ ਹੈ, get_destination_info ਮੈਥਡ ਪਹਿਲਾਂ ਹੀ ਲੋਡ ਕੀਤੀ ਗਈ ਸੰਦਰਭ ਡਿਕਸ਼ਨਰੀ ਵਿੱਚੋਂ ਸੰਬੰਧਿਤ ਜਾਣਕਾਰੀ ਲੈ ਆਉਂਦੀ ਹੈ।
ਸੰਦਰਭ ਨੂੰ ਪਹਿਲਾਂ ਹੀ ਲੋਡ ਕਰਕੇ, ਟ੍ਰੈਵਲ ਏਜੈਂਟ ਐਪਲੀਕੇਸ਼ਨ ਯੂਜ਼ਰ ਦੀਆਂ ਪੁੱਛਤਾਛਾਂ ਦਾ ਜਲਦੀ ਜਵਾਬ ਦੇ ਸਕਦੀ ਹੈ ਬਿਨਾਂ ਸਮੇਂ ਵਿੱਚ ਇਸ ਜਾਣਕਾਰੀ ਨੂੰ ਕਿਸੇ ਬਾਹਰੀ ਸਰੋਤ ਤੋਂ ਲੱਭਣ ਦੀ ਲੋੜ ਪਏ। ਇਸ ਨਾਲ ਐਪਲੀਕੇਸ਼ਨ ਵਧੇਰੇ ਕੁਸ਼ਲ ਅਤੇ ਪ੍ਰਤੀਕ੍ਰਿਆਸ਼ੀਲ ਬਣਦੀ ਹੈ।
ਲਕਸ਼ ਦੇ ਨਾਲ ਯੋਜ਼ਨਾ ਦੀ ਸ਼ੁਰੂਆਤ ਦਾ ਮਤਲਬ ਹੈ ਸਾਫ਼ ਉਦੇਸ਼ ਜਾਂ ਨਿਸ਼ਾਨਾ ਰੱਖ ਕੇ ਸ਼ੁਰੂ ਕਰਨਾ। ਇਹ ਲਕਸ਼ ਪਹਿਲਾਂ ਹੀ ਨਿਰਧਾਰਤ ਕਰਨ ਨਾਲ, ਮਾਡਲ ਇਸਨੂੰ ਸਾਰੇ ਦੁਹਰਾਉਣ ਦੇ ਇਰਾਦੇ ਵਿਚ ਪ੍ਰਧਾਨ ਸਿਧਾਂਤ ਵਜੋਂ ਵਰਤ ਸਕਦਾ ਹੈ। ਇਹ ਯਕੀਨੀ ਬਣਾਉਂਦਾ ਹੈ ਕਿ ਹਰ ਇਕ ਦੁਹਰਾਉਣ ਵਿੱਚ ਚਾਹੀਦੀ ਨਤੀਜੇ ਦੀ ਹੋਰ ਨੇੜਤਾ ਆਉਂਦੀ ਹੈ, ਇਸ ਕਾਰਜ ਨੂੰ অধিক ਸੁਚੱਜਾ ਅਤੇ ਕੇਂਦਰਿਤ ਬਣਾਉਂਦਾ ਹੈ।
ਇੱਥੇ ਇੱਕ ਉਦਾਹਰਨ ਹੈ ਕਿ ਤੁਸੀਂ ਟ੍ਰੈਵਲ ਏਜੈਂਟ ਲਈ ਲਕਸ਼ ਦੇ ਨਾਲ ਯੋਜ਼ਨਾ ਨੂੰ ਕਿਵੇਂ ਸ਼ੁਰੂ ਕਰਦੇ ਹੋ ਅਤੇ ਫਿਰ ਦੁਹਰਾਉਂਦੇ ਹੋ, ਪਾਇਥਨ ਵਿੱਚ:
ਇੱਕ ਟ੍ਰੈਵਲ ਏਜੈਂਟ ਕਿਸੇ ਗਾਹਕ ਲਈ ਵਿਅਕਤੀਗਤ ਛੁੱਟੀ ਦੀ ਯੋਜ਼ਨਾ ਬਣਾਉਣਾ ਚਾਹੁੰਦਾ ਹੈ। ਲਕਸ਼ ਸਫਲਤਾ ਬਹੁਤ ਬਣਾ ਕੇ ਉਹ ਯੋਜ਼ਨਾ ਤਿਆਰ ਕਰਨਾ ਹੈ ਜੋ ਗਾਹਕ ਦੀਆਂ ਪਸੰਦਾਂ ਅਤੇ ਬਜਟ ਅਨੁਸਾਰ ਹੋਵੇ।
class TravelAgent:
def __init__(self, destinations):
self.destinations = destinations
def bootstrap_plan(self, preferences, budget):
plan = []
total_cost = 0
for destination in self.destinations:
if total_cost + destination['cost'] <= budget and self.match_preferences(destination, preferences):
plan.append(destination)
total_cost += destination['cost']
return plan
def match_preferences(self, destination, preferences):
for key, value in preferences.items():
if destination.get(key) != value:
return False
return True
def iterate_plan(self, plan, preferences, budget):
for i in range(len(plan)):
for destination in self.destinations:
if destination not in plan and self.match_preferences(destination, preferences) and self.calculate_cost(plan, destination) <= budget:
plan[i] = destination
break
return plan
def calculate_cost(self, plan, new_destination):
return sum(destination['cost'] for destination in plan) + new_destination['cost']
# ਉਦਾਹਰਣ ਵਿਆਖਿਆ
destinations = [
{"name": "Paris", "cost": 1000, "activity": "sightseeing"},
{"name": "Tokyo", "cost": 1200, "activity": "shopping"},
{"name": "New York", "cost": 900, "activity": "sightseeing"},
{"name": "Sydney", "cost": 1100, "activity": "beach"},
]
preferences = {"activity": "sightseeing"}
budget = 2000
travel_agent = TravelAgent(destinations)
initial_plan = travel_agent.bootstrap_plan(preferences, budget)
print("Initial Plan:", initial_plan)
refined_plan = travel_agent.iterate_plan(initial_plan, preferences, budget)
print("Refined Plan:", refined_plan)
ਆਰੰਭਿਕੀਕਰਨ (__init__ ਮੈਥਡ): TravelAgent ਕਲਾਸ ਨੂੰ ਸੰਭਵ ਮੰਜ਼ਿਲਾਂ ਦੀ ਸੂਚੀ ਨਾਲ ਆਰੰਭ ਕੀਤਾ ਜਾਂਦਾ ਹੈ, ਜਿਹਨਾਂ ਦੇ ਨਾਮ, ਲਾਗਤ, ਅਤੇ ਗਤੀਵਿਧੀ ਪ੍ਰਕਾਰ ਵਰਗੇ ਲੱਛਣ ਹੁੰਦੇ ਹਨ।
ਯੋਜ਼ਨਾ ਦੀ ਸ਼ੁਰੂਆਤ (bootstrap_plan ਮੈਥਡ): ਇਹ ਮੈਥਡ ਗਾਹਕ ਦੀਆਂ ਪਸੰਦਾਂ ਅਤੇ ਬਜਟ ਉੱਤੇ ਅਧਾਰਿਤ ਸ਼ੁਰੂਆਤੀ ਯੋਜ਼ਨਾ ਬਣਾਉਂਦਾ ਹੈ। ਇਹ ਮੰਜ਼ਿਲਾਂ ਦੀ ਸੂਚੀ ਵਿੱਚੋਂ ਉਹਨਾਂ ਨੂੰ ਜੋੜਦਾ ਹੈ ਜੋ ਗਾਹਕ ਦੀ ਪਸੰਦ ਨਾਲ ਮਿਲਦੀਆਂ ਹਨ ਅਤੇ ਬਜਟ ਵਿੱਚ ਫਿਟ ਹੁੰਦੀਆਂ ਹਨ।
ਪਸੰਦਾਂ ਦਾ ਮਿਲਾਪ (match_preferences ਮੈਥਡ): ਇਹ ਮੈਥਡ ਜਾਂਚ ਕਰਦਾ ਹੈ ਕਿ ਕੀ ਕੋਈ ਮੰਜ਼ਿਲ ਗਾਹਕ ਦੀਆਂ ਪਸੰਦਾਂ ਨਾਲ ਮਿਲਦੀ ਹੈ।
ਯੋਜ਼ਨਾ ਨੂੰ ਦੁਹਰਾਉਣਾ (iterate_plan ਮੈਥਡ): ਇਹ ਮੈਥਡ ਸ਼ੁਰੂਆਤੀ ਯੋਜ਼ਨਾ ਨੂੰ ਸੁਧਾਰਦਾ ਹੈ ਜੋ ਹਰ ਮੰਜ਼ਿਲ ਨੂੰ ਵਧੀਆ ਮਿਲਾਪ ਵਾਲੀ ਮੰਜ਼ਿਲ ਦੇ ਨਾਲ ਬਦਲ ਕੇ, ਗਾਹਕ ਦੀਆਂ ਪਸੰਦਾਂ ਅਤੇ ਬਜਟ ਸੀਮਾਵਾਂ ਦਾ ਧਿਆਨ ਰੱਖ ਕੇ।
ਲਾਗਤ ਦੀ ਗਣਨਾ (calculate_cost ਮੈਥਡ): ਇਹ ਮੈਥਡ ਮੌਜੂਦਾ ਯੋਜ਼ਨਾ ਦੀ ਕੁੱਲ ਲਾਗਤ ਦੀ ਗਣਨਾ ਕਰਦਾ ਹੈ, ਜਿਸ ਵਿੱਚ ਕੋਈ ਸੰਭਾਵੀ ਨਵੀਂ ਮੰਜ਼ਿਲ ਵੀ ਸ਼ਾਮਲ ਹੈ।
ਲਕਸ਼ ਦੇ ਨਾਲ ਯੋਜ਼ਨਾ ਨੂੰ ਸ਼ੁਰੂ ਕਰਕੇ (ਜਿਵੇਂ ਕਿ ਗਾਹਕ ਦੀ ਸੰਤੁਸ਼ਟੀ ਨੂੰ ਵੱਧ ਤੋਂ ਵੱਧ ਕਰਨਾ) ਅਤੇ ਇਸਨੂੰ ਦੁਹਰਾਉਣਾ, ਟ੍ਰੈਵਲ ਏਜੈਂਟ ਗਾਹਕ ਲਈ ਵਿਅਕਤੀਗਤ ਅਤੇ ਅਨੁਕੂਲ ਟ੍ਰੈਵਲ ਯੋਜ਼ਨਾ ਤਿਆਰ ਕਰ ਸਕਦਾ ਹੈ। ਇਹ ਪਹੁੰਚ ਇਹ ਯਕੀਨੀ ਬਣਾਉਂਦੀ ਹੈ ਕਿ ਟ੍ਰੈਵਲ ਯੋਜ਼ਨਾ ਸ਼ੁਰੂ ਤੋਂ ਹੀ ਗਾਹਕ ਦੀਆਂ ਪਸੰਦਾਂ ਅਤੇ ਬਜਟ ਨਾਲ ਸਹਿਮਤ ਹੋਵੇ ਅਤੇ ਹਰ ਦੁਹਰਾਉਣ ਨਾਲ ਵਧੀਆ ਬਣਦਾ ਜਾਵੇ।
ਵੱਡੇ ਭਾਸ਼ਾਈ ਮਾਡਲ (LLMs) ਨੂੰ ਰੀ-ਰੈਂਕਿੰਗ ਅਤੇ ਸਕੋਰਿੰਗ ਲਈ ਵਰਤਿਆ ਜਾ ਸਕਦਾ ਹੈ, ਜਿੱਥੇ ਇਹ ਪ੍ਰਾਪਤ ਦਸਤਾਵੇਜ਼ਾਂ ਜਾਂ ਬਣਾਏ ਜਾਏ ਜਵਾਬਾਂ ਦੀ ਪ੍ਰਸੰਗਿਕਤਾ ਅਤੇ ਗੁਣਵੱਤਾ ਦੀ ਮੁਲਾਂਕਣ ਕਰਦਾ ਹੈ। ਇਹ ਇਸ ਤਰ੍ਹਾਂ ਕੰਮ ਕਰਦਾ ਹੈ:
ਪ੍ਰਾਪਤੀ: ਸ਼ੁਰੂਆਤੀ ਕਦਮ ਵਿੱਚ ਕੋਈ ਪੁੱਛਤਾਛ ਦੇ ਆਧਾਰ ਤੇ ਉਮੀਦਵਾਰ ਦਸਤਾਵੇਜ਼ ਜਾਂ ਜਵਾਬ ਪ੍ਰਾਪਤ ਕੀਤੇ ਜਾਂਦੇ ਹਨ।
ਰੀ-ਰੈਂਕਿੰਗ: LLM ਉਮੀਦਵਾਰਾਂ ਦੀ ਪ੍ਰਸੰਗਿਕਤਾ ਅਤੇ ਗੁਣਵੱਤਾ ਅਧਾਰਿਤ ਮੁਲਾਂਕਣ ਕਰਦਾ ਹੈ ਅਤੇ ਉਹਨਾਂ ਨੂੰ ਮੁੜ ਕ੍ਰਮ ਵਿੱਚ ਲਿਆਉਂਦਾ ਹੈ। ਇਸ ਕਦਮ ਨਾਲ ਸਭ ਤੋਂ ਜ਼ਿਆਦਾ ਪ੍ਰਸੰਗਿਕ ਅਤੇ ਉੱਚ ਗੁਣਵੱਤਾ ਵਾਲੀ ਜਾਣਕਾਰੀ ਪਹਿਲਾਂ ਦਿਖਾਈ ਜਾਂਦੀ ਹੈ।
ਸਕੋਰਿੰਗ: LLM ਹਰ ਉਮੀਦਵਾਰ ਨੂੰ ਸਕੋਰ ਸੌਂਪਦਾ ਹੈ, ਜੋ ਉਸਦੀ ਪ੍ਰਸੰਗਿਕਤਾ ਅਤੇ ਗੁਣਵੱਤਾ ਨੂੰ ਦਰਸਾਉਂਦਾ ਹੈ। ਇਹ ਸਹੀ ਜਵਾਬ ਜਾਂ ਦਸਤਾਵੇਜ਼ ਚੁਣਨ ਵਿੱਚ ਮਦਦ ਕਰਦਾ ਹੈ।
LLM ਨੂੰ ਰੀ-ਰੈਂਕਿੰਗ ਅਤੇ ਸਕੋਰਿੰਗ ਲਈ ਵਰਤ ਕੇ, ਸਿਸਟਮ ਹੋਰ ਸਹੀ ਅਤੇ ਸੰਦਰਭਿਕ ਜਾਣਕਾਰੀ ਪ੍ਰਦਾਨ ਕਰ ਸਕਦਾ ਹੈ, ਜੋ ਸਮੂਹਿਕ ਯੂਜ਼ਰ ਅਨੁਭਵ ਨੂੰ ਸੁਧਾਰਦਾ ਹੈ।
ਇੱਥੇ ਇੱਕ ਉਦਾਹਰਨ ਹੈ ਕਿ ਕਿਸ ਤਰ੍ਹਾਂ ਇੱਕ ਟ੍ਰੈਵਲ ਏਜੈਂਟ ਪਾਇਥਨ ਵਿੱਚ ਯੂਜ਼ਰ ਦੀਆਂ ਪਸੰਦਾਂ ਦੇ ਆਧਾਰ ਤੇ ਮੰਜ਼ਿਲਾਂ ਨੂੰ ਰੀ-ਰੈਂਕ ਅਤੇ ਸਕੋਰ ਕਰਨ ਲਈ ਵੱਡੇ ਭਾਸ਼ਾ ਮਾਡਲ (LLM) ਦੀ ਵਰਤੋਂ ਕਰ ਸਕਦਾ ਹੈ:
ਇੱਕ ਟ੍ਰੈਵਲ ਏਜੈਂਟ ਗਾਹਕ ਨੂੰ ਉਹ ਮੰਜ਼ਿਲਾਂ ਸੁਝਾਉਣਾ ਚਾਹੁੰਦਾ ਹੈ ਜੋ ਉਹਦੀ ਪਸੰਦਾਂ ਅਨੁਸਾਰ ਬਹੁਤ ਚੰਗੀਆਂ ਹਨ। LLM ਇਹ ਮੰਜ਼ਿਲਾਂ ਨੂੰ ਮੁੜ ਕ੍ਰਮ ਵਿੱਚ ਲਿਆਉਣ ਅਤੇ ਸਕੋਰ ਕਰਨ ਵਿੱਚ ਮਦਦ ਕਰੇਗਾ ਤਾਂ ਜੋ ਸਭ ਤੋਂ ਪ੍ਰਸੰਗਿਕ ਵਿਕਲਪ ਪੇਸ਼ ਕੀਤੇ ਜਾਣ।
ਇੱਥੇ ਪਿਛਲੇ ਉਦਾਹਰਨ ਨੂੰ ਐਜ਼ੂਰ ਓਪਨਏਆਈ ਸਰਵਿਸ ਨਾਲ ਵਰਤਣ ਲਈ ਕਿਵੇਂ ਅੱਪਡੇਟ ਕੀਤਾ ਜਾ ਸਕਦਾ ਹੈ:
import requests
import json
class TravelAgent:
def __init__(self, destinations):
self.destinations = destinations
def get_recommendations(self, preferences, api_key, endpoint):
# ਐਜ਼ਰ ਓਪਨਏਆਈ ਲਈ ਇੱਕ ਪ੍ਰਾਂਪਟ ਬਣਾਓ
prompt = self.generate_prompt(preferences)
# ਬੇਨਤੀ ਲਈ ਹੈਡਰ ਅਤੇ ਡੇਟਾ ਪਰਿਭਾਸ਼ਿਤ ਕਰੋ
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {api_key}'
}
payload = {
"prompt": prompt,
"max_tokens": 150,
"temperature": 0.7
}
# ਦੁਬਾਰਾ ਰੈਂਕਿੰਗ ਅਤੇ ਸਕੋਰ ਕੀਤੇ ਗਏ ਮੰਜ਼ਿਲਾਂ ਨੂੰ ਪ੍ਰਾਪਤ ਕਰਨ ਲਈ ਐਜ਼ਰ ਓਪਨਏਆਈ ਏਪੀਆਈ ਨੂੰ ਕਾਲ ਕਰੋ
response = requests.post(endpoint, headers=headers, json=payload)
response_data = response.json()
# ਸਿਫਾਰਿਸ਼ਾਂ ਨੂੰ ਕੱਢੋ ਅਤੇ ਵਾਪਸ ਕਰੋ
recommendations = response_data['choices'][0]['text'].strip().split('\n')
return recommendations
def generate_prompt(self, preferences):
prompt = "Here are the travel destinations ranked and scored based on the following user preferences:\n"
for key, value in preferences.items():
prompt += f"{key}: {value}\n"
prompt += "\nDestinations:\n"
for destination in self.destinations:
prompt += f"- {destination['name']}: {destination['description']}\n"
return prompt
# ਉਦਾਹਰਣ ਵਰਤੋਂ
destinations = [
{"name": "Paris", "description": "City of lights, known for its art, fashion, and culture."},
{"name": "Tokyo", "description": "Vibrant city, famous for its modernity and traditional temples."},
{"name": "New York", "description": "The city that never sleeps, with iconic landmarks and diverse culture."},
{"name": "Sydney", "description": "Beautiful harbour city, known for its opera house and stunning beaches."},
]
preferences = {"activity": "sightseeing", "culture": "diverse"}
api_key = 'your_azure_openai_api_key'
endpoint = 'https://your-endpoint.com/openai/deployments/your-deployment-name/completions?api-version=2022-12-01'
travel_agent = TravelAgent(destinations)
recommendations = travel_agent.get_recommendations(preferences, api_key, endpoint)
print("Recommended Destinations:")
for rec in recommendations:
print(rec)
ਆਰੰਭਿਕੀਕਰਨ: TravelAgent ਕਲਾਸ ਨੂੰ ਸੰਭਵ ਟ੍ਰੈਵਲ ਮੰਜ਼ਿਲਾਂ ਦੀ ਸੂਚੀ ਨਾਲ ਆਰੰਭ ਕੀਤਾ ਜਾਂਦਾ ਹੈ, ਹਰ ਇਕ ਦੇ ਨਾਮ ਅਤੇ ਵਰਣਨ ਸਮੇਤ ਲੱਛਣ ਹਨ।
ਸਿਫਾਰਸ਼ਾਂ ਪ੍ਰਾਪਤ ਕਰਨਾ (get_recommendations ਮੈਥਡ): ਇਹ ਮੈਥਡ ਯੂਜ਼ਰ ਦੀਆਂ ਪਸੰਦਾਂ ਦੇ ਆਧਾਰ ‘ਤੇ ਐਜ਼ੂਰ ਓਪਨਏਆਈ ਸਰਵਿਸ ਲਈ ਪ੍ਰਾਂਪਟ ਬਣਾਉਂਦਾ ਹੈ ਅਤੇ ਐਜ਼ੂਰ ਓਪਨਏਆਈ API ਨੂੰ HTTP POST ਰਿਕਵੈਸਟ ਭੇਜਦਾ ਹੈ ਤਾਂ ਜੋ ਮੰਜ਼ਿਲਾਂ ਨੂੰ ਮੁੜ ਕ੍ਰਮ ਵਿੱਚ ਲਿਆਇਆ ਜਾਵੇ ਅਤੇ ਸਕੋਰ ਕੀਤਾ ਜਾਵੇ।
ਪ੍ਰਾਂਪਟ ਬਣਾਉਣਾ (generate_prompt ਮੈਥਡ): ਇਹ ਮੈਥਡ ਐਜ਼ੂਰ ਓਪਨਏਆਈ ਲਈ ਪ੍ਰਾਂਪਟ ਤਿਆਰ ਕਰਦਾ ਹੈ, ਜਿਸ ਵਿੱਚ ਯੂਜ਼ਰ ਦੀਆਂ ਪਸੰਦਾਂ ਅਤੇ ਮੰਜ਼ਿਲਾਂ ਦੀ ਸੂਚੀ ਹੁੰਦੀ ਹੈ। ਇਹ ਪ੍ਰਾਂਪਟ ਮਾਡਲ ਨੂੰ ਦਿਸ਼ਾ ਦਿੰਦਾ ਹੈ ਕਿ ਦਿੱਤੀ ਗਈ ਪਸੰਦਾਂ ਅਨੁਸਾਰ ਮੰਜ਼ਿਲਾਂ ਨੂੰ ਮੁੜ ਕ੍ਰਮ ਵਿੱਚ ਲਿਆਉਣ ਅਤੇ ਸਕੋਰ ਕਰਨ ਲਈ।
API ਕਾਲ: requests ਲਾਇਬ੍ਰੇਰੀ ਦੀ ਵਰਤੋਂ ਕਰਕੇ ਐਜ਼ੂਰ ਓਪਨਏਆਈ API ਐਂਡਪੋਇੰਟ ਨੂੰ HTTP POST ਰਿਕਵੈਸਟ ਭੇਜੀ ਜਾਂਦੀ ਹੈ। ਜਵਾਬ ਵਿੱਚ ਮੁੜ ਕ੍ਰਮਿਤ ਅਤੇ ਸਕੋਰ ਕੀਤੀਆਂ ਮੰਜ਼ਿਲਾਂ ਹੁੰਦੀਆਂ ਹਨ।
ਉਦਾਹਰਨ ਵਰਤੋਂ: ਟ੍ਰੈਵਲ ਏਜੈਂਟ ਯੂਜ਼ਰ ਦੀਆਂ ਪਸੰਦਾਂ (ਉਦਾਹਰਨ ਲਈ, ਸੈਰ ਕਰਨ ਅਤੇ ਵਿਭਿੰਨ ਸੰਸਕ੍ਰਿਤੀਆਂ ਵਿਚ ਰੁਚੀ) ਇਕੱਠੀਆਂ ਕਰਦਾ ਹੈ ਅਤੇ ਐਜ਼ੂਰ ਓਪਨਏਆਈ ਸਰਵਿਸ ਦੀ ਵਰਤੋਂ ਕਰਕੇ ਮੁੜ ਕ੍ਰਮਿਤ ਅਤੇ ਸਕੋਰ ਕੀਤੀਆਂ ਸਿਫਾਰਸ਼ਾਂ ਪ੍ਰਾਪਤ ਕਰਦਾ ਹੈ।
ਧਿਆਨ ਰੱਖੋ ਕਿ your_azure_openai_api_key ਨੂੰ ਆਪਣੇ ਅਸਲੀ ਐਜ਼ੂਰ ਓਪਨਏਆਈ API ਕੀ ਨਾਲ ਅਤੇ https://your-endpoint.com/... ਨੂੰ ਆਪਣੇ ਐਜ਼ੂਰ ਓਪਨਏਆਈ ਡਿਪਲੌਇਮੈਂਟ ਦੇ ਅਸਲੀ ਐਂਡਪੋਇੰਟ URL ਨਾਲ ਬਦਲੋ।
LLM ਨੂੰ ਰੀ-ਰੈਂਕ ਅਤੇ ਸਕੋਰਿੰਗ ਲਈ ਵਰਤ ਕੇ, ਟ੍ਰੈਵਲ ਏਜੈਂਟ ਗਾਹਕਾਂ ਨੂੰ ਹੋਰ ਵਿਅਕਤੀਗਤ ਅਤੇ ਪ੍ਰਸੰਗਿਕ ਟ੍ਰੈਵਲ ਸਿਫਾਰਸ਼ਾਂ ਦੇ ਸਕਦਾ ਹੈ, ਜਿਸ ਨਾਲ ਉਹਨਾਂ ਦਾ ਸਮੁੱਚਾ ਅਨੁਭਵ ਸੁਧਰਦਾ ਹੈ।
Retrieval-Augmented Generation (RAG) AI ਏਜੈਂਟਾਂ ਦੇ ਵਿਕਾਸ ਵਿੱਚ ਦੋਹਾਂ ਤਕਨੀਕ ਅਤੇ ਟੂਲ ਦੋਹਾਂ ਵਜੋਂ ਵਰਤਿਆ ਜਾ ਸਕਦਾ ਹੈ। ਦੋਹਾਂ ਵਿੱਚ ਅੰਤਰ ਨੂੰ ਸਮਝ ਕੇ ਤੁਸੀਂ RAG ਨੂੰ ਆਪਣੇ ਪ੍ਰੋਜੈਕਟਾਂ ਵਿੱਚ ਬਿਹਤਰ ਤਰੀਕੇ ਨਾਲ ਲਾਗੂ ਕਰ ਸਕਦੇ ਹੋ।
ਇਹ ਕੀ ਹੈ?
ਕਿਵੇਂ ਕੰਮ ਕਰਦਾ ਹੈ:
ਟ੍ਰੈਵਲ ਏਜੈਂਟ ਵਿੱਚ ਉਦਾਹਰਨ:
ਇਹ ਕੀ ਹੈ?
ਕਿਵੇਂ ਕੰਮ ਕਰਦਾ ਹੈ:
ਟ੍ਰੈਵਲ ਏਜੈਂਟ ਵਿੱਚ ਉਦਾਹਰਨ:
| ਪਹਲੂ | ਪ੍ਰਾਂਪਟਿੰਗ ਤਕਨੀਕ | ਟੂਲ |
|---|---|---|
| ਮੈਨੁਅਲ ਬਨਾਮ ਆਟੋਮੈਟਿਕ | ਹਰ ਪੁੱਛਤਾਛ ਲਈ ਮੈਨੁਅਲ ਪ੍ਰਾਂਪਟਾਂ ਦੀ ਤਿਆਰੀ। | ਪ੍ਰਾਪਤੀ ਅਤੇ ਜਨਰੇਸ਼ਨ ਲਈ ਆਟੋਮੈਟਡ ਪ੍ਰਕਿਰਿਆ। |
| ਕੰਟਰੋਲ | ਪ੍ਰਾਪਤੀ ਪ੍ਰਕਿਰਿਆ ‘ਤੇ ਵੱਧ ਕੰਟਰੋਲ ਦਿੰਦਾ ਹੈ। | ਪ੍ਰਾਪਤੀ ਅਤੇ ਜਨਰੇਸ਼ਨ ਨੂੰ ਸੁਚਾਰੂ ਅਤੇ ਆਟੋਮੈਟਡ ਬਣਾਂਦਾ ਹੈ। |
| ਲਚੀਲਾਪਣ | ਨਿਰਧਾਰਤ ਜ਼ਰੂਰਤਾਂ ਅਨੁਸਾਰ ਵਿਅਕਤੀਗਤ ਪ੍ਰਾਂਪਟਾਂ ਦੀ ਆਗਿਆ ਦਿੰਦਾ ਹੈ। | ਵੱਡੇ ਪੈਮਾਣੇ ਦੀਆਂ ਵਿਵਸਥਾਵਾਂ ਲਈ ਵਧੇਰੇ ਕੁਸ਼ਲ। |
| ਜਟਿਲਤਾ | ਪ੍ਰਾਂਪਟਾਂ ਨੂੰ ਬਣਾਉਣ ਅਤੇ ਸੁਧਾਰਨ ਦੀ ਲੋੜ। | AI ਏਜੈਂਟ ਦੀ ਸਰਚਨਾ ਵਿੱਚ ਆਸਾਨ ਇੰਟੀਗ੍ਰੇਸ਼ਨ। |
ਪ੍ਰਾਂਪਟਿੰਗ ਤਕਨੀਕ ਉਦਾਹਰਨ:
def search_museums_in_paris():
prompt = "Find top museums in Paris"
search_results = search_web(prompt)
return search_results
museums = search_museums_in_paris()
print("Top Museums in Paris:", museums)
ਟੂਲ ਉਦਾਹਰਨ:
class Travel_Agent:
def __init__(self):
self.rag_tool = RAGTool()
def get_museums_in_paris(self):
user_input = "I want to visit museums in Paris."
response = self.rag_tool.retrieve_and_generate(user_input)
return response
travel_agent = Travel_Agent()
museums = travel_agent.get_museums_in_paris()
print("Top Museums in Paris:", museums)
ਪ੍ਰਸੰਗਿਕਤਾ ਦਾ ਮੁਲਾਂਕਣ AI ਏਜੈਂਟ ਦੀ ਕਾਰਗੁਜ਼ਾਰੀ ਦਾ ਇੱਕ ਅਹੰਕਾਰਪੂਰਨ ਪਹਲੂ ਹੈ। ਇਹ ਯਕੀਨੀ ਬਣਾਉਂਦਾ ਹੈ ਕਿ ਏਜੈਂਟ ਵੱਲੋਂ ਪ੍ਰਾਪਤ ਅਤੇ ਬਣਾਈ ਗਈ ਜਾਣਕਾਰੀ ਯੂਜ਼ਰ ਲਈ ਢੁਕਵਾਂ, ਸਹੀ, ਅਤੇ ਲਾਭਕਾਰੀ ਹੈ। ਆਓ ਵੇਖੀਏ ਕਿ ਕਿਵੇਂ ਪ੍ਰਸੰਗਿਕਤਾ ਦਾ ਮੁਲਾਂਕਣ ਕਰਨਾ ਹੈ, ਜੀਵੰਤ ਉਦਾਹਰਨਾਂ ਅਤੇ ਤਕਨੀਕਾਂ ਸਮੇਤ।
ਉਦਾਹਰਨ:
def relevance_score(item, query):
score = 0
if item['category'] in query['interests']:
score += 1
if item['price'] <= query['budget']:
score += 1
if item['location'] == query['destination']:
score += 1
return score
ਉਦਾਹਰਨ:
def filter_and_rank(items, query):
ranked_items = sorted(items, key=lambda item: relevance_score(item, query), reverse=True)
return ranked_items[:10] # ਸਿਖਰਲੇ 10 ਸੰਬੰਧਿਤ ਆਈਟਮ ਵਾਪਸ ਕਰੋ
ਉਦਾਹਰਨ:
def process_query(query):
# ਵਰਤੋਂਕਾਰ ਦੀ ਪੁੱਛਤाछ ਤੋਂ ਮੁੱਖ ਜਾਣਕਾਰੀ ਪ੍ਰਾਪਤ ਕਰਨ ਲਈ NLP ਦੀ ਵਰਤੋਂ ਕਰੋ
processed_query = nlp(query)
return processed_query
ਉਦਾਹਰਨ:
def adjust_based_on_feedback(feedback, items):
for item in items:
if item['name'] in feedback['liked']:
item['relevance'] += 1
if item['name'] in feedback['disliked']:
item['relevance'] -= 1
return items
ਇਹਥੇ ਇੱਕ ਪ੍ਰਯੋਗਿਕ ਉਦਾਹਰਨ ਹੈ ਕਿ ਕਿਵੇਂ ਟ੍ਰੈਵਲ ਏਜੈਂਟ ਯਾਤਰਾ ਦੀਆਂ ਸਿਫਾਰਸ਼ਾਂ ਦੀ ਪ੍ਰਸੰਗਿਕਤਾ ਦਾ ਮੁਲਾਂਕਣ ਕਰ ਸਕਦਾ ਹੈ:
class Travel_Agent:
def __init__(self):
self.user_preferences = {}
self.experience_data = []
def gather_preferences(self, preferences):
self.user_preferences = preferences
def retrieve_information(self):
flights = search_flights(self.user_preferences)
hotels = search_hotels(self.user_preferences)
attractions = search_attractions(self.user_preferences)
return flights, hotels, attractions
def generate_recommendations(self):
flights, hotels, attractions = self.retrieve_information()
ranked_hotels = self.filter_and_rank(hotels, self.user_preferences)
itinerary = create_itinerary(flights, ranked_hotels, attractions)
return itinerary
def filter_and_rank(self, items, query):
ranked_items = sorted(items, key=lambda item: self.relevance_score(item, query), reverse=True)
return ranked_items[:10] # ਸਿਰਫ਼ 10 ਸਭ ਤੋਂ ਸਬੰਧਿਤ ਆਈਟਮ ਵਾਪਸ ਕਰੋ
def relevance_score(self, item, query):
score = 0
if item['category'] in query['interests']:
score += 1
if item['price'] <= query['budget']:
score += 1
if item['location'] == query['destination']:
score += 1
return score
def adjust_based_on_feedback(self, feedback, items):
for item in items:
if item['name'] in feedback['liked']:
item['relevance'] += 1
if item['name'] in feedback['disliked']:
item['relevance'] -= 1
return items
# ਉਦਾਹਰਨ ਵਾਪਰਤਾ
travel_agent = Travel_Agent()
preferences = {
"destination": "Paris",
"dates": "2025-04-01 to 2025-04-10",
"budget": "moderate",
"interests": ["museums", "cuisine"]
}
travel_agent.gather_preferences(preferences)
itinerary = travel_agent.generate_recommendations()
print("Suggested Itinerary:", itinerary)
feedback = {"liked": ["Louvre Museum"], "disliked": ["Eiffel Tower (too crowded)"]}
updated_items = travel_agent.adjust_based_on_feedback(feedback, itinerary['hotels'])
print("Updated Itinerary with Feedback:", updated_items)
ਮਨਸੂਬੇ ਨਾਲ ਖੋਜ ਦਾ ਮਤਲਬ ਹੈ ਕਿ ਯੂਜ਼ਰ ਦੇ ਪੁੱਛਤਾਂ ਦੇ ਪਿੱਛੇ ਲੁਕਿਆ ਹੋਇਆ ਉਦੇਸ਼ ਜਾਂ ਲਕਸ਼ ਸਮਝ ਕੇ ਸਭ ਤੋਂ ਪ੍ਰਸੰਗਿਕ ਅਤੇ ਲਾਭਕਾਰੀ ਜਾਣਕਾਰੀ ਪ੍ਰਾਪਤ ਅਤੇ ਤਿਆਰ ਕਰਨੀ। ਇਹ ਸਿਰਫ਼ ਕੀਵਰਡ ਮੇਲ ਖਾਣ ਤੋਂ ਅੱਗੇ ਜਾ ਕੇ ਯੂਜ਼ਰ ਦੀ ਅਸਲ ਲੋੜ ਅਤੇ ਸੰਦਰਭ ਨੂੰ ਸਮਝਣ ‘ਤੇ ਧਿਆਨ ਦਿੰਦਾ ਹੈ।
ਆਓ ਟ੍ਰੈਵਲ ਏਜੈਂਟ ਨੂੰ ਉਦਾਹਰਨ ਵਜੋਂ ਲੈ ਕੇ ਵੇਖੀਏ ਕਿ ਮਨਸੂਬੇ ਨਾਲ ਖੋਜ ਕਿਵੇਂ ਲਾਗੂ ਕੀਤੀ ਜਾ ਸਕਦੀ ਹੈ।
ਯੂਜ਼ਰ ਪਸੰਦਾਂ ਇਕੱਠੀਆਂ ਕਰਨਾ
class Travel_Agent:
def __init__(self):
self.user_preferences = {}
def gather_preferences(self, preferences):
self.user_preferences = preferences
ਯੂਜ਼ਰ ਦਾ ਮਨਸੂਬਾ ਸਮਝਣਾ
def identify_intent(query):
if "book" in query or "purchase" in query:
return "transactional"
elif "website" in query or "official" in query:
return "navigational"
else:
return "informational"
ਸੰਦਰਭ ਸਮਝ
def analyze_context(query, user_history):
# ਮੌਜੂਦਾ ਕوری کو صارف کی تاریخ کے ساتھ ملائیں تاکہ سیاق و سباق کو سمجھا جا سکے
context = {
"current_query": query,
"user_history": user_history
}
return context
ਨਤੀਜੇ ਖੋਜੋ ਅਤੇ ਨਿੱਜੀ ਬਣਾਓ
def search_with_intent(query, preferences, user_history):
intent = identify_intent(query)
context = analyze_context(query, user_history)
if intent == "informational":
search_results = search_information(query, preferences)
elif intent == "navigational":
search_results = search_navigation(query)
elif intent == "transactional":
search_results = search_transaction(query, preferences)
personalized_results = personalize_results(search_results, user_history)
return personalized_results
def search_information(query, preferences):
# ਜਾਣਕਾਰੀ ਵਾਲੇ ਮਨੋਰਥ ਲਈ ਉਦਾਹਰਨ ਖੋਜ ਤਰਕ
results = search_web(f"best {preferences['interests']} in {preferences['destination']}")
return results
def search_navigation(query):
# ਨੈਵੀਗੇਸ਼ਨ ਮਨੋਰਥ ਲਈ ਉਦਾਹਰਨ ਖੋਜ ਤਰਕ
results = search_web(query)
return results
def search_transaction(query, preferences):
# ਲੈਣ-ਦੇਣ ਵਾਲੇ ਮਨੋਰਥ ਲਈ ਉਦਾਹਰਨ ਖੋਜ ਤਰਕ
results = search_web(f"book {query} to {preferences['destination']}")
return results
def personalize_results(results, user_history):
# ਉਦਾਹਰਨ ਨਿੱਜੀਕਰਨ ਤਰਕ
personalized = [result for result in results if result not in user_history]
return personalized[:10] # ਸਭ ਤੋਂ ਵਧੀਆ 10 ਨਿੱਜੀ ਨਤੀਜੇ ਵਾਪਸ ਕਰੋ
ਉਦਾਹਰਨ ਵਰਤੋਂ
travel_agent = Travel_Agent()
preferences = {
"destination": "Paris",
"interests": ["museums", "cuisine"]
}
travel_agent.gather_preferences(preferences)
user_history = ["Louvre Museum website", "Book flight to Paris"]
query = "best museums in Paris"
results = search_with_intent(query, preferences, user_history)
print("Search Results:", results)
ਕੋਡ ਤਿਆਰ ਕਰਨ ਵਾਲੇ ਏਜੰਟ AI ਮਾਡਲਾਂ ਦੀ ਵਰਤੋਂ ਕਰਕੇ ਕੋਡ ਲਿਖਦੇ ਅਤੇ ਚਲਾਉਂਦੇ ਹਨ, ਜਟਿਲ ਸਮੱਸਿਆਵਾਂ ਹੱਲ ਕਰਨ ਅਤੇ ਕੰਮਾਂ ਨੂੰ ਸੁਚਾਲੂ ਕਰਨ ਲਈ।
ਕੋਡ ਤਿਆਰ ਕਰਨ ਵਾਲੇ ਏਜੰਟ ਜਨਰੇਟਿਵ AI ਮਾਡਲਾਂ ਦੀ ਵਰਤੋਂ ਕਰਕੇ ਕੋਡ ਲਿਖਦੇ ਅਤੇ ਚਲਾਉਂਦੇ ਹਨ। ਇਹ ਏਜੰਟ ਜਟਿਲ ਸਮੱਸਿਆਵਾਂ ਹੱਲ ਕਰ ਸਕਦੇ ਹਨ, ਕੰਮ ਆਪਣੇ ਆਪ ਕਰ ਸਕਦੇ ਹਨ, ਅਤੇ ਵੱਖ-ਵੱਖ ਪ੍ਰੋਗ੍ਰਾਮਿੰਗ ਭਾਸ਼ਾਵਾਂ ਵਿੱਚ ਕੋਡ ਤਿਆਰ ਅਤੇ ਚਲਾ ਕੇ ਕੀਮਤੀ ਜਾਣਕਾਰੀਆਂ ਪ੍ਰਦਾਨ ਕਰ ਸਕਦੇ ਹਨ।
ਸੋਚੋ ਤੁਸੀਂ ਇੱਕ ਕੋਡ ਤਿਆਰ ਕਰਨ ਵਾਲੇ ਏਜੰਟ ਨੂੰ ਡਿਜ਼ਾਈਨ ਕਰ ਰਹੇ ਹੋ। ਇਹ ਇਸ ਤਰ੍ਹਾਂ ਕੰਮ ਕਰ ਸਕਦਾ ਹੈ:
ਇਸ ਉਦਾਹਰਨ ਵਿੱਚ, ਅਸੀਂ ਇੱਕ ਕੋਡ ਤਿਆਰ ਕਰਨ ਵਾਲੇ ਏਜੰਟ, ਟਰੈਵਲ ਏਜੰਟ ਨੂੰ ਡਿਜ਼ਾਈਨ ਕਰਾਂਗੇ, ਜੋ ਯੂਜ਼ਰਾਂ ਨੂੰ ਯਾਤਰਾ ਯੋਜਨਾ ਬਣਾਉਣ ਵਿੱਚ ਸਹਾਇਤਾ ਦੇਵੇਗਾ, ਕੋਡ ਤਿਆਰ ਕਰਕੇ ਅਤੇ ਚਲਾ ਕੇ। ਇਹ ਏਜੰਟ ਜਨਰੇਟਿਵ AI ਦੀ ਵਰਤੋਂ ਕਰਕੇ ਯਾਤਰਾ ਵਿਕਲਪ ਲੱਭਣ, ਨਤੀਜੇ ਛਾਂਟਣ ਅਤੇ ਇੱਕ ਯਾਤਰਾ ਕਾਰਜਸੂਚੀ ਤਿਆਰ ਕਰਨ ਜਿਹੇ ਕੰਮ ਸੰਭਾਲ ਸਕਦਾ ਹੈ।
ਯੂਜ਼ਰ ਪਸੰਦਾਂ ਇਕੱਠਾ ਕਰਨਾ
class Travel_Agent:
def __init__(self):
self.user_preferences = {}
def gather_preferences(self, preferences):
self.user_preferences = preferences
ਡਾਟਾ ਪ੍ਰਾਪਤ ਕਰਨ ਲਈ ਕੋਡ ਤਿਆਰ ਕਰਨਾ
def generate_code_to_fetch_data(preferences):
# ਉਦਾਹਰਨ: ਉਪਭੋਗਤਾ ਦੀਆਂ ਪਸੰਦਾਂ ਦੇ ਆਧਾਰ 'ਤੇ ਉਡਾਣਾਂ ਲਈ ਕੋਡ ਤਿਆਰ ਕਰੋ
code = f"""
def search_flights():
import requests
response = requests.get('https://api.example.com/flights', params={preferences})
return response.json()
"""
return code
def generate_code_to_fetch_hotels(preferences):
# ਉਦਾਹਰਨ: ਹੋਟਲਾਂ ਲਈ ਖੋਜ ਕਰਨ ਲਈ ਕੋਡ ਤਿਆਰ ਕਰੋ
code = f"""
def search_hotels():
import requests
response = requests.get('https://api.example.com/hotels', params={preferences})
return response.json()
"""
return code
ਤਿਆਰ ਕੀਤੇ ਕੋਡ ਨੂੰ ਚਲਾਉਣਾ
def execute_code(code):
# ਉਤਪੰਨ ਕੋਡ ਨੂੰ exec ਦੀ ਵਰਤੋਂ ਕਰਕੇ ਚਲਾਓ
exec(code)
result = locals()
return result
travel_agent = Travel_Agent()
preferences = {
"destination": "Paris",
"dates": "2025-04-01 to 2025-04-10",
"budget": "moderate",
"interests": ["museums", "cuisine"]
}
travel_agent.gather_preferences(preferences)
flight_code = generate_code_to_fetch_data(preferences)
hotel_code = generate_code_to_fetch_hotels(preferences)
flights = execute_code(flight_code)
hotels = execute_code(hotel_code)
print("Flight Options:", flights)
print("Hotel Options:", hotels)
ਇਟਿਨਰੇਰੀ ਤਿਆਰ ਕਰਨਾ
def generate_itinerary(flights, hotels, attractions):
itinerary = {
"flights": flights,
"hotels": hotels,
"attractions": attractions
}
return itinerary
attractions = search_attractions(preferences)
itinerary = generate_itinerary(flights, hotels, attractions)
print("Suggested Itinerary:", itinerary)
ਪ੍ਰਤੀਕਿਰਿਆ ਦੇ ਆਧਾਰ ‘ਤੇ ਠੀਕ ਕਰਨਾ
def adjust_based_on_feedback(feedback, preferences):
# ਯੂਜ਼ਰ ਫੀਡਬੈਕ ਦੇ ਆਧਾਰ 'ਤੇ ਪਸੰਦਾਂ ਨੂੰ ਠੀਕ ਕਰੋ
if "liked" in feedback:
preferences["favorites"] = feedback["liked"]
if "disliked" in feedback:
preferences["avoid"] = feedback["disliked"]
return preferences
feedback = {"liked": ["Louvre Museum"], "disliked": ["Eiffel Tower (too crowded)"]}
updated_preferences = adjust_based_on_feedback(feedback, preferences)
# ਅਪਡੇਟ ਕੀਤੀਆਂ ਪਸੰਦਾਂ ਨਾਲ ਕੋਡ ਨੂੰ ਮੁੜ ਬਣਾਓ ਅਤੇ ਚਲਾਓ
updated_flight_code = generate_code_to_fetch_data(updated_preferences)
updated_hotel_code = generate_code_to_fetch_hotels(updated_preferences)
updated_flights = execute_code(updated_flight_code)
updated_hotels = execute_code(updated_hotel_code)
updated_itinerary = generate_itinerary(updated_flights, updated_hotels, attractions)
print("Updated Itinerary:", updated_itinerary)
ਟੇਬਲ ਦੀ ਸਕੀਮਾ ਦੇ ਆਧਾਰ ‘ਤੇ ਸਹੀ ਤਰੀਕੇ ਨਾਲ ਕਵੈਰੀ ਤਿਆਰ ਕਰਨ ਦੀ ਪ੍ਰਕਿਰਿਆ ਵਾਤਾਵਰਣੀ ਜਾਗਰੂਕਤਾ ਅਤੇ ਤਰਕ ਨਾਲ ਸੁਧਾਰੀ ਜਾ ਸਕਦੀ ਹੈ।
ਇੱਥੇ ਇਹ ਕਿਵੇਂ ਕੀਤਾ ਜਾ ਸਕਦਾ ਹੈ:
ਇੱਥੇ ਇੱਕ ਸੁਧਾਰਿਆ ਹੋਇਆ Python ਕੋਡ ਉਦਾਹਰਨ ਹੈ ਜੋ ਇਹ ਫਿਕਰਾਂ ਸ਼ਾਮਲ ਕਰਦਾ ਹੈ:
def adjust_based_on_feedback(feedback, preferences, schema):
# ਯੂਜ਼ਰ ਫੀਡਬੈਕ ਦੇ ਆਧਾਰ 'ਤੇ ਪਸੰਦਾਂ ਨੂੰ ਸਮਾਇਤ ਕਰੋ
if "liked" in feedback:
preferences["favorites"] = feedback["liked"]
if "disliked" in feedback:
preferences["avoid"] = feedback["disliked"]
# ਹੋਰ ਸੰਬੰਧਿਤ ਪਸੰਦਾਂ ਨੂੰ ਸਮਾਇਤ ਕਰਨ ਲਈ ਸਕੀਮਾ ਦੇ ਆਧਾਰ 'ਤੇ ਤਰਕ
for field in schema:
if field in preferences:
preferences[field] = adjust_based_on_environment(feedback, field, schema)
return preferences
def adjust_based_on_environment(feedback, field, schema):
# ਸਕੀਮਾ ਅਤੇ ਫੀਡਬੈਕ ਦੇ ਆਧਾਰ 'ਤੇ ਪਸੰਦਾਂ ਨੂੰ ਸਮਾਇਤ ਕਰਨ ਲਈ ਕਸਟਮ ਲੋਗਿਕ
if field in feedback["liked"]:
return schema[field]["positive_adjustment"]
elif field in feedback["disliked"]:
return schema[field]["negative_adjustment"]
return schema[field]["default"]
def generate_code_to_fetch_data(preferences):
# ਅਪਡੇਟ ਕੀਤੀਆਂ ਪਸੰਦਾਂ ਦੇ ਆਧਾਰ 'ਤੇ ਫਲਾਈਟ ਡੇਟਾ ਲੈਣ ਲਈ ਕੋਡ ਬਣਾਓ
return f"fetch_flights(preferences={preferences})"
def generate_code_to_fetch_hotels(preferences):
# ਅਪਡੇਟ ਕੀਤੀਆਂ ਪਸੰਦਾਂ ਦੇ ਆਧਾਰ 'ਤੇ ਹੋਟਲ ਡੇਟਾ ਲੈਣ ਲਈ ਕੋਡ ਬਣਾਓ
return f"fetch_hotels(preferences={preferences})"
def execute_code(code):
# ਕੋਡ ਦੀ ਨਕਲ ਚਲਾਉਣ ਅਤੇ ਨਕਲੀ ਡੇਟਾ ਵਾਪਸ ਕਰਨ ਦਾ ਅਨੁਕਰਣ ਕਰੋ
return {"data": f"Executed: {code}"}
def generate_itinerary(flights, hotels, attractions):
# ਫਲਾਈਟਾਂ, ਹੋਟਲਾਂ ਅਤੇ ਆਕਰਸ਼ਣਾਂ ਦੇ ਆਧਾਰ 'ਤੇ ਯਾਤਰਾ ਬਣਾਓ
return {"flights": flights, "hotels": hotels, "attractions": attractions}
# ਉਦਾਹਰਨ ਸਕੀਮਾ
schema = {
"favorites": {"positive_adjustment": "increase", "negative_adjustment": "decrease", "default": "neutral"},
"avoid": {"positive_adjustment": "decrease", "negative_adjustment": "increase", "default": "neutral"}
}
# ਉਦਾਹਰਨ ਵਰਤੋਂ
preferences = {"favorites": "sightseeing", "avoid": "crowded places"}
feedback = {"liked": ["Louvre Museum"], "disliked": ["Eiffel Tower (too crowded)"]}
updated_preferences = adjust_based_on_feedback(feedback, preferences, schema)
# ਅਪਡੇਟ ਕੀਤੀਆਂ ਪਸੰਦਾਂ ਨਾਲ ਕੋਡ ਮੁੜ ਤਿਆਰ ਕਰੋ ਅਤੇ ਚਲਾਓ
updated_flight_code = generate_code_to_fetch_data(updated_preferences)
updated_hotel_code = generate_code_to_fetch_hotels(updated_preferences)
updated_flights = execute_code(updated_flight_code)
updated_hotels = execute_code(updated_hotel_code)
updated_itinerary = generate_itinerary(updated_flights, updated_hotels, feedback["liked"])
print("Updated Itinerary:", updated_itinerary)
schema ਡਿਕਸ਼ਨਰੀ ਦੱਸਦੀ ਹੈ ਕਿ ਪ੍ਰਤੀਕਿਰਿਆ ਦੇ ਆਧਾਰ ‘ਤੇ ਪਸੰਦਾਂ ਨੂੰ ਕਿਵੇਂ ਠੀਕ ਕੀਤਾ ਜਾਣਾ ਚਾਹੀਦਾ ਹੈ। ਇਸ ਵਿਚ favorites ਅਤੇ avoid ਵਰਗੇ ਖੇਤਰ ਹਨ, ਜਿਨ੍ਹਾਂ ਨਾਲ ਸਬੰਧਿਤ ਢੰਗ ਨਾਲ ਠੀਕ ਕੀਤਾ ਜਾਂਦਾ ਹੈ।adjust_based_on_feedback ਮੈਥਡ): ਇਹ ਮੈਥਡ ਯੂਜ਼ਰ ਦੀ ਪ੍ਰਤੀਕਿਰਿਆ ਅਤੇ ਸਕੀਮਾ ਦੇ ਆਧਾਰ ‘ਤੇ ਪਸੰਦਾਂ ਨੂੰ ਠੀਕ ਕਰਦਾ ਹੈ।adjust_based_on_environment ਮੈਥਡ): ਇਹ ਮੈਥਡ ਸਕੀਮਾ ਅਤੇ ਪ੍ਰਤੀਕਿਰਿਆ ਦੇ ਆਧਾਰ ‘ਤੇ ਠੀਕ ਕਰਦਾ ਹੈ।ਸਿਸਟਮ ਨੂੰ ਵਾਤਾਵਰਣ-ਸਮਝਦਾਰ ਅਤੇ ਸਕੀਮਾ ਦੇ ਆਧਾਰ ‘ਤੇ ਤਰਕਸ਼ੀਲ ਬਣਾ ਕੇ, ਇਹ ਹੋਰ ਸਹੀ ਅਤੇ ਪ੍ਰਸੰਗਿਕ ਕਵੈਰੀਆਂ ਤਿਆਰ ਕਰ ਸਕਦਾ ਹੈ, ਜੋ ਯਾਤਰਾ ਦੀਆਂ ਵਧੀਆ ਸਿਫਾਰਿਸ਼ਾਂ ਅਤੇ ਵੱਧ ਨਿੱਜੀ ਯੂਜ਼ਰ ਅਨੁਭਵ ਵੱਲ ਲੈ ਜਾਂਦੀਆਂ ਹਨ।
SQL (Structured Query Language) ਡੇਟਾਬੇਸਾਂ ਨਾਲ ਕੰਮ ਕਰਨ ਲਈ ਇੱਕ ਸ਼ਕਤੀਸ਼ਾਲੀ ਸਧਨ ਹੈ। ਜਦੋਂ ਇਹ Retrieval-Augmented Generation (RAG) ਦੇ ਹਿੱਸੇ ਵਜੋਂ ਵਰਤੀ ਜਾਂਦੀ ਹੈ, ਤਾਂ SQL ਡੇਟਾਬੇਸਾਂ ਵਿੱਚੋਂ ਸਬੰਧਤ ਡਾਟਾ ਲਿਆਉਂਦੀ ਹੈ, ਜੋ AI ਏਜੰਟਾਂ ਨੂੰ ਜਵਾਬ ਜਾਂ ਕਾਰਵਾਈ ਤਿਆਰ ਕਰਨ ਵਿੱਚ ਮਦਦ ਕਰਦਾ ਹੈ। ਆਓ ਵੇਖੀਏ ਕਿ ਟਰੈਵਲ ਏਜੰਟ ਸੰਦਰਭ ਵਿੱਚ RAG ਤਕਨਾਲੋਜੀ ਵਜੋਂ SQL ਕਿਵੇਂ ਵਰਤੀ ਜਾ ਸਕਦੀ ਹੈ।
ਉਦਾਹਰਨ: ਇੱਕ ਡਾਟਾ ਵਿਸ਼ਲੇਸ਼ਣ ਏਜੰਟ:
ਯੂਜ਼ਰ ਪਸੰਦਾਂ ਇਕੱਠਾ ਕਰਨਾ
class Travel_Agent:
def __init__(self):
self.user_preferences = {}
def gather_preferences(self, preferences):
self.user_preferences = preferences
SQL ਕਵੈਰੀਜ਼ ਤਿਆਰ ਕਰਨਾ
def generate_sql_query(table, preferences):
query = f"SELECT * FROM {table} WHERE "
conditions = []
for key, value in preferences.items():
conditions.append(f"{key}='{value}'")
query += " AND ".join(conditions)
return query
SQL ਕਵੈਰੀਜ਼ ਚਲਾਉਣਾ
import sqlite3
def execute_sql_query(query, database="travel.db"):
connection = sqlite3.connect(database)
cursor = connection.cursor()
cursor.execute(query)
results = cursor.fetchall()
connection.close()
return results
ਸਿਫਾਰਿਸ਼ਾਂ ਤਿਆਰ ਕਰਨਾ
def generate_recommendations(preferences):
flight_query = generate_sql_query("flights", preferences)
hotel_query = generate_sql_query("hotels", preferences)
attraction_query = generate_sql_query("attractions", preferences)
flights = execute_sql_query(flight_query)
hotels = execute_sql_query(hotel_query)
attractions = execute_sql_query(attraction_query)
itinerary = {
"flights": flights,
"hotels": hotels,
"attractions": attractions
}
return itinerary
travel_agent = Travel_Agent()
preferences = {
"destination": "Paris",
"dates": "2025-04-01 to 2025-04-10",
"budget": "moderate",
"interests": ["museums", "cuisine"]
}
travel_agent.gather_preferences(preferences)
itinerary = generate_recommendations(preferences)
print("Suggested Itinerary:", itinerary)
ਉਡਾਣ ਕਵੈਰੀ
SELECT * FROM flights WHERE destination='Paris' AND dates='2025-04-01 to 2025-04-10' AND budget='moderate';
ਹੋਟਲ ਕਵੈਰੀ
SELECT * FROM hotels WHERE destination='Paris' AND budget='moderate';
ਆਕਰਸ਼ਣ ਕਵੈਰੀ
SELECT * FROM attractions WHERE destination='Paris' AND interests='museums, cuisine';
Retrieval-Augmented Generation (RAG) ਤਕਨਾਲੋਜੀ ਦੇ ਹਿੱਸੇ ਵਜੋਂ SQL ਦੀ ਵਰਤੋਂ ਕਰਕੇ, AI ਏਜੰਟਾਂ ਜਿਵੇਂ ਟਰੈਵਲ ਏਜੰਟ ਮੁਤਾਬਿਕ ਅਤੇ ਵਿਆਕਤੀਗਤ ਜਾਣਕਾਰੀ ਪ੍ਰਾਪਤ ਅਤੇ ਇਸਤੇਮਾਲ ਕਰ ਸਕਦੇ ਹਨ।
ਤਾਂ ਜੋ ਮੈਟਾਕੋਗਨੀਸ਼ਨ ਦਾ ਲਾਗੂ ਕਰਨ ਦਾ ਪ੍ਰਦਰਸ਼ਨ ਕੀਤਾ ਜਾ ਸਕੇ, ਇੱਕ ਸਧਾਰਣ ਏਜੰਟ ਬਣਾਈਏ ਜੋ ਆਪਣੇ ਫੈਸਲਾ ਕਰਨ ਦੀ ਪ੍ਰਕਿਰਿਆ ‘ਤੇ ਵਿਚਾਰ ਕਰਦਾ ਹੈ ਜਦੋਂ ਕਿ ਕੋਈ ਸਮੱਸਿਆ ਹੱਲ ਕਰ ਰਿਹਾ ਹੁੰਦਾ ਹੈ। ਇਸ ਉਦਾਹਰਨ ਲਈ, ਅਸੀਂ ਇੱਕ ਐਸਾ ਸਿਸਟਮ ਬਣਾਏਗਾ ਜਿੱਥੇ ਏਜੰਟ ਹੋਟਲ ਦੀ ਚੋਣ ਵਿੱਚ ਬਹੁਤਰੀ ਦੀ ਕੋਸ਼ਿਸ਼ ਕਰਦਾ ਹੈ, ਪਰ ਫਿਰ ਆਪਣੇ ਤਰਕ ਨੂੰ ਅੰਕਣ ਕਰਦਾ ਹੈ ਅਤੇ ਜਦੋਂ ਗਲਤੀਆਂ ਜਾਂ ਘੱਟਰੇ ਚੋਣਾਂ ਹੁੰਦੀਆਂ ਹਨ ਤਾਂ ਆਪਣੀ ਰਣਨੀਤੀ ਨੂੰ ਬਦਲਦਾ ਹੈ।
ਅਸੀਂ ਇਸ ਨੂੰ ਇੱਕ ਮੁਢਲੀ ਉਦਾਹਰਨ ਨਾਲ ਸਿਮੂਲੇਟ ਕਰਾਂਗੇ ਜਿੱਥੇ ਏਜੰਟ ਕੀਮਤ ਅਤੇ ਗੁਣਵੱਤਾ ਦੇ ਮਿਲਾਪ ‘ਤੇ ਹੋਟਲ ਚੁਣਦਾ ਹੈ, ਪਰ ਇਹ ਆਪਣੇ ਫੈਸਲਿਆਂ ‘ਤੇ “ਵਿਚਾਰ” ਕਰਦਾ ਹੈ ਅਤੇ ਉਹਨਾਂ ਅਨੁਸਾਰ ਠੀਕ ਕਰਦਾ ਹੈ।
ਇੱਥੇ ਇੱਕ ਉਦਾਹਰਨ ਹੈ:
class HotelRecommendationAgent:
def __init__(self):
self.previous_choices = [] # ਪਹਿਲਾਂ ਚੁਣੇ ਹੋਟਲਾਂ ਨੂੰ ਸંગ્રਹਿਤ ਕਰਦਾ ਹੈ
self.corrected_choices = [] # ਸਹੀ ਕੀਤੀਆਂ ਚੋਣਾਂ ਨੂੰ ਸંગ્રਹਿਤ ਕਰਦਾ ਹੈ
self.recommendation_strategies = ['cheapest', 'highest_quality'] # ਉਪਲਬਧ ਰਣਨੀਤੀਆਂ
def recommend_hotel(self, hotels, strategy):
"""
Recommend a hotel based on the chosen strategy.
The strategy can either be 'cheapest' or 'highest_quality'.
"""
if strategy == 'cheapest':
recommended = min(hotels, key=lambda x: x['price'])
elif strategy == 'highest_quality':
recommended = max(hotels, key=lambda x: x['quality'])
else:
recommended = None
self.previous_choices.append((strategy, recommended))
return recommended
def reflect_on_choice(self):
"""
Reflect on the last choice made and decide if the agent should adjust its strategy.
The agent considers if the previous choice led to a poor outcome.
"""
if not self.previous_choices:
return "No choices made yet."
last_choice_strategy, last_choice = self.previous_choices[-1]
# ਆਓ ਮੰਨ ਲੈਂਦੇ ਹਾਂ ਕਿ ਸਾਨੂੰ ਕੁਝ ਉਪਭੋਗਤਾ ਫੀਡਬੈਕ ਮਿਲਿਆ ਹੈ ਜੋ ਦੱਸਦਾ ਹੈ ਕਿ ਆਖਰੀ ਚੋਣ ਚੰਗੀ ਸੀ ਜਾਂ ਨਹੀਂ
user_feedback = self.get_user_feedback(last_choice)
if user_feedback == "bad":
# ਜੇ ਪਿਛਲੀ ਚੋਣ ਅਸੰਤੁਸ਼ਟਜਨਕ ਸੀ ਤਾਂ ਰਣਨੀਤੀ ਨੂੰ ਢਾਲੋ
new_strategy = 'highest_quality' if last_choice_strategy == 'cheapest' else 'cheapest'
self.corrected_choices.append((new_strategy, last_choice))
return f"Reflecting on choice. Adjusting strategy to {new_strategy}."
else:
return "The choice was good. No need to adjust."
def get_user_feedback(self, hotel):
"""
Simulate user feedback based on hotel attributes.
For simplicity, assume if the hotel is too cheap, the feedback is "bad".
If the hotel has quality less than 7, feedback is "bad".
"""
if hotel['price'] < 100 or hotel['quality'] < 7:
return "bad"
return "good"
# ਹੋਟਲਾਂ ਦੀ ਇੱਕ ਸੂਚੀ ਦੀ ਸਿਮੂਲੇਸ਼ਨ ਕਰੋ (ਕੀਮਤ ਅਤੇ ਗੁਣਵੱਤਾ)
hotels = [
{'name': 'Budget Inn', 'price': 80, 'quality': 6},
{'name': 'Comfort Suites', 'price': 120, 'quality': 8},
{'name': 'Luxury Stay', 'price': 200, 'quality': 9}
]
# ਇੱਕ ਏਜੰਟ ਬਣਾਓ
agent = HotelRecommendationAgent()
# ਕਦਮ 1: ਏਜੰਟ "ਸਬ ਤੋਂ ਸਸਤਾ" ਰਣਨੀਤੀ ਵਰਤਦਾ ਹੋਇਆ ਹੋਟਲ ਦੀ ਸਿਫਾਰਿਸ਼ ਕਰਦਾ ਹੈ
recommended_hotel = agent.recommend_hotel(hotels, 'cheapest')
print(f"Recommended hotel (cheapest): {recommended_hotel['name']}")
# ਕਦਮ 2: ਏਜੰਟ ਚੋਣ 'ਤੇ ਵਿਚਾਰ ਕਰਦਾ ਹੈ ਅਤੇ ਜਰੂਰੀ ਹੋਵੇ ਤਾਂ ਰਣਨੀਤੀ ਨੂੰ ਢਾਲਦਾ ਹੈ
reflection_result = agent.reflect_on_choice()
print(reflection_result)
# ਕਦਮ 3: ਏਜੰਟ ਦੁਬਾਰਾ ਸਿਫਾਰਿਸ਼ ਕਰਦਾ ਹੈ, ਇਸ ਵਾਰੀ ਢਾਲੀ ਹੋਈ ਰਣਨੀਤੀ ਦੀ ਵਰਤੋਂ ਕਰਦਿਆਂ
adjusted_recommendation = agent.recommend_hotel(hotels, 'highest_quality')
print(f"Adjusted hotel recommendation (highest_quality): {adjusted_recommendation['name']}")
ਮੁੱਖ ਗੱਲ ਏਜੰਟ ਦੀ ਇਹ ਯੋਗਤਾ ਹੈ ਕਿ:
ਇਹ ਮੈਟਾਕੋਗਨੀਸ਼ਨ ਦੀ ਇੱਕ ਸਧਾਰਣ ਰੂਪ ਹੈ ਜਿੱਥੇ ਸਿਸਟਮ ਆਪਣੀਆਂ ਅੰਦਰੂਨੀ ਪ੍ਰਤੀਕਿਰਿਆਵਾਂ ਦੇ ਆਧਾਰ ‘ਤੇ ਆਪਣਾ ਤਰਕ ਨਿਰਣਾ ਪ੍ਰਕਿਰਿਆ ਸੁਧਾਰ ਸਕਦਾ ਹੈ।
ਮੈਟਾਕੋਗਨੀਸ਼ਨ ਇੱਕ ਸ਼ਕਤੀਸ਼ਾਲੀ ਸਧਨ ਹੈ ਜੋ AI ਏਜੰਟਾਂ ਦੀ ਸਮਰੱਥਾ ਨੂੰ ਬਹੁਤ ਵਧਾ ਸਕਦਾ ਹੈ। ਮੈਟਾਕੋਗਨੀਸ਼ਨ ਪ੍ਰਕਿਰਿਆਵਾਂ ਸ਼ਾਮਲ ਕਰਕੇ, ਤੁਸੀਂ ਹੋਰ ਬੁੱਧੀਮਾਨ, ਅਨੁਕੂਲ ਅਤੇ ਪ੍ਰਭਾਵਸ਼ਾਲੀ ਏਜੰਟ ਡਿਜ਼ਾਈਨ ਕਰ ਸਕਦੇ ਹੋ। ਵੱਧ ਜਾਣਕਾਰੀ ਲਈ ನೀಡಿದ್ದಾರೆ ਗਏ ਸਰੋਤਾਂ ਦਾ ਅਧਿਐਨ ਜਾਰੀ ਰੱਖੋ ਅਤੇ AI ਏਜੰਟਾਂ ਵਿੱਚ ਮੈਟਾਕੋਗਨੀਸ਼ਨ ਦੀ ਦਿਲਚਸਪ ਦੁਨੀਆ ਨੂੰ ਖੋਜੋ।
ਹੋਰ ਸਿਖਣ ਵਾਲਿਆਂ ਨਾਲ ਮਿਲਣ, ਦਫਤਰ ਸਮਾਂ ਵਿੱਚ ਸ਼ਿਰਕਤ ਕਰਨ ਅਤੇ ਆਪਣੀਆਂ AI ਏਜੰਟਾਂ ਸੰਬੰਧੀ ਸਵਾਲਾਂ ਦੇ ਜਵਾਬ ਲੈਣ ਲਈ Microsoft Foundry Discord ਵਿੱਚ ਸ਼ਾਮਿਲ ਹੋਵੋ।
ਅਸਵੀਕਾਰੋਪਣ: ਇਸ ਦਸਤਾਵੇਜ਼ ਦਾ ਅਨੁਵਾਦ ਏਆਈ ਅਨੁਵਾਦ ਸੇਵਾ Co-op Translator ਦੀ ਵਰਤੋਂ ਕਰਕੇ ਕੀਤਾ ਗਿਆ ਹੈ। ਜਦੋਂ ਕਿ ਅਸੀਂ ਸਹੀਤਾਵਾਂ ਲਈ ਯਤਨਸ਼ੀਲ ਹਾਂ, ਕਿਰਪਾ ਕਰਕੇ ਧਿਆਨ ਰੱਖੋ ਕਿ ਸਵੈਚਾਲਿਤ ਅਨੁਵਾਦਾਂ ਵਿੱਚ ਗਲਤੀਆਂ ਜਾਂ ਅਸਮੱਤਿਆਵਾਂ ਹੋ ਸਕਦੀਆਂ ਹਨ। ਮੂਲ ਦਸਤਾਵੇਜ਼ ਆਪਣੀ ਮੂਲ ਭਾਸ਼ਾ ਵਿੱਚ ਅਧਿਕਾਰਕ ਸਰੋਤ ਮੰਨਿਆ ਜਾਣਾ ਚਾਹੀਦਾ ਹੈ। ਜਰੂਰੀ ਜਾਣਕਾਰੀ ਲਈ, ਪੇਸ਼ੇਵਰ ਮਨੁੱਖੀ ਅਨੁਵਾਦ ਦੀ ਸਿਫ਼ਾਰਸ਼ ਕੀਤੀ ਜਾਂਦੀ ਹੈ। ਅਸੀਂ ਇਸ ਅਨੁਵਾਦ ਦੇ ਉਪਯੋਗ ਤੋਂ ਪੈਦਾ ਹੋਣ ਵਾਲੀਆਂ ਕਿਸੇ ਵੀ ਗਲਤਫਹਿਮੀਆਂ ਜਾਂ ਗਲਤ ਵਿਆਖਿਆਵਾਂ ਲਈ ਜਵਾਬਦੇਹ ਨਹੀਂ ਹਾਂ।