Download agents/agent_setup.py from amineelh/AgentApi: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/spaces/amineelh/AgentApi/resolve/main/agents/agent_setup.py
- Command line
-
hf download hf://spaces/amineelh/AgentApi/agents/agent_setup.py
-
curl -L -o agent_setup.py https://huggingface.co/spaces/amineelh/AgentApi/resolve/main/agents/agent_setup.py
1.01 kB
| import logging | |
| from agno.agent import Agent | |
| from agno.models.groq import Groq | |
| from agents.knowledge_base import create_knowledge_base, load_knowledge_base | |
| from config import ( | |
| GROQ_API_KEY, | |
| GROQ_MODEL_ID, | |
| AGENT_INSTRUCTIONS | |
| ) | |
| logger = logging.getLogger(__name__) | |
| def initialize_agent() -> Agent: | |
| """Initialise et configure l'agent de recherche""" | |
| logger.info("Configuration de l'agent...") | |
| # Create knowledge base | |
| knowledge_base = create_knowledge_base() | |
| # Load knowledge base | |
| load_knowledge_base(knowledge_base) | |
| # Create agent | |
| agent = Agent( | |
| model=Groq(id=GROQ_MODEL_ID, api_key=GROQ_API_KEY), | |
| name="mex_researcher", | |
| role="chercheur manuel exploitation", | |
| instructions=AGENT_INSTRUCTIONS, | |
| knowledge=knowledge_base, | |
| add_references=True, | |
| search_knowledge=True, | |
| markdown=True | |
| ) | |
| logger.info("Agent configuré avec succès") | |
| return agent |