Spaces:
Running
Running
SearchGPT: Smooth tool reasoning.
Browse files
src/processor/tools/interaction.py
CHANGED
|
@@ -27,14 +27,14 @@ def process_tool_interactions(server, model_name, conversation_messages, tool_de
|
|
| 27 |
"success_rate": 0,
|
| 28 |
"error_patterns": {},
|
| 29 |
"retry_delays": [
|
| 30 |
-
0.
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
],
|
| 37 |
-
"backoff_multiplier": 1.
|
| 38 |
}
|
| 39 |
|
| 40 |
while maximum_iterations <= max_retry_limit and not execution_success:
|
|
@@ -94,7 +94,7 @@ def process_tool_interactions(server, model_name, conversation_messages, tool_de
|
|
| 94 |
})
|
| 95 |
|
| 96 |
reasoning_error = tool_reasoning(tool_name, None, "error", error=extraction_error)
|
| 97 |
-
for i in range(0, len(reasoning_error),
|
| 98 |
logs_generator = styles(reasoning_interfaces(reasoning_error, i), expanded=True)
|
| 99 |
yield logs_generator
|
| 100 |
time.sleep(REASONING_DELAY)
|
|
@@ -103,13 +103,13 @@ def process_tool_interactions(server, model_name, conversation_messages, tool_de
|
|
| 103 |
tool_execution_result = extraction_error
|
| 104 |
else:
|
| 105 |
reasoning_status = tool_reasoning(tool_name, extracted_arguments, "parsing")
|
| 106 |
-
for i in range(0, len(reasoning_status),
|
| 107 |
logs_generator = styles(reasoning_interfaces(reasoning_status, i), expanded=True)
|
| 108 |
yield logs_generator
|
| 109 |
time.sleep(REASONING_DELAY)
|
| 110 |
|
| 111 |
reasoning_start = tool_reasoning(tool_name, extracted_arguments, "executing")
|
| 112 |
-
for i in range(0, len(reasoning_start),
|
| 113 |
logs_generator = styles(reasoning_interfaces(reasoning_start, i), expanded=True)
|
| 114 |
yield logs_generator
|
| 115 |
time.sleep(REASONING_DELAY)
|
|
@@ -129,7 +129,7 @@ def process_tool_interactions(server, model_name, conversation_messages, tool_de
|
|
| 129 |
})
|
| 130 |
|
| 131 |
reasoning_done = tool_reasoning(tool_name, extracted_arguments, "completed", result=tool_execution_result)
|
| 132 |
-
for i in range(0, len(reasoning_done),
|
| 133 |
logs_generator = styles(reasoning_interfaces(reasoning_done, i), expanded=True)
|
| 134 |
yield logs_generator
|
| 135 |
time.sleep(REASONING_DELAY)
|
|
@@ -147,7 +147,7 @@ def process_tool_interactions(server, model_name, conversation_messages, tool_de
|
|
| 147 |
})
|
| 148 |
|
| 149 |
reasoning_error = tool_reasoning(tool_name, extracted_arguments, "error", error=str(tool_error))
|
| 150 |
-
for i in range(0, len(reasoning_error),
|
| 151 |
logs_generator = styles(reasoning_interfaces(reasoning_error, i), expanded=True)
|
| 152 |
yield logs_generator
|
| 153 |
time.sleep(REASONING_DELAY)
|
|
@@ -205,7 +205,7 @@ def process_tool_interactions(server, model_name, conversation_messages, tool_de
|
|
| 205 |
|
| 206 |
if maximum_iterations > previous_iterations:
|
| 207 |
retry_reasoning = f"Retrying with increased iterations: {maximum_iterations} (attempt {retry_count + 1})"
|
| 208 |
-
for i in range(0, len(retry_reasoning),
|
| 209 |
logs_generator = styles(reasoning_interfaces(retry_reasoning, i), expanded=True)
|
| 210 |
yield logs_generator
|
| 211 |
time.sleep(REASONING_DELAY)
|
|
|
|
| 27 |
"success_rate": 0,
|
| 28 |
"error_patterns": {},
|
| 29 |
"retry_delays": [
|
| 30 |
+
0.02,
|
| 31 |
+
0.03,
|
| 32 |
+
0.04,
|
| 33 |
+
0.05,
|
| 34 |
+
0.06,
|
| 35 |
+
0.07
|
| 36 |
],
|
| 37 |
+
"backoff_multiplier": 1.0
|
| 38 |
}
|
| 39 |
|
| 40 |
while maximum_iterations <= max_retry_limit and not execution_success:
|
|
|
|
| 94 |
})
|
| 95 |
|
| 96 |
reasoning_error = tool_reasoning(tool_name, None, "error", error=extraction_error)
|
| 97 |
+
for i in range(0, len(reasoning_error), 10):
|
| 98 |
logs_generator = styles(reasoning_interfaces(reasoning_error, i), expanded=True)
|
| 99 |
yield logs_generator
|
| 100 |
time.sleep(REASONING_DELAY)
|
|
|
|
| 103 |
tool_execution_result = extraction_error
|
| 104 |
else:
|
| 105 |
reasoning_status = tool_reasoning(tool_name, extracted_arguments, "parsing")
|
| 106 |
+
for i in range(0, len(reasoning_status), 10):
|
| 107 |
logs_generator = styles(reasoning_interfaces(reasoning_status, i), expanded=True)
|
| 108 |
yield logs_generator
|
| 109 |
time.sleep(REASONING_DELAY)
|
| 110 |
|
| 111 |
reasoning_start = tool_reasoning(tool_name, extracted_arguments, "executing")
|
| 112 |
+
for i in range(0, len(reasoning_start), 10):
|
| 113 |
logs_generator = styles(reasoning_interfaces(reasoning_start, i), expanded=True)
|
| 114 |
yield logs_generator
|
| 115 |
time.sleep(REASONING_DELAY)
|
|
|
|
| 129 |
})
|
| 130 |
|
| 131 |
reasoning_done = tool_reasoning(tool_name, extracted_arguments, "completed", result=tool_execution_result)
|
| 132 |
+
for i in range(0, len(reasoning_done), 10):
|
| 133 |
logs_generator = styles(reasoning_interfaces(reasoning_done, i), expanded=True)
|
| 134 |
yield logs_generator
|
| 135 |
time.sleep(REASONING_DELAY)
|
|
|
|
| 147 |
})
|
| 148 |
|
| 149 |
reasoning_error = tool_reasoning(tool_name, extracted_arguments, "error", error=str(tool_error))
|
| 150 |
+
for i in range(0, len(reasoning_error), 10):
|
| 151 |
logs_generator = styles(reasoning_interfaces(reasoning_error, i), expanded=True)
|
| 152 |
yield logs_generator
|
| 153 |
time.sleep(REASONING_DELAY)
|
|
|
|
| 205 |
|
| 206 |
if maximum_iterations > previous_iterations:
|
| 207 |
retry_reasoning = f"Retrying with increased iterations: {maximum_iterations} (attempt {retry_count + 1})"
|
| 208 |
+
for i in range(0, len(retry_reasoning), 10):
|
| 209 |
logs_generator = styles(reasoning_interfaces(retry_reasoning, i), expanded=True)
|
| 210 |
yield logs_generator
|
| 211 |
time.sleep(REASONING_DELAY)
|