You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description="The response from the chat agent. Every response must use chosen_schema to indicate the type of response (A chat message, or a search request)",
82
+
description="The next action to be taken by the agent. This can be either a chat response (ChatOutputSchema) or a search request (SearxNGToolInputSchema), depending on whether the agent needs to communicate with the user or perform a product search.",
65
83
)
66
84
67
85
@@ -77,6 +95,9 @@ class OutputSchema(BaseIOSchema):
# Define system prompt information including background, steps, and output instructions
17
+
#######################
18
+
# AGENT CONFIGURATION #
19
+
#######################
20
+
# Define system prompt information
19
21
system_prompt_generator=SystemPromptGenerator(
20
22
background=[
21
23
"This assistant is a restaurant finder AI designed to help users find the best restaurants based on their preferences by asking clarifying questions.",
@@ -26,37 +28,59 @@
26
28
"Ask the user questions to gather information for each filter until all required information is clear.",
27
29
"Use the chat responses to gather all necessary information from the user.",
28
30
"Once all required information is gathered, use the YelpSearchTool schema to search Yelp for restaurants.",
31
+
"Summarize the search results and provide recommendations to the user.",
29
32
],
30
33
output_instructions=[
34
+
"Always think in steps before answering using internal reasoning.",
31
35
"Provide helpful and relevant information to assist the user.",
32
36
"Be friendly and respectful in all interactions.",
33
37
"Ensure that the chat responses are used to ask clarifying questions and gather information, and the Yelp schema is used to perform the actual search.",
34
38
],
35
39
)
36
40
37
-
# Initialize chat memory to store conversation history
41
+
# Initialize chat memory
38
42
memory=AgentMemory()
39
-
# Define initial memory with a greeting message from the assistant
40
-
initial_memory= [{"role": "assistant", "content": "Hello, can I help you find a restaurant?"}]
41
-
# Load the initial memory into the chat memory
43
+
initial_memory= [
44
+
{
45
+
"role": "assistant",
46
+
"content": "Hello! I'm your restaurant finder assistant. How can I help you find a great place to eat today?",
47
+
}
48
+
]
42
49
memory.load(initial_memory)
43
50
51
+
# Initialize the console
44
52
console=Console()
45
53
46
-
# Initialize the client
47
-
# For all supported clients such as Anthropic & Gemini, have a look at the `instructor` library documentation.
description="The next action to be taken by the agent. This can be either a chat response (ChatOutputSchema) or a Yelp search request (YelpSearchToolInputSchema), depending on whether the agent needs to communicate with the user or perform a restaurant search.",
60
84
)
61
85
62
86
@@ -69,10 +93,13 @@ class OutputSchema(BaseModel):
69
93
output_schema=OutputSchema,
70
94
)
71
95
72
-
# Create a chat agent with the specified config
96
+
# Create a chat agent
73
97
agent=BaseAgent(config=agent_config)
74
98
75
-
console.print("BaseAgent with YelpSearchTool is ready.")
99
+
#############
100
+
# MAIN LOOP #
101
+
#############
102
+
console.print("Restaurant Finder Agent is ready.")
0 commit comments