Spaces:
Sleeping
Sleeping
Update multiagents.py
Browse files- multiagents.py +3 -18
multiagents.py
CHANGED
|
@@ -58,22 +58,6 @@ dotenv.load_dotenv()
|
|
| 58 |
|
| 59 |
# SETUP AND TEST
|
| 60 |
|
| 61 |
-
# Simple rate-limited model wrapper
|
| 62 |
-
class RateLimitedModel:
|
| 63 |
-
def __init__(self, model, delay_seconds=1):
|
| 64 |
-
self.model = model
|
| 65 |
-
self.delay_seconds = delay_seconds
|
| 66 |
-
|
| 67 |
-
def __call__(self, messages, **kwargs):
|
| 68 |
-
# Simple delay before each API call
|
| 69 |
-
time.sleep(self.delay_seconds)
|
| 70 |
-
return self.model(messages, **kwargs)
|
| 71 |
-
|
| 72 |
-
def __getattr__(self, name):
|
| 73 |
-
# Delegate other attributes to the wrapped model
|
| 74 |
-
return getattr(self.model, name)
|
| 75 |
-
|
| 76 |
-
|
| 77 |
|
| 78 |
|
| 79 |
###################
|
|
@@ -85,11 +69,12 @@ grok_api_key = os.getenv("groq_api")
|
|
| 85 |
base_model = InferenceClientModel(
|
| 86 |
provider="groq",
|
| 87 |
api_key=grok_api_key,
|
| 88 |
-
model_id="qwen/qwen3-32b"
|
|
|
|
| 89 |
)
|
| 90 |
|
| 91 |
# Wrap with rate limiting
|
| 92 |
-
My_Agent =
|
| 93 |
|
| 94 |
def check_final_answer(final_answer, agent_memory) -> bool:
|
| 95 |
"""
|
|
|
|
| 58 |
|
| 59 |
# SETUP AND TEST
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
|
| 63 |
###################
|
|
|
|
| 69 |
base_model = InferenceClientModel(
|
| 70 |
provider="groq",
|
| 71 |
api_key=grok_api_key,
|
| 72 |
+
model_id="qwen/qwen3-32b",
|
| 73 |
+
requests_per_minute=20
|
| 74 |
)
|
| 75 |
|
| 76 |
# Wrap with rate limiting
|
| 77 |
+
My_Agent = base_model
|
| 78 |
|
| 79 |
def check_final_answer(final_answer, agent_memory) -> bool:
|
| 80 |
"""
|