Spaces:
Sleeping
Sleeping
Update multiagents.py
Browse files- multiagents.py +28 -16
multiagents.py
CHANGED
|
@@ -5,13 +5,14 @@ import dotenv
|
|
| 5 |
from smolagents import CodeAgent
|
| 6 |
#from smolagents import OpenAIServerModel
|
| 7 |
from tools.fetch import fetch_webpage, search_web
|
| 8 |
-
from smolagents import PythonInterpreterTool
|
| 9 |
from tools.yttranscript import get_youtube_transcript, get_youtube_title_description
|
| 10 |
from tools.stt import get_text_transcript_from_audio_file
|
| 11 |
from tools.image import analyze_image
|
| 12 |
from common.mylogger import mylog
|
| 13 |
from smolagents import LiteLLMModel # Import LiteLLMModel instead of OpenAIServerModel
|
| 14 |
-
|
|
|
|
| 15 |
import myprompts
|
| 16 |
|
| 17 |
from groq_api import GrokApi
|
|
@@ -46,24 +47,35 @@ dotenv.load_dotenv()
|
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
-
# --- Agent wrappers ---
|
| 50 |
-
groq_model = LiteLLMModel(
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
)
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
#
|
| 60 |
-
#
|
| 61 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
# )
|
| 63 |
|
| 64 |
-
|
| 65 |
-
# My_Agent = BasicAgent
|
| 66 |
-
My_Agent = groq_model
|
| 67 |
|
| 68 |
def check_final_answer(final_answer, agent_memory) -> bool:
|
| 69 |
"""
|
|
|
|
| 5 |
from smolagents import CodeAgent
|
| 6 |
#from smolagents import OpenAIServerModel
|
| 7 |
from tools.fetch import fetch_webpage, search_web
|
| 8 |
+
from smolagents import PythonInterpreterTool, InferenceClientModel
|
| 9 |
from tools.yttranscript import get_youtube_transcript, get_youtube_title_description
|
| 10 |
from tools.stt import get_text_transcript_from_audio_file
|
| 11 |
from tools.image import analyze_image
|
| 12 |
from common.mylogger import mylog
|
| 13 |
from smolagents import LiteLLMModel # Import LiteLLMModel instead of OpenAIServerModel
|
| 14 |
+
import os
|
| 15 |
+
#from huggingface_hub import InferenceClient
|
| 16 |
import myprompts
|
| 17 |
|
| 18 |
from groq_api import GrokApi
|
|
|
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
+
# # --- Agent wrappers ---
|
| 51 |
+
# groq_model = LiteLLMModel(
|
| 52 |
+
# model_id="groq/qwen3-32b", # or any other Groq model like groq/mixtral-8x7b-32768
|
| 53 |
+
# api_key = os.getenv("GROQ_API_KEY"),
|
| 54 |
+
# temperature=0.1,
|
| 55 |
+
# max_tokens=4000,
|
| 56 |
+
# )
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
#InferenceClientModel InferenceClient
|
| 60 |
+
My_Agent = InferenceClientModel(
|
| 61 |
+
provider="groq",
|
| 62 |
+
api_key=os.getenv("GROQ_API_KEY"), # Your Replicate API key
|
| 63 |
+
model_id = "qwen/qwen3-32b"
|
| 64 |
)
|
| 65 |
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
# My_Agent = client.chat.completions.create(
|
| 69 |
+
# model="qewn/qwen3-32b",
|
| 70 |
+
# messages=[
|
| 71 |
+
# {
|
| 72 |
+
# "role": "user",
|
| 73 |
+
# "content": "How many 'G's in 'huggingface'?"
|
| 74 |
+
# }
|
| 75 |
+
# ],
|
| 76 |
# )
|
| 77 |
|
| 78 |
+
|
|
|
|
|
|
|
| 79 |
|
| 80 |
def check_final_answer(final_answer, agent_memory) -> bool:
|
| 81 |
"""
|