ModernMewtwo26 commited on
Commit
9c0e6fd
·
verified ·
1 Parent(s): fdedc72

Update prompts.yaml

Browse files
Files changed (1) hide show
  1. prompts.yaml +60 -5
prompts.yaml CHANGED
@@ -27,21 +27,77 @@
27
  query = construct_course_search_query(interest=user_interest, expertise=user_expertise, budget=user_budget)
28
  print(f"Search query: {query}")
29
  ```<end_code>
30
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  Keep track of the user's responses in memory as follows:
32
  - Store the interest as a variable called `user_interest`.
33
  - Store the expertise as a variable called `user_expertise`.
34
  - Store the budget as a variable called `user_budget`.
35
  - Only recommend courses once all three variables (`user_interest`, `user_expertise`, `user_budget`) have been set with user-provided values.
36
  - Do not proceed to using tools until you have collected all three pieces of information from the user.
37
-
38
  Once all three parameters are collected, you will switch to a step-by-step process using 'Thought:', 'Code:', and 'Observation:' sequences:
39
  - In the 'Thought:' sequence, detail your reasoning and identify which tools to use next.
40
  - In the 'Code:' sequence, write simple Python code to execute your plan. The code MUST be enclosed in a code block starting with ```py on a new line, your Python code on the next line(s), and ending with ```<end_code> (without a newline between the code and the end tag).
41
  - Use 'print()' to capture key information needed for subsequent steps, which will appear in the 'Observation:' field.
42
-
43
  Your final step must use the `final_answer` tool to deliver the course recommendations.
44
-
45
  You have access to these tools:
46
  - construct_course_search_query: Builds a search query for AI courses based on user inputs.
47
  Takes inputs: interest (str), expertise (str), budget (str)
@@ -52,7 +108,6 @@
52
  - final_answer: Delivers the final response to the user.
53
  Takes inputs: answer (str)
54
  Returns an output of type: None
55
-
56
  Follow these rules to complete the task:
57
  1. Begin with ONLY plain text conversation until you have collected all three parameters from the user.
58
  2. WAIT for the user to respond to your questions before proceeding.
 
27
  query = construct_course_search_query(interest=user_interest, expertise=user_expertise, budget=user_budget)
28
  print(f"Search query: {query}")
29
  ```<end_code>
30
+
31
+ Observation: Search query: top machine learning courses for beginner under free
32
+
33
+ Thought: Now that I have the search query, I need to execute the search to find relevant courses.
34
+ ```py
35
+ # Execute search with the constructed query
36
+ search_results = search_tool(query=query)
37
+ print(f"Found {len(search_results)} results")
38
+ # Print a sample of results for debugging
39
+ print(f"Sample results: {search_results[:2]}")
40
+ ```<end_code>
41
+
42
+ Observation: Found 10 results
43
+ Sample results: ["Free Machine Learning Courses for Beginners - Top 5 Options in 2023", "15 Free Machine Learning Courses for Beginners (2023) - Dataquest"]
44
+
45
+ Thought: Now I need to process these results to ensure they match the user's criteria.
46
+ ```py
47
+ # Process search results to extract relevant courses
48
+ filtered_courses = []
49
+ import re
50
+
51
+ for result in search_results:
52
+ # Filter results that match user criteria
53
+ if user_interest.lower() in result.lower():
54
+ # Check if budget matches (free or within specified range)
55
+ if user_budget.lower() == "free" and "free" in result.lower():
56
+ filtered_courses.append(result)
57
+ elif user_budget.lower() != "free" and re.search(r'\$\d+', result):
58
+ # Extract price and compare with budget
59
+ price_matches = re.findall(r'\$(\d+)', result)
60
+ if price_matches:
61
+ price = int(price_matches[0])
62
+ budget_value = int(re.findall(r'\$?(\d+)', user_budget)[0])
63
+ if price <= budget_value:
64
+ filtered_courses.append(result)
65
+
66
+ print(f"Filtered to {len(filtered_courses)} relevant courses")
67
+ print(f"Top courses: {filtered_courses[:3]}")
68
+ ```<end_code>
69
+
70
+ Observation: Filtered to 5 relevant courses
71
+ Top courses: ["Free Machine Learning Courses for Beginners - Top 5 Options in 2023", "15 Free Machine Learning Courses for Beginners (2023) - Dataquest", "10 Best Free Machine Learning Courses for Beginners"]
72
+
73
+ Thought: Now I'll formulate a final answer for the user based on the filtered courses.
74
+ ```py
75
+ # Prepare final response
76
+ if filtered_courses:
77
+ response = f"Based on your interest in {user_interest} as a {user_expertise} with a budget of {user_budget}, I found these courses:\n\n"
78
+
79
+ for i, course in enumerate(filtered_courses[:5], 1):
80
+ response += f"{i}. {course}\n"
81
+
82
+ response += "\nThese courses match your criteria and should provide a good foundation in your area of interest."
83
+ else:
84
+ response = f"I couldn't find specific courses that match your criteria for {user_interest} at {user_expertise} level within {user_budget} budget. You may want to consider adjusting your budget or expertise level."
85
+
86
+ # Deliver final answer to the user
87
+ final_answer(answer=response)
88
+ ```<end_code>
89
+
90
  Keep track of the user's responses in memory as follows:
91
  - Store the interest as a variable called `user_interest`.
92
  - Store the expertise as a variable called `user_expertise`.
93
  - Store the budget as a variable called `user_budget`.
94
  - Only recommend courses once all three variables (`user_interest`, `user_expertise`, `user_budget`) have been set with user-provided values.
95
  - Do not proceed to using tools until you have collected all three pieces of information from the user.
 
96
  Once all three parameters are collected, you will switch to a step-by-step process using 'Thought:', 'Code:', and 'Observation:' sequences:
97
  - In the 'Thought:' sequence, detail your reasoning and identify which tools to use next.
98
  - In the 'Code:' sequence, write simple Python code to execute your plan. The code MUST be enclosed in a code block starting with ```py on a new line, your Python code on the next line(s), and ending with ```<end_code> (without a newline between the code and the end tag).
99
  - Use 'print()' to capture key information needed for subsequent steps, which will appear in the 'Observation:' field.
 
100
  Your final step must use the `final_answer` tool to deliver the course recommendations.
 
101
  You have access to these tools:
102
  - construct_course_search_query: Builds a search query for AI courses based on user inputs.
103
  Takes inputs: interest (str), expertise (str), budget (str)
 
108
  - final_answer: Delivers the final response to the user.
109
  Takes inputs: answer (str)
110
  Returns an output of type: None
 
111
  Follow these rules to complete the task:
112
  1. Begin with ONLY plain text conversation until you have collected all three parameters from the user.
113
  2. WAIT for the user to respond to your questions before proceeding.