hadadrjt commited on
Commit
c831768
·
1 Parent(s): 519d3a3

SearchGPT: Restore the OpenAI-style CoT reasoning UX.

Browse files
Files changed (2) hide show
  1. config.py +102 -7
  2. src/processor/tools/interaction.py +1 -0
config.py CHANGED
@@ -186,44 +186,139 @@ ITERATION_METRICS = {
186
  0.06,
187
  0.07
188
  ],
189
- "backoff_multiplier": 0.2
 
190
  }
191
 
192
  REASONING_STEPS = {
193
  "web_search": {
194
  "parsing": (
195
- "I need to search for information about: {query}"
 
 
 
 
 
 
 
 
 
 
 
196
  ),
197
  "executing": (
198
- "I'm now executing the web search for: {query}"
 
 
 
 
 
 
 
 
 
 
 
 
199
  "<br>"
200
  "<loading_animation>"
201
  ),
202
  "completed": (
203
  "I have successfully completed the web search for: {query}<br><br>"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
  "Preview of results:<br>{preview}"
205
  ),
206
  "error": (
207
  "I encountered an issue while attempting to search for: {query}<br><br>"
208
- "Error details: {error}"
 
 
 
 
 
 
 
 
 
209
  )
210
  },
211
  "read_url": {
212
  "parsing": (
213
- "I need to read and extract content from the URL: {url}"
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  ),
215
  "executing": (
216
- "I'm now accessing the URL: {url}"
 
 
 
 
 
 
 
 
 
 
 
 
217
  "<br>"
218
  "<loading_animation>"
219
  ),
220
  "completed": (
221
  "I have successfully extracted content from: {url}<br><br>"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
  "Preview of extracted content:<br>{preview}"
223
  ),
224
  "error": (
225
  "I encountered an issue while trying to access: {url}<br><br>"
226
- "Error details: {error}"
 
 
 
 
 
 
 
 
 
227
  )
228
  }
229
  }
 
186
  0.06,
187
  0.07
188
  ],
189
+ "tools_reasoning_parsing": 1.3,
190
+ "backoff_multiplier": 0.4
191
  }
192
 
