Draichi commited on
Commit
e37f480
1 Parent(s): c9e7644

wip: multi-agents

Browse files
LLM/LLM.ipynb DELETED
The diff for this file is too large to render. See raw diff
 
multi-agents-analysis/README.md ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LLM Multi Agent Race Analysis System
2
+
3
+ This project utilizes a multi-agent system to analyze race data from the FastF1 library using CrewAI and LangChain. The system is designed to provide detailed insights and comparisons between drivers in a race session.
4
+
5
+ ## Setup Instructions
6
+
7
+ 1. **Create and activate a Conda virtual environment:**
8
+
9
+ ```sh
10
+ conda create --name race-analysis python=3.11
11
+ conda activate race-analysis
12
+ ```
13
+
14
+ 2. **Install the dependencies:**
15
+
16
+ ```sh
17
+ conda env create --file environment.yml
18
+ ```
19
+
20
+ 3. **Paste your OpenAI key in the .env file.**
21
+
22
+ 4. **Provide basic context for the analysis system:**
23
+
24
+ - Create a file named `context.md` in the root directory.
25
+ - Add a brief text in `context.md` to provide basic context to the analysis system.
26
+
27
+ 5. **Run the main script to start the race analysis:**
28
+ ```sh
29
+ python main.py
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ To run the analysis, execute the following command:
multi-agents-analysis/agents.py CHANGED
@@ -1,4 +1,7 @@
1
  from crewai import Agent
 
 
 
2
  from textwrap import dedent
3
  from langchain.llms import OpenAI, Ollama
4
  from langchain_openai import ChatOpenAI
@@ -9,6 +12,8 @@ from langchain_openai import ChatOpenAI
9
  # You can also define custom tasks in tasks.py
10
  class CustomAgents:
11
  def __init__(self) -> None:
 
 
12
  # self.OpenAIGPT35 = ChatOpenAI(model='gpt-3.5-turbo', temperature=0.7)
13
  self.Ollama = Ollama(
14
  model="internlm2", base_url="http://localhost:11434", temperature=0.1)
@@ -29,7 +34,8 @@ class CustomAgents:
29
  between them."""),
30
  allow_delegation=False,
31
  verbose=True,
32
- llm=self.Ollama
 
33
  )
34
 
35
  def race_engineer(self):
 
1
  from crewai import Agent
2
+ from crewai_tools import (
3
+ PGSearchTool,
4
+ )
5
  from textwrap import dedent
6
  from langchain.llms import OpenAI, Ollama
7
  from langchain_openai import ChatOpenAI
 
12
  # You can also define custom tasks in tasks.py
13
  class CustomAgents:
14
  def __init__(self) -> None:
15
+ self.db_search_tool = PGSearchTool(
16
+ db_uri='sqlite:///laps.db', table_name='laps')
17
  # self.OpenAIGPT35 = ChatOpenAI(model='gpt-3.5-turbo', temperature=0.7)
18
  self.Ollama = Ollama(
19
  model="internlm2", base_url="http://localhost:11434", temperature=0.1)
 
34
  between them."""),
35
  allow_delegation=False,
36
  verbose=True,
37
+ llm=self.Ollama,
38
+ tools=[self.db_search_tool]
39
  )
40
 
41
  def race_engineer(self):
multi-agents-analysis/main.py CHANGED
@@ -43,13 +43,13 @@ class CustomCrew:
43
  agents = CustomAgents()
44
  tasks = CustomTasks()
45
 
46
- custom_agent_1 = agents.data_analyst()
47
  custom_agent_2 = agents.race_engineer()
48
 
49
- custom_task_1 = tasks.task_1_name(custom_agent_1, 'foo', 'var')
50
  custom_task_2 = tasks.task_2_name(custom_agent_2)
51
 
52
- crew = Crew(agents=[custom_agent_1, custom_agent_2], tasks=[
53
  custom_task_1, custom_task_2], verbose=True)
54
 
55
  result = crew.kickoff()
 
43
  agents = CustomAgents()
44
  tasks = CustomTasks()
45
 
46
+ data_analyst_agent = agents.data_analyst()
47
  custom_agent_2 = agents.race_engineer()
48
 
49
+ custom_task_1 = tasks.task_1_name(data_analyst_agent, 'foo', 'var')
50
  custom_task_2 = tasks.task_2_name(custom_agent_2)
51
 
52
+ crew = Crew(agents=[data_analyst_agent, custom_agent_2], tasks=[
53
  custom_task_1, custom_task_2], verbose=True)
54
 
55
  result = crew.kickoff()
notebooks/save_data_database.ipynb ADDED
The diff for this file is too large to render. See raw diff