Spaces:
Sleeping
Sleeping
reflect RateLimiter's changes
Browse files
app.py
CHANGED
|
@@ -22,8 +22,6 @@ from youtube_transcript_tool import YoutubeTranscriptTool
|
|
| 22 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 23 |
|
| 24 |
rate_limiter = RateLimiter()
|
| 25 |
-
litellm.success_callback = [rate_limiter.increment_successful_calls]
|
| 26 |
-
litellm.failure_callback = [rate_limiter.increment_failed_calls]
|
| 27 |
|
| 28 |
# --- Basic Agent Definition ---
|
| 29 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
|
@@ -45,6 +43,7 @@ class BasicAgent:
|
|
| 45 |
)
|
| 46 |
print("BasicAgent initialized.")
|
| 47 |
def __call__(self, question: str) -> str:
|
|
|
|
| 48 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 49 |
answer = self.agent.run(question)
|
| 50 |
print(f"Agent returning answer: {answer}")
|
|
|
|
| 22 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 23 |
|
| 24 |
rate_limiter = RateLimiter()
|
|
|
|
|
|
|
| 25 |
|
| 26 |
# --- Basic Agent Definition ---
|
| 27 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
|
|
|
| 43 |
)
|
| 44 |
print("BasicAgent initialized.")
|
| 45 |
def __call__(self, question: str) -> str:
|
| 46 |
+
limiter.sleep_if_needed()
|
| 47 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 48 |
answer = self.agent.run(question)
|
| 49 |
print(f"Agent returning answer: {answer}")
|