193
  REASONING_STEPS = {
194
  "web_search": {
195
  "parsing": (
196
+ "I need to search for information about: {query}<br><br>"
197
+ "I'm analyzing the user's request and preparing to execute a web search. "
198
+ "The query I've identified is comprehensive and should yield relevant results. "
199
+ "I will use the {engine} search engine for this task as it provides reliable and up-to-date information.<br><br>"
200
+ "I'm now parsing the search parameters to ensure they are correctly formatted. "
201
+ "The search query has been validated and I'm checking that all required fields are present. "
202
+ "I need to make sure the search engine parameter is valid and supported by our system.<br><br>"
203
+ "I'm preparing the search request with the following configuration:<br>"
204
+ "- Search Query: {query}<br>"
205
+ "- Search Engine: {engine}<br><br>"
206
+ "I'm verifying that the network connection is stable and that the search service is accessible. "
207
+ "All preliminary checks have been completed successfully."
208
  ),
209
  "executing": (
210
+ "I'm now executing the web search for: {query}<br><br>"
211
+ "I'm connecting to the {engine} search service and sending the search request. "
212
+ "The connection has been established successfully and I'm waiting for the search results. "
213
+ "I'm processing multiple search result pages to gather comprehensive information.<br><br>"
214
+ "I'm analyzing the search results to identify the most relevant and authoritative sources. "
215
+ "The search engine is returning results and I'm filtering them based on relevance scores. "
216
+ "I'm extracting key information from each search result including titles, snippets, and URLs.<br><br>"
217
+ "I'm organizing the search results in order of relevance and checking for duplicate content. "
218
+ "The search process is progressing smoothly and I'm collecting valuable information. "
219
+ "I'm also verifying the credibility of the sources to ensure high-quality information.<br><br>"
220
+ "Current status: Processing search results...<br>"
221
+ "Results found: Multiple relevant sources identified<br>"
222
+ "Quality assessment: High relevance detected"
223
  "<br>"
224
  "<loading_animation>"
225
  ),
226
  "completed": (
227
  "I have successfully completed the web search for: {query}<br><br>"
228
+ "I've retrieved comprehensive search results from {engine} and analyzed all the information. "
229
+ "The search yielded multiple relevant results that directly address the user's query. "
230
+ "I've extracted the most important information and organized it for processing.<br><br>"
231
+ "I've identified several high-quality sources with authoritative information. "
232
+ "The search results include recent and up-to-date content that is highly relevant. "
233
+ "I've filtered out any duplicate or low-quality results to ensure accuracy.<br><br>"
234
+ "I'm now processing the collected information to formulate a comprehensive response. "
235
+ "The search results provide sufficient detail to answer the user's question thoroughly. "
236
+ "I've verified the credibility of the sources and cross-referenced the information.<br><br>"
237
+ "Search Summary:<br>"
238
+ "- Total results processed: Multiple pages<br>"
239
+ "- Relevance score: High<br>"
240
+ "- Information quality: Verified and accurate<br>"
241
+ "- Sources: Authoritative and recent<br><br>"
242
  "Preview of results:<br>{preview}"
243
  ),
244
  "error": (
245
  "I encountered an issue while attempting to search for: {query}<br><br>"
246
+ "I tried to execute the web search but encountered an unexpected error. "
247
+ "The error occurred during the search process and I need to handle it appropriately. "
248
+ "I'm analyzing the error to understand what went wrong and how to proceed.<br><br>"
249
+ "Error details: {error}<br><br>"
250
+ "I'm attempting to diagnose the issue and considering alternative approaches. "
251
+ "The error might be due to network connectivity, service availability, or parameter issues. "
252
+ "I will try to recover from this error and provide the best possible response.<br><br>"
253
+ "I'm evaluating whether I can retry the search with modified parameters. "
254
+ "If the search cannot be completed, I will use my existing knowledge to help the user. "
255
+ "I'm committed to providing valuable assistance despite this technical challenge.<br><br>"
256
  )
257
  },
258
  "read_url": {
259
  "parsing": (
260
+ "I need to read and extract content from the URL: {url}<br><br>"
261
+ "I'm analyzing the URL structure to ensure it's valid and accessible. "
262
+ "The URL appears to be properly formatted and I'm preparing to fetch its content. "
263
+ "I will extract the main content from this webpage to gather detailed information.<br><br>"
264
+ "I'm validating the URL protocol and checking if it uses HTTP or HTTPS. "
265
+ "The domain seems legitimate and I'm preparing the request headers. "
266
+ "I need to ensure that the website allows automated content extraction.<br><br>"
267
+ "I'm configuring the content extraction parameters:<br>"
268
+ "- Target URL: {url}<br>"
269
+ "- Extraction Method: Full content parsing<br>"
270
+ "- Content Type: HTML/Text<br>"
271
+ "- Encoding: Auto-detect<br><br>"
272
+ "I'm checking if the website requires any special handling or authentication. "
273
+ "All preliminary validation checks have been completed successfully."
274
  ),
275
  "executing": (
276
+ "I'm now accessing the URL: {url}<br><br>"
277
+ "I'm establishing a connection to the web server and sending the HTTP request. "
278
+ "The connection is being established and I'm waiting for the server response. "
279
+ "I'm following any redirects if necessary to reach the final destination.<br><br>"
280
+ "I'm downloading the webpage content and checking the response status code. "
281
+ "The server is responding and I'm receiving the HTML content. "
282
+ "I'm monitoring the download progress and ensuring data integrity.<br><br>"
283
+ "I'm parsing the HTML structure to extract the main content. "
284
+ "I'm identifying and removing navigation elements, advertisements, and other non-content sections. "
285
+ "I'm focusing on extracting the primary article or information content.<br><br>"
286
+ "Current status: Extracting content...<br>"
287
+ "Response received: Processing HTML<br>"
288
+ "Content extraction: In progress"
289
  "<br>"
290
  "<loading_animation>"
291
  ),
292
  "completed": (
293
  "I have successfully extracted content from: {url}<br><br>"
294
+ "I've retrieved the complete webpage content and processed it thoroughly. "
295
+ "The extraction was successful and I've obtained the main textual content. "
296
+ "I've cleaned the content by removing unnecessary HTML tags and formatting.<br><br>"
297
+ "I've identified the main article or information section of the webpage. "
298
+ "The content has been properly parsed and structured for analysis. "
299
+ "I've preserved important information while filtering out irrelevant elements.<br><br>"
300
+ "I'm now analyzing the extracted content to understand its context and relevance. "
301
+ "The information appears to be comprehensive and directly related to the topic. "
302
+ "I've verified that the content is complete and hasn't been truncated.<br><br>"
303
+ "Extraction Summary:<br>"
304
+ "- Content length: Substantial<br>"
305
+ "- Extraction quality: High<br>"
306
+ "- Content type: Article/Information<br>"
307
+ "- Processing status: Complete<br><br>"
308
  "Preview of extracted content:<br>{preview}"
309
  ),
310
  "error": (
311
  "I encountered an issue while trying to access: {url}<br><br>"
312
+ "I attempted to fetch the webpage content but encountered an error. "
313
+ "The error prevented me from successfully extracting the information. "
314
+ "I'm analyzing the error to understand the cause and find a solution.<br><br>"
315
+ "Error details: {error}<br><br>"
316
+ "I'm considering possible causes such as network issues, access restrictions, or invalid URLs. "
317
+ "The website might be blocking automated access or the URL might be incorrect. "
318
+ "I will try to work around this limitation and provide alternative assistance.<br><br>"
319
+ "I'm evaluating whether I can access the content through alternative methods. "
320
+ "If direct access isn't possible, I'll use my knowledge to help with the query. "
321
+ "I remain committed to providing useful information despite this obstacle.<br><br>"
322
  )
323
  }
324
  }
