Spaces:
Sleeping
Sleeping
Update src/agent.py
Browse files- src/agent.py +3 -3
src/agent.py
CHANGED
|
@@ -42,13 +42,13 @@ class BasicAgent():
|
|
| 42 |
try:
|
| 43 |
for step in self.agent.run(input_text):
|
| 44 |
if isinstance(step, str):
|
|
|
|
|
|
|
| 45 |
continue
|
| 46 |
step_name = step.__class__.__name__
|
| 47 |
output = getattr(step, "output", None)
|
| 48 |
if output:
|
| 49 |
print(f"Step: {step_name} Output: {step.output}")
|
| 50 |
-
print(f"Step: {step_name} Output: {step.output}")
|
| 51 |
-
|
| 52 |
self.token_rate_limiter.maybe_wait(self.expected_tokens_per_step)
|
| 53 |
tokens_used = getattr(step, "token_usage", None)
|
| 54 |
if tokens_used:
|
|
@@ -56,7 +56,7 @@ class BasicAgent():
|
|
| 56 |
|
| 57 |
if step_name == "FinalAnswerStep":
|
| 58 |
final_answer = step.output
|
| 59 |
-
print(f"Final Answer: {final_answer}")
|
| 60 |
break
|
| 61 |
except Exception as e:
|
| 62 |
if "overload" in str(e).lower() or "rate limit" in str(e).lower():
|
|
|
|
| 42 |
try:
|
| 43 |
for step in self.agent.run(input_text):
|
| 44 |
if isinstance(step, str):
|
| 45 |
+
final_answer = step
|
| 46 |
+
print(f"Final Answer (string step): {final_answer}")
|
| 47 |
continue
|
| 48 |
step_name = step.__class__.__name__
|
| 49 |
output = getattr(step, "output", None)
|
| 50 |
if output:
|
| 51 |
print(f"Step: {step_name} Output: {step.output}")
|
|
|
|
|
|
|
| 52 |
self.token_rate_limiter.maybe_wait(self.expected_tokens_per_step)
|
| 53 |
tokens_used = getattr(step, "token_usage", None)
|
| 54 |
if tokens_used:
|
|
|
|
| 56 |
|
| 57 |
if step_name == "FinalAnswerStep":
|
| 58 |
final_answer = step.output
|
| 59 |
+
print(f"Final Answer (FinalAnswerStep): {final_answer}")
|
| 60 |
break
|
| 61 |
except Exception as e:
|
| 62 |
if "overload" in str(e).lower() or "rate limit" in str(e).lower():
|