File size: 965 Bytes
fa2cb8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from crewai import Agent, Crew, Process, Task, LLM
from crewai.project import CrewBase, agent, crew, task
from .tools_loader import get_tools

@CrewBase
class ShapCrew:
    """SHAP explainer crew"""

    def __init__(self):
        # Load tools once
        self.tools = get_tools()
        
        # Initialize LLMs with optimal settings
        self.llm = LLM(model="groq/meta-llama/llama-4-maverick-17b-128e-instruct", temperature=0.3)

    @agent
    def shap_agent(self) -> Agent:
        return Agent(
            config=self.agents_config['shap_agent'],
            tools=[self.tools["shap_tool"]],
            llm=self.llm,
            allow_delegation=False,
            verbose=False
        )

    @task
    def shap_task(self) -> Task:
        return Task(config=self.tasks_config['shap_task'])

    @crew
    def crew(self) -> Crew:
        return Crew(
            agents=self.agents,
            tasks=self.tasks,
            verbose=False
        )