src/processor/tools/interaction.py CHANGED
@@ -62,6 +62,7 @@ def tools_setup(server, model_name, conversation_messages, tool_definitions, sea
62
  for i in range(0, len(tool_reasoning(tool_invocation.function.name, tools_parser(tool_invocation.function.arguments)[0], "parsing")) + 1):
63
  ITERATION_METRICS["logs_generator"] = styles(reasoning_interfaces(tool_reasoning(tool_invocation.function.name, tools_parser(tool_invocation.function.arguments)[0], "parsing"), i), expanded=True)
64
  yield ITERATION_METRICS["logs_generator"]
 
65
 
66
  for i in range(0, len(tool_reasoning(tool_invocation.function.name, tools_parser(tool_invocation.function.arguments)[0], "executing")) + 1):
67
  ITERATION_METRICS["logs_generator"] = styles(reasoning_interfaces(tool_reasoning(tool_invocation.function.name, tools_parser(tool_invocation.function.arguments)[0], "executing"), i), expanded=True)
 
62
  for i in range(0, len(tool_reasoning(tool_invocation.function.name, tools_parser(tool_invocation.function.arguments)[0], "parsing")) + 1):
63
  ITERATION_METRICS["logs_generator"] = styles(reasoning_interfaces(tool_reasoning(tool_invocation.function.name, tools_parser(tool_invocation.function.arguments)[0], "parsing"), i), expanded=True)
64
  yield ITERATION_METRICS["logs_generator"]
65
+ time.sleep(ITERATION_METRICS["tools_reasoning_parsing"])
66
 
67
  for i in range(0, len(tool_reasoning(tool_invocation.function.name, tools_parser(tool_invocation.function.arguments)[0], "executing")) + 1):
68
  ITERATION_METRICS["logs_generator"] = styles(reasoning_interfaces(tool_reasoning(tool_invocation.function.name, tools_parser(tool_invocation.function.arguments)[0], "executing"), i), expanded=True)