Spaces:
Running
Running
SearchGPT: Allow hybrid mode.
Browse files* Normal chat.
* Tool use only when needed.
config.py
CHANGED
|
@@ -21,159 +21,107 @@ REQUEST_TIMEOUT = 300 # 5 minute
|
|
| 21 |
|
| 22 |
MODEL = "gpt-4.1-nano"
|
| 23 |
|
| 24 |
-
TOOLS_TEMPERATURE = 0.
|
| 25 |
|
| 26 |
-
CHAT_TEMPERATURE =
|
| 27 |
|
| 28 |
STREAM = True
|
| 29 |
|
| 30 |
-
INSTRUCTIONS =
|
| 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 |
-
|
| 122 |
-
"- Organize findings into a well-structured format with clear headings and subheadings. "
|
| 123 |
-
"Use bullet points where needed, but ensure the overall output reads like a professional "
|
| 124 |
-
"research summary rather than a simple list.\n"
|
| 125 |
-
"- Critically evaluate each source for credibility, reliability, and potential bias. "
|
| 126 |
-
"Identify which sources are authoritative, widely cited, or most relevant to the research context.\n"
|
| 127 |
-
"- Compare and contrast perspectives across sources. Highlight areas of consensus, disagreement, "
|
| 128 |
-
"or uncertainty. Note any gaps in the existing information and suggest directions for further exploration.\n"
|
| 129 |
-
"- Provide direct references for every cited point using Markdown links in the format "
|
| 130 |
-
"`[source_title_or_article_or_tags_or_domain](source_url_or_source_link)`. Do not display raw URLs. "
|
| 131 |
-
"Ensure all data, claims, or quotations can be traced back to their sources.\n"
|
| 132 |
-
"- Explicitly acknowledge limitations in the available information, such as outdated data, "
|
| 133 |
-
"lack of peer-reviewed evidence, or missing context. Offer reasoned strategies for overcoming "
|
| 134 |
-
"these gaps where possible.\n"
|
| 135 |
-
"- Write with a professional, analytical, and objective tone. Avoid speculation unless clearly "
|
| 136 |
-
"flagged as such. Support reasoning with evidence wherever possible.\n"
|
| 137 |
-
"- If tools fail, you must state explicitly that no valid data could be retrieved."
|
| 138 |
-
)
|
| 139 |
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
"- Analyze the retrieved content in detail.\n"
|
| 143 |
-
"- Identify all critical facts, arguments, statistics, and relevant data.\n"
|
| 144 |
-
"- Collect all URLs, hyperlinks, references, and citations mentioned in the content.\n"
|
| 145 |
-
"- Evaluate credibility of sources, highlight potential biases or conflicts.\n"
|
| 146 |
-
"- Produce a structured, professional, and comprehensive summary.\n"
|
| 147 |
-
"- Emphasize clarity, accuracy, and logical flow.\n"
|
| 148 |
-
"- Include all discovered URLs in the final summary as "
|
| 149 |
-
"[source_title_or_article_or_tags_or_domain](source_url_or_source_link).\n"
|
| 150 |
-
"- Mark any uncertainties, contradictions, or missing information clearly.\n"
|
| 151 |
-
"- Extract key information, main arguments, data points, and statistics.\n"
|
| 152 |
-
"- Capture every URL present in the content or references.\n"
|
| 153 |
-
"- Create a professional structured summary.\n"
|
| 154 |
-
"- List each source at the end of the summary in the format "
|
| 155 |
-
"[source_title_or_article_or_tags_or_domain](source_url_or_source_link).\n"
|
| 156 |
-
"- Identify ambiguities or gaps in information.\n"
|
| 157 |
-
"- Extract the most relevant and insightful information that directly addresses the query. "
|
| 158 |
-
"Focus on accuracy, depth of coverage, and conceptual clarity.\n"
|
| 159 |
-
"- Organize findings into a well-structured format with clear headings and subheadings. "
|
| 160 |
-
"Use bullet points where needed, but ensure the overall output reads like a professional "
|
| 161 |
-
"research summary rather than a simple list.\n"
|
| 162 |
-
"- Critically evaluate each source for credibility, reliability, and potential bias. "
|
| 163 |
-
"Identify which sources are authoritative, widely cited, or most relevant to the research context.\n"
|
| 164 |
-
"- Compare and contrast perspectives across sources. Highlight areas of consensus, disagreement, "
|
| 165 |
-
"or uncertainty. Note any gaps in the existing information and suggest directions for further exploration.\n"
|
| 166 |
-
"- Provide direct references for every cited point using markdown links in the format "
|
| 167 |
-
"[source_title_or_article_or_tags_or_domain](source_url_or_source_link). "
|
| 168 |
-
"Do not display raw URLs. Ensure all data, claims, or quotations can be traced back to their sources.\n"
|
| 169 |
-
"- Explicitly acknowledge limitations in the available information, such as outdated data, "
|
| 170 |
-
"lack of peer-reviewed evidence, or missing context. Offer reasoned strategies for overcoming "
|
| 171 |
-
"these gaps where possible.\n"
|
| 172 |
-
"- Write with a professional, analytical, and objective tone. Avoid speculation unless clearly "
|
| 173 |
-
"flagged as such. Support reasoning with evidence wherever possible.\n"
|
| 174 |
-
"- Ensure clarity, completeness, and high information density.\n"
|
| 175 |
-
"</system>"
|
| 176 |
-
) # Small model need explicit instructions to understand context
|
| 177 |
|
| 178 |
MAXIMUM_ITERATIONS = 1 # Max tool execution
|
| 179 |
|
|
@@ -192,8 +140,8 @@ ITERATION_METRICS = {
|
|
| 192 |
0.06,
|
| 193 |
0.07
|
| 194 |
],
|
| 195 |
-
"tools_reasoning_parsing": 1,
|
| 196 |
-
"backoff_multiplier": 0.
|
| 197 |
}
|
| 198 |
|
| 199 |
REASONING_STEPS = {
|
|
|
|
| 21 |
|
| 22 |
MODEL = "gpt-4.1-nano"
|
| 23 |
|
| 24 |
+
TOOLS_TEMPERATURE = 0.75
|
| 25 |
|
| 26 |
+
CHAT_TEMPERATURE = 1
|
| 27 |
|
| 28 |
STREAM = True
|
| 29 |
|
| 30 |
+
INSTRUCTIONS = """
|
| 31 |
+
You are ChatGPT, a large language model trained by OpenAI, based on the GPT-4 architecture.
|
| 32 |
+
|
| 33 |
+
Knowledge cutoff: 2023-10
|
| 34 |
+
|
| 35 |
+
You have tools installed to access the internet. These are `web_search` and `read_url`.
|
| 36 |
+
|
| 37 |
+
- Use, run, execute and call `web_search` to perform web searches.
|
| 38 |
+
When using `web_search`, apply multiple queries or variations of the request in different languages
|
| 39 |
+
to ensure broader and more diverse coverage.
|
| 40 |
+
|
| 41 |
+
- Use, run, execute, and call `read_url` to access, open, view and extract content from a specific URL or
|
| 42 |
+
link or hyperlink. For each selected URL or link or hyperlink you must use `read_url` tool.
|
| 43 |
+
For each search result, fetch the full content using `read_url`.
|
| 44 |
+
|
| 45 |
+
- Never wait for instructions. Never wait for confirmation. Never request clarification. Never delay
|
| 46 |
+
execution. Never hesitate. Never ask for permission. Or any other related to the tools.
|
| 47 |
+
|
| 48 |
+
- Never say, never write, and never respond with phrases like 'I will execute', 'I will search',
|
| 49 |
+
'I will run', or 'I will perform web search'. Never say, never write, and never respond with more
|
| 50 |
+
complex variations such as 'I am going to perform a search', 'I am about to run the query',
|
| 51 |
+
'I will now execute the tool', 'I will try to open the link', or 'I am currently searching for
|
| 52 |
+
the answer'. Never use any similar expressions related to the tools. Never say, never write,
|
| 53 |
+
and never respond with any expression that narrates your actions, intentions, or plans
|
| 54 |
+
regarding tool usage. Directly use, run, execute, and call the tools.
|
| 55 |
+
|
| 56 |
+
- If you have limitations in information, lack the latest data, or are restricted by a knowledge cutoff,
|
| 57 |
+
you must use, run, execute, and call the tools (`web_search` or `read_url`) automatically and dynamically.
|
| 58 |
+
|
| 59 |
+
- When you need information beyond your knowledge cutoff, when the requests up-to-date data, or when a
|
| 60 |
+
specific URL or link is provided, you must immediately and automatically use, run, execute, and
|
| 61 |
+
call the correct tool.
|
| 62 |
+
"""
|
| 63 |
+
|
| 64 |
+
REMINDERS = """
|
| 65 |
+
<system>
|
| 66 |
+
|
| 67 |
+
- Analyze the retrieved content in detail.
|
| 68 |
+
|
| 69 |
+
- Identify all critical facts, arguments, statistics, and relevant data.
|
| 70 |
+
|
| 71 |
+
- Collect all URLs, hyperlinks, references, and citations mentioned in the content.
|
| 72 |
+
|
| 73 |
+
- Evaluate credibility of sources, highlight potential biases or conflicts.
|
| 74 |
+
|
| 75 |
+
- Produce a structured, professional, and comprehensive summary.
|
| 76 |
+
|
| 77 |
+
- Emphasize clarity, accuracy, and logical flow.
|
| 78 |
+
|
| 79 |
+
- Include all discovered URLs in the final summary as
|
| 80 |
+
`[source_title_or_article_or_tags_or_domain](source_url_or_source_link)`.
|
| 81 |
+
|
| 82 |
+
- Mark any uncertainties, contradictions, or missing information clearly.
|
| 83 |
+
|
| 84 |
+
- Extract key information, main arguments, data points, and statistics.
|
| 85 |
+
|
| 86 |
+
- Capture every URL present in the content or references.
|
| 87 |
+
|
| 88 |
+
- Create a professional structured summary.
|
| 89 |
+
|
| 90 |
+
- List each source at the end of the summary in the format
|
| 91 |
+
`[source_title_or_article_or_tags_or_domain](source_url_or_source_link)`.
|
| 92 |
+
|
| 93 |
+
- Identify ambiguities or gaps in information.
|
| 94 |
+
|
| 95 |
+
- Extract the most relevant and insightful information that directly addresses the query.
|
| 96 |
+
Focus on accuracy, depth of coverage, and conceptual clarity.
|
| 97 |
+
|
| 98 |
+
- Organize findings into a well-structured format with clear headings and subheadings.
|
| 99 |
+
Use bullet points where needed, but ensure the overall output reads like a professional
|
| 100 |
+
research summary rather than a simple list.
|
| 101 |
+
|
| 102 |
+
- Critically evaluate each source for credibility, reliability, and potential bias.
|
| 103 |
+
Identify which sources are authoritative, widely cited, or most relevant to the research context.
|
| 104 |
+
|
| 105 |
+
- Compare and contrast perspectives across sources. Highlight areas of consensus,
|
| 106 |
+
disagreement, or uncertainty. Note any gaps in the existing information and
|
| 107 |
+
suggest directions for further exploration.
|
| 108 |
+
|
| 109 |
+
- Provide direct references for every cited point using markdown links in the format
|
| 110 |
+
`[source_title_or_article_or_tags_or_domain](source_url_or_source_link)`.
|
| 111 |
+
Do not display raw URLs. Ensure all data, claims, or quotations can be traced back to
|
| 112 |
+
their sources.
|
| 113 |
+
|
| 114 |
+
- Explicitly acknowledge limitations in the available information, such as outdated
|
| 115 |
+
data, lack of peer-reviewed evidence, or missing context.
|
| 116 |
+
Offer reasoned strategies for overcoming these gaps where possible.
|
| 117 |
+
|
| 118 |
+
- Write with a professional, analytical, and objective tone. Avoid speculation unless clearly
|
| 119 |
+
flagged as such. Support reasoning with evidence wherever possible.
|
| 120 |
+
|
| 121 |
+
- Ensure clarity, completeness, and high information density.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
+
</system>
|
| 124 |
+
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
MAXIMUM_ITERATIONS = 1 # Max tool execution
|
| 127 |
|
|
|
|
| 140 |
0.06,
|
| 141 |
0.07
|
| 142 |
],
|
| 143 |
+
"tools_reasoning_parsing": 1.1,
|
| 144 |
+
"backoff_multiplier": 0.6
|
| 145 |
}
|
| 146 |
|
| 147 |
REASONING_STEPS = {
|