Spaces:
Sleeping
Sleeping
Update multiagents.py
Browse files- multiagents.py +28 -8
multiagents.py
CHANGED
|
@@ -55,14 +55,34 @@ dotenv.load_dotenv()
|
|
| 55 |
# max_tokens=4000,
|
| 56 |
# )
|
| 57 |
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
)
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
|
| 68 |
# My_Agent = client.chat.completions.create(
|
|
|
|
| 55 |
# max_tokens=4000,
|
| 56 |
# )
|
| 57 |
|
| 58 |
+
# SETUP AND TEST
|
| 59 |
+
|
| 60 |
+
try:
|
| 61 |
+
#InferenceClientModel InferenceClient
|
| 62 |
+
My_Agent = InferenceClientModel(
|
| 63 |
+
provider="groq",
|
| 64 |
+
api_key=os.getenv("GROQ_API_KEY"),
|
| 65 |
+
model_id = "qwen/qwen3-32b"
|
| 66 |
+
)
|
| 67 |
+
|
| 68 |
+
output_test = MyAgent('What are the 3 laws of robotics')
|
| 69 |
+
print('1', output_test)
|
| 70 |
+
|
| 71 |
+
except:
|
| 72 |
+
# Check if API key is available
|
| 73 |
+
groq_api_key = os.getenv("GROQ_API_KEY")
|
| 74 |
+
if not groq_api_key:
|
| 75 |
+
raise ValueError("GROQ_API_KEY environment variable is not set")
|
| 76 |
+
|
| 77 |
+
# Fixed model initialization - use LiteLLMModel instead of InferenceClientModel for Groq
|
| 78 |
+
My_Agent = LiteLLMModel(
|
| 79 |
+
model_id="groq/qwen3-32b", # Use a valid Groq model ID
|
| 80 |
+
api_key=groq_api_key,
|
| 81 |
+
temperature=0.1,
|
| 82 |
+
max_tokens=4000,
|
| 83 |
+
)
|
| 84 |
+
output_test = MyAgent('What are the 3 laws of robotics')
|
| 85 |
+
print('2', output_test)
|
| 86 |
|
| 87 |
|
| 88 |
# My_Agent = client.chat.completions.create(
|