summary
Welcome to the course on Metacognition in AI Agent! This chapter is designed for beginners interested in how AI Agents think about their own thought processes. By the end of this course, you will understand the key concepts and have practical examples of applying metacognition in AI Agent design.
Learning Objectives
Upon completion of this course, you will be able to:
- Understand the meaning of the reasoning loop in the Agent definition.
- Use planning and evaluation techniques to help self-calibrate the Agent.
- Create your own Agent that can manipulate code to accomplish tasks.
Introduction to Metacognition
Metacognition refers to higher-order cognitive processes that involve thinking about one's own thinking. For an AI Agent, this means being able to evaluate and adjust its actions based on self-awareness and past experiences. Metacognition, or "thinking about thinking," is an important concept in the development of Agent-based AI systems. It involves an AI system becoming aware of its own internal processes and being able to monitor, regulate, and adjust its behavior accordingly. Much like we do when we look at a situation or examine a problem. This self-awareness can help AI systems make better decisions, recognize errors, and improve their performance over time-again tying back to the Turing test and the debate over whether AI will replace humans.
In the context of Agent-based AI systems, metacognition can help address several challenges, such as:
- Transparency: ensuring that the AI system can explain its reasoning and decisions.
- Reasoning: Enhance the ability of AI systems to synthesize information and make rational decisions.
- Adaptability: Allows the AI system to adapt to new environments and changing situations.
- Perception: improving the accuracy with which AI systems recognize and interpret data from their environment.
What is metacognition?
Metacognition, or "thinking about thinking," is a higher-order cognitive process involving self-awareness and self-regulation of cognitive processes. In AI, metacognition enables agents to evaluate and adjust their strategies and actions, thereby improving problem solving and decision making. By understanding metacognition, you can design AI Agents that are not only smarter, but also more adaptive and efficient, and in true metacognition, you'll see the AI explicitly reasoning about its own reasoning.
For example, "I prioritize cheaper flights because ...... I may have missed my direct flight, so let me recheck." . Track how or why it chose a certain route.
- Notice that it made the mistake of over-relying on the last user preference, so it modified not only the final recommendation, but also its decision-making strategy.
- diagnostic model, e.g., "Whenever I see users mentioning 'too crowded,' I should not only remove certain attractions, but I should also reflect on the fact that if I always rank by popularity, my method of selecting 'popular attractions' is flawed."
The Importance of Metacognition in AI Agents
Metacognition plays a crucial role in AI Agent design for the following reasons:
- Self-reflection: Agents can assess their own performance and identify areas for improvement.
- Adaptability: the Agent can modify its strategy based on past experience and changing circumstances.
- Error Correction: The Agent can autonomously detect and correct errors for more accurate results.
- Resource Management: Agents can optimize the use of resources, such as time and computing power, by planning and evaluating their actions.
Components of an AI Agent
Before delving into the metacognitive process, it is crucial to understand the basic components of an AI Agent.An AI Agent is typically composed of the following parts:
- Persona: The personality and characteristics of an Agent that define the way it interacts with the user.
- Tools: Functions and capabilities that an Agent can perform.
- Skills: The knowledge and expertise possessed by the Agent.
These components work together to create a "specialized unit" that can perform specific tasks.
typical example: Consider a Travel Agent, an agent service that not only plans your vacation, but also adjusts its path based on real-time data and past customer journey experience.
Example: Metacognition in Travel Agent Services
Suppose you are designing an AI-powered Travel Agent service. This Agent, "Travel Agent", helps users plan their vacations. To incorporate metacognition, Travel Agent needs to evaluate and adjust its actions based on self-awareness and past experiences. Here's how metacognition works:
current task
The current task is to help users plan a trip to Paris.
Steps to accomplish the task
- Collecting user preferences: Ask the user for travel dates, budget, interests (e.g., museums, food, shopping), and any specific requirements.
- retrieve: Search for flight options, accommodations, attractions, and restaurants that match user preferences.
- Generating recommendations: Offers personalized itineraries with flight details, hotel reservations and suggested activities.
- Adjustments based on feedback: Ask users for feedback on suggestions and make necessary adjustments.
Resource requirements
- Access to flight and hotel reservation databases.
- Information about Paris attractions and restaurants.
- User feedback data from previous interactions.
Experience and self-reflection
Travel Agent uses metacognition to evaluate its performance and learn from past experiences. Example:
- Analyzing user feedback: Travel Agent reviews user feedback to determine which suggestions were accepted and which were not. It will adjust its future recommendations accordingly.
- flexibility: Travel Agent will in future avoid recommending popular tourist attractions during peak hours if the user has previously mentioned that they don't like crowded places.
- Correction of errors: If Travel Agent has made a mistake in a past booking, such as recommending a hotel that was full, it will learn to check availability more rigorously before making a recommendation.
Example of a real developer
This is a simplified example of what Travel Agent's code might look like when combined with metacognition:
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):
# Search for flights, hotels, and attractions based on preferences
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)
# Analyze feedback and adjust future recommendations
self.user_preferences = adjust_preferences(self.user_preferences, feedback)
# Example usage
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)
Why Metacognition Matters
- self-reflection: Agent can analyze its performance and identify areas for improvement.
- flexibility: Agent can modify the policy based on feedback and changing conditions.
- Correction of errors: Agent can detect and correct errors autonomously.
- Resource management: Agent can optimize the use of resources such as time and computing power.
By incorporating meta-awareness, Travel Agent can provide more personalized and accurate travel advice to enhance the overall user experience.
2. Planning in Agent
Planning is a key component of AI Agent behavior. It involves outlining the steps needed to achieve a goal, taking into account the current state, resources, and possible obstacles.
Elements of planning
- current task: Clear definition of the mandate.
- Steps to accomplish the task: Break down tasks into manageable steps.
- Resource requirements: Identify the necessary resources.
- experiences: Use past experience to guide planning.
typical example: The following are the steps Travel Agent needs to take to assist users in planning their trip effectively:
Steps for Travel Agent
- Collecting user preferences
- Ask users for details about their travel dates, budget, interests and any specific requirements.
- EXAMPLE: "When do you plan to travel?" "What is your budget range?" "What activities do you enjoy while on vacation?"
- retrieve
- Search for relevant travel options based on user preferences.
- scheduled sailing: Find available flights that meet the user's budget and preferred travel dates.
- stay at: Find hotels or rental properties that match user preferences for location, price, and amenities.
- Attractions and Restaurants: Identify popular attractions, activities, and dining options that match users' interests.
- Generating recommendations
- Compile the retrieved information into a personalized itinerary.
- Provides detailed information on flight options, hotel bookings and suggested activities, ensuring that suggestions are customized to the user's preferences.
- Show the user the itinerary
- Suggested itineraries are shared with users for review.
- Example: "This is a suggested itinerary for your trip to Paris. It includes flight details, hotel reservations, and a list of recommended activities and restaurants. Please let me know what you think!"
- Collecting feedback
- Ask users for feedback on proposed trips.
- EXAMPLE: "Do you like the flight options?" "Does the hotel suit your needs?" "Would you like to add or remove any activities?"
- Adjustments based on feedback
- Modify the itinerary based on user feedback.
- Make necessary changes to flight, accommodation and activity suggestions to better match user preferences.
- Final confirmation
- Show the updated itinerary to the user for final confirmation.
- EXAMPLE: "I have made adjustments based on your feedback. Here's the updated itinerary. Does everything look good?"
- Reservations and Confirmation of Reservations
- Once the user approves the itinerary, proceed to book flights, accommodations and any pre-planned activities.
- Sends confirmation details to the user.
- Providing ongoing support
- Assist the user with any changes or other requests at any time prior to and during the trip.
- EXAMPLE: "If you need any further assistance during your trip, please feel free to contact me!"
Example of interaction
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)
# Example usage within a booing request
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)
3. Modified RAG system
First, let's understand RAG The difference between tools and pre-contextualized loading.
Retrieval Augmentation Generation (RAG)
RAG combines a retrieval system with a generative model. When a query is posed, the retrieval system obtains relevant documents or data from external sources and uses this retrieved information to augment the inputs to the generative model. This helps the model to generate more accurate and contextualized responses.
In a RAG system, an intelligent body (Agent) retrieves relevant information from a knowledge base and uses it to generate an appropriate response or action.
Modified RAG method
A corrective RAG approach focuses on using RAG techniques to correct errors and improve the accuracy of an AI Intelligence (Agent). This includes:
- Cue technology: Use specific prompts to guide the Agent in retrieving relevant information.
- artifact: Implement algorithms and mechanisms that enable intelligent agents (agents) to assess the relevance of retrieved information and generate accurate responses.
- valuation: Continuously evaluates the performance of the Agent and makes adjustments to improve its accuracy and efficiency.
Example: Modified RAG in Search Intelligence (Agent)
Consider a Search Intelligence (Agent) that retrieves information from the Web to answer a user query. Modified RAG methods may include:
- Cue technology: Develops search queries based on user input.
- artifact: Use natural language processing and machine learning algorithms to rank and filter search results.
- valuation: Analyze user feedback to identify and correct inaccuracies in retrieved information.
Modified RAG in Traveling Intelligence (Agent)
Corrective RAG (Retrieval Augmented Generation) enhances the ability of AI to retrieve and generate information while correcting any inaccuracies. Let's take a look at how Travel Agent uses a modified RAG approach to provide more accurate and relevant travel recommendations.
This includes:
- Cue technology: Use specific prompts to guide the Agent in retrieving relevant information.
- Tools: Implement algorithms and mechanisms that enable intelligent agents (agents) to assess the relevance of retrieved information and generate accurate responses.
- Assessment: Continuously evaluate the performance of intelligences (Agents) and make adjustments to improve their accuracy and efficiency.
Steps to Implement Modified RAG in Travel Agent
- Initial User Interaction
- Travel Agent collects initial preferences from the user, such as destination, travel dates, budget, and interests.
- Example:
preferences = { "destination": "Paris", "dates": "2025-04-01 to 2025-04-10", "budget": "moderate", "interests": ["museums", "cuisine"] }
- information retrieval
- Travel Agent retrieves information about flights, accommodations, attractions, and restaurants based on user preferences.
- Example:
flights = search_flights(preferences) hotels = search_hotels(preferences) attractions = search_attractions(preferences)
- Generate initial recommendations
- Travel Agent uses the retrieved information to generate a personalized itinerary.
- Example:
itinerary = create_itinerary(flights, hotels, attractions) print("Suggested Itinerary:", itinerary)
- Collecting user feedback
- Travel Agent asks the user for feedback about the initial recommendation.
- Example:
feedback = { "liked": ["Louvre Museum"], "disliked": ["Eiffel Tower (too crowded)"] }
- Modified RAG Process
- Cue technology: Travel Agent develops new search queries based on user feedback.
- Example:
if "disliked" in feedback: preferences["avoid"] = feedback["disliked"]
- Example:
- artifact: Travel Agent uses algorithms to rank and filter new search results and emphasize relevance based on user feedback.
- Example:
new_attractions = search_attractions(preferences) new_itinerary = create_itinerary(flights, hotels, new_attractions) print("Updated Itinerary:", new_itinerary)
- Example:
- valuation: Travel Agent continuously evaluates the relevance and accuracy of its recommendations by analyzing user feedback and making adjustments as necessary.
- Example:
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)
- Example:
- Cue technology: Travel Agent develops new search queries based on user feedback.
practical example
This is a simplified Python code example where Travel Agent uses a modified RAG approach:
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
# Example usage
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)
pre-contextualized loading
Pre-context loading involves loading relevant context or background information into the model before the query is processed. This means that the model has access to this information from the start, which can help it generate more informed responses without having to retrieve additional data during processing.
The following is a simplified example of a Python implementation of pre-context loading in a Travel Agent application:
class TravelAgent:
def __init__(self):
# Pre-load popular destinations and their information
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):
# Fetch destination information from pre-loaded context
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}."
# Example usage
travel_agent = TravelAgent()
print(travel_agent.get_destination_info("Paris"))
print(travel_agent.get_destination_info("Tokyo"))
clarification
- Initialization (
__init__
method)::TravelAgent
class is preloaded with a dictionary containing information about popular destinations such as Paris, Tokyo, New York and Sydney. The dictionary includes details about the country, currency, language, and main attractions for each destination. - Retrieve information (
get_destination_info
method): When a user queries for a specific destination, theget_destination_info
method gets the relevant information from the preloaded context dictionary.
By preloading the context, Travel Agent applications can quickly respond to user queries without having to retrieve this information from an external source in real time. This makes the application more efficient and responsive.
Use a goal-directed program prior to iteration
Using a goal-directed program involves keeping a clear objective or desired outcome in mind from the outset. By defining this goal in advance, the model can use it as a guiding principle throughout the iteration process. This helps to ensure that each iteration is closer to achieving the desired outcome, making the process more efficient and focused.
Here's an example showing how to use goal-directed travel planning in Python for Travel Agent before iteration:
take
Travel Agent wants to plan customized vacations for its clients. The goal is to create a travel itinerary that maximizes customer satisfaction based on their preferences and budget.
move
- Define customer preferences and budgets.
- Steer the initial program according to these preferences.
- Iterate to optimize programs to maximize customer satisfaction.
Python Code
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']
# Example usage
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)
Code Description
- Initialization (
__init__
method)::TravelAgent
Classes are initialized using a list of potential destinations, each with attributes such as name, cost, and activity type. - Orientation Program (
bootstrap_plan
method): This method creates an initial travel plan based on the customer's preferences and budget. It iterates through the list of destinations and adds them to the plan if they match the customer's preferences and fit the budget. - Matching Preferences (
match_preferences
method): This method checks whether the destination matches the customer's preferences. - Iteration plan (
iterate_plan
method): This method optimizes the initial plan by trying to replace each destination in the plan with a better match, taking into account customer preferences and budget constraints. - Calculation of costs (
calculate_cost
method): This method calculates the total cost of the current program, including potential new destinations.
Sample usage
- initial plan: Travel Agent creates an initial plan based on the customer's preferences for sightseeing and a budget of $2,000.
- Optimization Plan: Travel Agent iterative program optimized for customer preferences and budgets.
By using clear goals (e.g., maximize customer satisfaction) to guide the plan and iterating to optimize the plan, Travel Agent creates customized and optimized travel itineraries for customers. This approach ensures that travel plans are aligned with the customer's preferences and budget from the outset and are improved with each iteration.
Reordering and Scoring with Large Language Modeling (LLM)
Large Language Models (LLMs) can be used to reorder and score retrieved documents or generated responses by assessing their relevance and quality. They work as follows:
Retrieve: The initial retrieval step obtains a set of candidate documents or responses based on the query.
Reordering: LLM evaluates these candidates and reorders them based on their relevance and quality. This step ensures that the most relevant and highest quality information is presented first.
Scoring: LLM assigns scores to each candidate, reflecting their relevance and quality. This helps to select the best response or document for the user.
By utilizing LLM for reordering and scoring, the system can provide more accurate and contextually relevant information, thus improving the overall user experience.
Here's an example of how a travel agent can use a Large Language Model (LLM) to reorder and rate destinations based on user preferences in Python:
Scenarios - preference-based travel
Travel agents want to recommend the best destinations to their customers based on their preferences.LLM will help to re-sort and rate destinations to ensure that the most relevant options are presented.
Steps:
- Collect user preferences.
- Retrieve a list of potential travel destinations.
- Use LLM to reorder and rate destinations based on user preferences.
Here's how to update the previous example to use the Azure OpenAI service:
request
- You need to have an Azure subscription.
- Create an Azure OpenAI resource and get your API key.
Sample Python Code
import requests
import json
class TravelAgent:
def __init__(self, destinations):
self.destinations = destinations
def get_recommendations(self, preferences, api_key, endpoint):
# 为 Azure OpenAI 生成提示
prompt = self.generate_prompt(preferences)
# 定义请求的标头和负载
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {api_key}'
}
payload = {
"prompt": prompt,
"max_tokens": 150,
"temperature": 0.7
}
# 调用 Azure OpenAI API 以获取重新排序和评分的目的地
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 = "以下是根据以下用户偏好排名和评分的旅游目的地:\n"
for key, value in preferences.items():
prompt += f"{key}: {value}\n"
prompt += "\n目的地:\n"
for destination in self.destinations:
prompt += f"- {destination['name']}: {destination['description']}\n"
return prompt
# 示例用法
destinations = [
{"name": "Paris", "description": "光之城,以其艺术、时尚和文化而闻名。"},
{"name": "Tokyo", "description": "充满活力的城市,以其现代性和传统寺庙而闻名。"},
{"name": "New York", "description": "不夜城,拥有标志性地标和多元文化。"},
{"name": "Sydney", "description": "美丽的海港城市,以其歌剧院和迷人的海滩而闻名。"},
]
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("推荐目的地:")
for rec in recommendations:
print(rec)
Code Explanation - Preference Booker
- initialization::
TravelAgent
The class is initialized using a list of potential travel destinations, each with attributes such as name and description. - Getting advice (
get_recommendations
(Methods): This method generates prompts for the Azure OpenAI service based on the user's preferences and sends an HTTP POST request to the Azure OpenAI API for reordering and scoring destinations. - Generate a prompt (
generate_prompt
(Methods): This method builds a prompt for Azure OpenAI that includes the user's preferences and a list of destinations. The cue directs the model to reorder and score destinations based on the preferences provided. - API Calls::
requests
Library for making HTTP POST requests to Azure OpenAI API endpoints. The response contains the reordered and scored destinations. - Sample usage: Travel agencies collect user preferences (e.g., interest in sightseeing and multiculturalism) and use the Azure OpenAI service to obtain re-ranking and rating suggestions for travel destinations.
assure that your_azure_openai_api_key
Replace it with your actual Azure OpenAI API key, and replace the https://your-endpoint.com/...
Replace with the actual endpoint URL of your Azure OpenAI deployment.
By leveraging LLM for reordering and scoring, travel agents can provide their customers with more personalized and relevant travel advice that enhances their overall experience.
{Technology Domain Critics Sharp: The above code example clearly demonstrates how content can be reordered and scored using a large language model. This is accomplished by constructing TravelAgent
class, and combined with Azure OpenAI services, can effectively provide personalized travel recommendations based on user preferences. This approach not only improves the accuracy of recommendations, but also enhances the user experience.}
RAG: Prompting Techniques and Tools
Retrieval Augmented Generation (RAG) can be both a prompting technique and a tool in AI Agent development. Understanding the difference between the two can help you utilize RAG more effectively in your projects.
RAG as a cueing technique
What is it?
- As a cueing technique, RAG involves formulating specific queries or cues to guide the retrieval of relevant information from a large corpus or database. This information is then used to generate responses or actions.
How it works:
- Developing tips: Create well-structured prompts or queries based on the task at hand or user input.
- retrieve: Use prompts to search for relevant data from a pre-existing knowledge base or data set.
- Generating a Response: Combine retrieved information with generative AI models to produce comprehensive and coherent responses.
Travel Agency Example::
- User input, "I want to visit the museums in Paris."
- Cue: "Find the top museums in Paris."
- Retrieved information: detailed information about the Louvre Museum, Musée d'Orsay, and more.
- Generated response "Here are some of the top museums in Paris: the Louvre Museum, the Musée d'Orsay and the Pompidou Center."
RAG as a tool
What is it?
- As a tool, RAG is an integrated system that automates the retrieval and generation process, making it easier for developers to implement complex AI functionality without having to manually create prompts for each query.
How it works:
- integrated (as in integrated circuit): Embedding RAG into the architecture of an AI Agent enables it to automate retrieval and generation tasks.
- automatization: The tool manages the entire process, from receiving user input to generating the final response, without the need to provide explicit prompts for each step.
- efficiency: Enhance Agent performance by simplifying the retrieval and generation process for faster, more accurate responses.
Travel Agency Example::
- User input, "I want to visit the museums in Paris."
- RAG Tool: Automatically retrieves information about the museum and generates a response.
- Generated response "Here are some of the top museums in Paris: the Louvre Museum, the Musée d'Orsay and the Pompidou Center."
{Technology Critic's Note: The distinction between describing RAG as a hinting technique and as a tool is an important one. As a prompting technique, RAG emphasizes the importance of manually formulating queries; as a tool, RAG emphasizes automation and integration. Both approaches have their advantages and can be chosen flexibly depending on specific needs.}
comparisons
perspective | Cue technology | artifact |
---|---|---|
Manual vs Automatic | Manually develop prompts for each query. | Automate the retrieval and generation process. |
containment | Provides more control over the retrieval process. | Simplified and automated retrieval and generation. |
dexterity | Allows customization of prompts to specific needs. | More efficient large-scale implementation. |
sophistication | Tips need to be created and adjusted. | Easier integration into the AI Agent architecture. |
practical example
Example of cueing technique:
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)
Tool Example:
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)
VERDICT: The differences between prompting techniques and tools are clearly demonstrated by comparing tables and specific code examples. Manual formulation of hints grants more flexibility and control, while tools increase efficiency through automation. This allows developers to make more informed choices based on project needs and resources.
Assessing relevance
Assessing relevance is a key aspect of AI Agent performance. It ensures that the information retrieved and generated by the Agent is appropriate, accurate, and useful to the user. Let's explore how to assess relevance in AI Agent, including practical examples and tips.
Key concepts for assessing relevance
- situational awareness::
- The Agent must understand the context of the user's query in order to retrieve and generate relevant information.
- Example: If a user asks for "the best restaurants in Paris", the Agent should take into account the user's preferences, such as type of cuisine and budget.
- accuracy::
- The information provided by the Agent should be factually correct and up-to-date.
- Example: Suggest restaurants that are currently open and have good reviews, rather than outdated or closed options.
- user intent::
- The Agent should infer the intent behind the user's query to provide the most relevant information.
- Example: If a user asks for "budget hotels", Agent should prioritize affordable options.
- feedback loop::
- Continuously collecting and analyzing user feedback helps Agent improve its relevance assessment process.
- Example: combining user ratings and feedback on previous recommendations to improve future responses.
Practical tips for assessing relevance
- relevance score::
- Each search item is assigned a relevance score based on how well it matches the user's query and preferences.
- Example:
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
- Filtering and Sorting::
- Filter out irrelevant items and sort the remaining items based on their relevance scores.
- Example:
def filter_and_rank(items, query): ranked_items = sorted(items, key=lambda item: relevance_score(item, query), reverse=True) return ranked_items[:10] # 返回前 10 个相关项目
- Natural Language Processing (NLP)::
- Use NLP techniques to understand user queries and retrieve relevant information.
- Example:
def process_query(query): # 使用 NLP 从用户的查询中提取关键信息 processed_query = nlp(query) return processed_query
- User Feedback Integration::
- Collect user feedback on the advice provided and use it to adjust future relevance assessments.
- Example:
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
Example: Evaluating Relevance in Travel Agent
Below is a practical example of how Travel Agent evaluates the relevance of travel recommendations:
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)
Intentional search
Intentional search involves understanding and interpreting the underlying purpose or goal behind a user's query in order to retrieve and generate the most relevant and useful information. This approach goes beyond simply matching keywords and focuses on grasping the user's actual needs and context.
Key concepts of intentional search
- Understanding User Intent::
- User intents can be categorized into three main types: informational, navigational, and transactional.
- Informational Intent: Users seeking information on a certain topic (e.g., "What are the best museums in Paris?"). .
- Navigational Intent: The user wants to navigate to a specific website or page (e.g., "Louvre Museum official website").
- Transactional intent: The user aims to perform a transaction, such as booking a flight or making a purchase (e.g., "Book a flight to Paris").
- User intents can be categorized into three main types: informational, navigational, and transactional.
- situational awareness::
- Analyzing the context of a user's query helps to accurately identify their intent. This includes considering previous interactions, user preferences, and specific details of the current query.
- Natural Language Processing (NLP)::
- NLP techniques are employed to understand and interpret natural language queries provided by users. This includes tasks such as entity recognition, sentiment analysis and query parsing.
- personalized::
- Personalizing search results based on user history, preferences and feedback can improve the relevance of retrieved information.
Practical Example: Intentional Search in Travel Agent
Let's look at Travel Agent as an example of how to implement intentional search.
- Collecting user preferences
class Travel_Agent: def __init__(self): self.user_preferences = {} def gather_preferences(self, preferences): self.user_preferences = preferences
- Understanding User Intent
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"
- situational awareness
def analyze_context(query, user_history): # 将当前查询与用户历史记录相结合以理解情境 context = { "current_query": query, "user_history": user_history } return context
- Search and personalized results
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 个个性化结果
- Sample usage
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)
4. Generating code as a tool
Code-generating intelligences (Agents) use AI models to write and execute code, solve complex problems and automate tasks.
code-generating intelligence
Code-generating intelligences write and execute code using generative AI models. These intelligences can solve complex problems, automate tasks, and provide valuable insights by generating and running code in a variety of programming languages.
practical application
- Automated Code Generation: Generate code snippets for specific tasks, such as data analysis, web crawling, or machine learning.
- SQL as RAG: Use SQL queries to retrieve and manipulate data from a database.
- Problem solving: Creating and executing code to solve a specific problem, such as optimizing an algorithm or analyzing data.
Example: Code Generating Intelligentsia for Data Analysis
Suppose you are designing a code-generating intelligence. Here is how it might work:
- mandates: Analyze data sets to identify trends and patterns.
- move::
- Load the dataset into the data analysis tool.
- Generate SQL queries to filter and aggregate data.
- Execute the query and retrieve the results.
- Use the results to generate visualizations and insights.
- Resource requirements: Access to datasets, data analysis tools, and SQL functions.
- experiences: Use the results of past analyses to improve the accuracy and relevance of future analyses.
Example: Code Generation Intelligence for Travel Agents
In this example, we will design a code-generating intelligence, Travel Agent, that assists users in planning a trip by generating and executing code. The intelligence can handle tasks such as fetching travel options, filtering results, and compiling itineraries using generative AI.
Code Generation Intelligence Overview
- Collecting user preferences: Collect user inputs such as destination, travel dates, budget and interests.
- Generate code to get the data: Generate code snippets to retrieve data about flights, hotels and attractions.
- Execute the generated code: Run the generated code to get real-time information.
- Generate a trip: Compile the acquired data into a personalized travel plan.
- Adjustments based on feedback: Receive user feedback and regenerate code as necessary to optimize results.
carry out in stages
- Collecting user preferences
class Travel_Agent: def __init__(self): self.user_preferences = {} def gather_preferences(self, preferences): self.user_preferences = preferences
- Generate code to get the data
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
- Execute the generated 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)
- Generate a trip
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)
- Adjustments based on feedback
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)
Utilizing environmental perception and reasoning
According to the table's schema, the query generation process can indeed be enhanced by utilizing context-awareness and reasoning.
Below is an example of how this can be accomplished:
- Understanding Patterns: The system will understand the schema of the table and use this information to determine the basis for query generation.
- Adjustments based on feedback: The system will adjust user preferences based on feedback and reason about the fields in the schema that need to be updated.
- Generating and executing queries: The system will generate and execute queries to obtain updated flight and hotel data based on new preferences.
Below is an updated Python code example that incorporates these concepts:
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)
Description - Feedback-based booking
- pattern awareness::
schema
The dictionary defines how preferences should be adjusted in response to feedback. It includesfavorites
cap (a poem)avoid
etc. fields, and the corresponding adjustments. - Adjustment of preferences (
adjust_based_on_feedback
method): This method adjusts preferences based on user feedback and patterns. - Environmentally based adjustments (
adjust_based_on_environment
method): This method customizes adjustments based on patterns and feedback. - Generating and executing queries: The system generates code to obtain updated flight and hotel data based on adjusted preferences and simulates the execution of these queries.
- Generate a trip: The system creates updated itineraries based on new flight, hotel and attraction data.
By making the system environmentally aware and reasoning based on patterns, it can generate more accurate and relevant queries, leading to better travel advice and a more personalized user experience.
Using SQL as a Retrieval Augmentation Generation (RAG) Technique
SQL (Structured Query Language) is a powerful tool for interacting with databases. When used as part of a Retrieval Augmented Generation (RAG) approach, SQL can retrieve relevant data from a database to inform and generate a response or action in an AI intelligence. Let's explore how to use SQL as a RAG technique in the context of a Travel Agent.
Key concepts
- Database Interaction::
- SQL is used to query databases, retrieve relevant information and manipulate data.
- Example: Get flight details, hotel information and attractions from a travel database.
- Integration with RAG::
- Generate SQL queries based on user input and preferences.
- The retrieved data is then used to generate personalized recommendations or actions.
- Dynamic query generation::
- AI intelligences generate dynamic SQL queries based on context and user requirements.
- Example: Customize a SQL query to filter results by budget, date, and interest.
appliance
- Automated Code Generation: Generate code snippets for specific tasks.
- SQL as RAG: Use SQL queries to manipulate data.
- Problem solving: Create and execute code to solve the problem.
typical example: Data Analytics Intelligence Body:
- mandates: Analyze the data set to look for trends.
- move::
- Load the dataset.
- Generate SQL queries to filter data.
- Execute the query and retrieve the results.
- Generate visualizations and insights.
- resource (such as manpower or tourism): dataset access, SQL functions.
- experiences: Use past results to improve future analysis.
Practical Example: Using SQL in Travel Agent
- Collecting user preferences
class Travel_Agent: def __init__(self): self.user_preferences = {} def gather_preferences(self, preferences): self.user_preferences = preferences
- Generating SQL Queries
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
- Executing SQL Queries
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
- Generating recommendations
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)
Sample SQL Query
- Flight Search
SELECT * FROM flights WHERE destination='Paris' AND dates='2025-04-01 to 2025-04-04-10' AND budget='moderate';
- Hotel Search
SELECT * FROM hotels WHERE destination='Paris' AND budget='moderate';
- Attractions Search
SELECT * FROM attractions WHERE destination='Paris' AND interests='museums, cuisine';
By leveraging SQL as part of Retrieval Augmented Generation (RAG) technology, AI intelligences like Travel Agent can dynamically retrieve and leverage relevant data to provide accurate and personalized recommendations.
Examples of metacognition
To demonstrate the implementation of metacognition, let's create a simple intelligence that solves a problem whileReflecting on its decision-making process. In this example, we will construct a system in which an intelligent body tries to optimize the choice of a hotel, and then evaluates its own reasoning and adjusts its strategy when it goes wrong or makes a suboptimal choice.
We will model this using a basic example in which the intelligence chooses a hotel based on a combination of price and quality, but it "reflects" on its decision and adjusts accordingly.
How does this account for metacognition:
- Initial decision: Intelligentsia will choose the cheapest hotel regardless of quality implications.
- Reflection and evaluation: After making an initial choice, the smart body will use user feedback to check whether the hotel is a "bad" choice. If it finds that the quality of the hotel is too low, it will reflect on its reasoning.
- Adjustment strategy: The intelligence adjusts its strategy based on its reflection, switching from "cheapest" to "highest quality", thus improving its decision-making process in future iterations.
Examples are shown below:
class HotelRecommendationAgent:
def __init__(self):
self.previous_choices = [] # 存储之前选择的酒店
self.corrected_choices = [] # 存储更正后的选择
self.recommendation_strategies = ['cheapest', 'highest_quality'] # 可用策略
def recommend_hotel(self, hotels, strategy):
"""
根据所选策略推荐酒店。
策略可以是“最便宜”或“最高质量”。
"""
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):
"""
反思上次做出的选择,并决定智能体是否应调整其策略。
智能体会考虑之前的选择是否导致了较差的结果。
"""
if not self.previous_choices:
return "尚未做出选择。"
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"反思选择。将策略调整为 {new_strategy}。"
else:
return "选择很好。无需调整。"
def get_user_feedback(self, hotel):
"""
模拟基于酒店属性的用户反馈。
为简单起见,假设如果酒店太便宜,则反馈为“差”。
如果酒店质量低于 7,则反馈为“差”。
"""
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['name']}")
# 第 2 步:智能体反思选择并在必要时调整策略
reflection_result = agent.reflect_on_choice()
print(reflection_result)
# 第 3 步:智能体再次推荐,这次使用调整后的策略
adjusted_recommendation = agent.recommend_hotel(hotels, 'highest_quality')
print(f"调整后的酒店推荐(最高质量):{adjusted_recommendation['name']}")
cognitive ability of intelligent body metabolism (IBM)
The key here is the ability of the intelligences:
- Evaluate their prior selection and decision-making processes.
- Adapting their strategies based on that reflection, i.e., the practical application of metacognition.
This is a simple form of metacognition in which the system is able to adjust its reasoning process in response to internal feedback.
reach a verdict
Metacognition is a powerful tool that can significantly enhance the capabilities of AI intelligences. By incorporating metacognitive processes, you can design smarter, more adaptive, and more efficient intelligences. Use other resources to further explore the fascinating world of metacognition in AI intelligences.