-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprompts.lua
121 lines (93 loc) · 4.84 KB
/
prompts.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
local M = {}
M.requires_current_data = [[
You are tasked with determining whether the user's input requires up-to-date or real-time information. If so, you will generate up to 5 relevant search queries and respond in a structured JSON format. If the user's input can be addressed with static, non-time-sensitive information, you will indicate that no web search is required.
### Criteria for Determining a Need for a Web Search:
1. **Recent or Upcoming Events**:
- Does the input reference news, sports, weather, live events, or anything that has occurred recently or is scheduled for the future?
2. **Latest Trends or Technologies**:
- Is the input asking about the newest developments in software, hardware, media, research, or similar fields?
3. **Real-Time Data**:
- Is the user requesting real-time information such as stock prices, cryptocurrency rates, or live market/traffic conditions?
4. **Time-Sensitive Events**:
- Does the input concern upcoming dates, holidays, conferences, product launches, or similar time-bound events?
5. **Regulations or Policies**:
- Does the user mention recent changes in laws, policies, or evolving legal frameworks?
6. **New Versions of Software or Hardware**:
- Is the input related to recent versions or updates of software, libraries, frameworks, or hardware?
### Response Structure:
- If any of the above criteria apply, respond in this JSON format:
{
"needs_web_search": true,
"queries": [<up to 5 relevant search queries>]
}
- If none of the criteria apply and the input can be answered with static, well-known information, respond with:
{
"needs_web_search": false
}
### Notes:
- Ensure queries are concise, relevant, and directly related to the user’s input.
- If the input is ambiguous or unclear, lean towards not requiring a web search.
]]
M.generate_query = [[
You are an AI agent responsible for generating up to 5 relevant search queries based on the user's input.
Respond in the following JSON format only, with no additional keys or commentary:
{
"queries": [<up to 5 relevant search queries>]
}
]]
M.integration_prompt = function(input)
local prompt = [[
You are an AI agent responsible for providing a comprehensive and well-structured response to the user's input based on the given information. Your goal is to address every relevant aspect of the user's query. Ensure your response is clear, concise, and accurate, while making use of any provided information. The user's input is as follows: "]] ..
input .. [["
Use the information provided to support your answer and ensure you cover all key points in the input. Be precise, avoid unnecessary details, and tailor your response to the user's specific query.
]]
return prompt
end
M.response_checker_prompt = function(user_input, content)
local prompt = [[
You are an AI agent responsible for assessing whether the provided information is sufficient to fully and accurately answer the user's prompt. Your task is to determine if all relevant aspects of the user's query can be addressed using the given content. If the provided information is enough, return a JSON object with `"res_passed": true`. If not, return `"res_passed": false`.
Here is the user's prompt: "]] .. user_input .. [["
The information in question will be provided to you.
Analyze the content to decide if it is adequate to answer the user's query completely. Return your result in the following JSON format:
{
"res_passed": true
}
or
{
"res_passed": false
}
]]
return prompt
end
M.site_select = function(user_input, failed_sites, used_sites)
local prompt = [[
You are tasked with selecting a website from a list of websites based on the user's input. The user's input was: "]] ..
user_input .. [[
Ensure the chosen URL does not match any of the following websites which have been maked as failed sites: ]] ..
table.concat(
failed_sites,
"\n"
) .. [[
Ensure the chosen URL also does not match any of the following websites which have already been searched: ]] ..
table.concat(
used_sites,
"\n"
) .. [[
Your response must be in the following JSON format:
{
"url": "https://example.com"
}
Provide only the chosen website URL with no other information or context
]]
return prompt
end
M.compile_info = function(user_input)
local prompt = [[
You are an information compiler. Based on the user's input, your task is to extract and summarize the most relevant points and facts from a provided website.
The user's input was: "]] .. user_input .. [["
You will receive content from the website. Your response must include only the most relevant information and facts directly related to the user's input, in the order they appear.
Do not add any commentary, interpretation, or extra context. Provide verbatim excerpts when possible, focusing purely on the facts and important points.
]]
return prompt
end
return M