Spaces:
Sleeping
Sleeping
File size: 1,257 Bytes
a9effa1 698ce3e 9ef3aa7 3d63627 a9effa1 40a900a a9effa1 698ce3e 9ef3aa7 3d63627 a9effa1 698ce3e 9ef3aa7 3d63627 a9effa1 c4d08fc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
import os
from dotenv import load_dotenv
from mistralai import Mistral
from src.agent.utils.tooling import generate_tools_json
from src.agent.tools import (
calculate_sum,
retrieve_knowledge,
visit_webpage,
get_production_status,
get_downtimes,
)
load_dotenv()
class MistralAgent:
def __init__(self):
self.api_key = os.getenv("MISTRAL_API_KEY")
self.agent_id = os.getenv("AGENT_ID")
self.client = Mistral(api_key=self.api_key)
self.model = "mistral-medium-latest"
self.prompt = None
self.names_to_functions = {
"calculate_sum": calculate_sum,
"retrieve_knowledge": retrieve_knowledge,
"visit_webpage": visit_webpage,
"get_production_status": get_production_status,
"get_downtimes": get_downtimes,
}
self.tools = self.get_tools()
@staticmethod
def get_tools():
"""Generate the tools.json file with the tools to be used by the agent."""
return generate_tools_json(
[
calculate_sum,
retrieve_knowledge,
visit_webpage,
get_production_status,
get_downtimes,
]
).get('tools') |