Spaces:
Sleeping
Sleeping
Download agents/base_agent.py from umar-30/Multi-agent-system: direct link, hf CLI and curl.
- Browser
- Download file 555 Bytes
-
https://huggingface.co/spaces/umar-30/Multi-agent-system/resolve/main/agents/base_agent.py
- Command line
-
hf download hf://spaces/umar-30/Multi-agent-system/agents/base_agent.py
-
curl -L -o base_agent.py https://huggingface.co/spaces/umar-30/Multi-agent-system/resolve/main/agents/base_agent.py
555 Bytes
| import cohere | |
| import os | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| class BaseAgent: | |
| def __init__(self, name, role): | |
| self.name = name | |
| self.role = role | |
| self.client = cohere.Client( | |
| os.getenv("COHERE_API_KEY") | |
| ) | |
| def think(self, task): | |
| prompt = f""" | |
| You are {self.name}. | |
| Your role: | |
| {self.role} | |
| Task: | |
| {task} | |
| """ | |
| response = self.client.chat( | |
| model="command-r-08-2024", | |
| message=prompt | |
| ) | |
| return response.text |