huytofu92 commited on
Commit
92a4c5d
·
1 Parent(s): a6ef4a2

Fix model initiation

Browse files
Files changed (2) hide show
  1. community_tools.py +1 -4
  2. mini_agents.py +23 -11
community_tools.py CHANGED
@@ -1,9 +1,6 @@
1
  from langchain_google_community import GooglePlacesTool
2
  from langchain_community.agent_toolkits.load_tools import load_tools
3
- from smolagents.tools import Tool
4
-
5
- import os
6
- os.environ["GPLACES_API_KEY"] = "AIzaSyBpYITz-7liGXiXF-bpkjMFsmDoyRp0YXc"
7
 
8
  google_map_tool = Tool.from_langchain(GooglePlacesTool())
9
 
 
1
  from langchain_google_community import GooglePlacesTool
2
  from langchain_community.agent_toolkits.load_tools import load_tools
3
+ from smolagents.tools import Tool
 
 
 
4
 
5
  google_map_tool = Tool.from_langchain(GooglePlacesTool())
6
 
mini_agents.py CHANGED
@@ -19,8 +19,8 @@ MODEL_CHOICES = {
19
  }
20
 
21
  audio_model = InferenceClientModel(
22
- model=MODEL_CHOICES["audio"][0],
23
- api_key=os.getenv("HUGGINGFACE_API_KEY"),
24
  api_url="https://api.openai.com/v1/audio/transcriptions"
25
  )
26
 
@@ -33,8 +33,8 @@ audio_agent = CodeAgent(
33
  )
34
 
35
  vlm_model = InferenceClientModel(
36
- model=MODEL_CHOICES["vlm"][0],
37
- api_key=os.getenv("HUGGINGFACE_API_KEY"),
38
  api_url="https://api.openai.com/v1/images/generations"
39
  )
40
 
@@ -47,8 +47,8 @@ vlm_agent = CodeAgent(
47
  )
48
 
49
  arithmetic_model = InferenceClientModel(
50
- model=MODEL_CHOICES["arithmetic"][0],
51
- api_key=os.getenv("HUGGINGFACE_API_KEY"),
52
  api_url="https://api.openai.com/v1/chat/completions"
53
  )
54
 
@@ -61,8 +61,8 @@ arithmetic_agent = CodeAgent(
61
  )
62
 
63
  pandas_model = InferenceClientModel(
64
- model=MODEL_CHOICES["pandas"][0],
65
- api_key=os.getenv("HUGGINGFACE_API_KEY"),
66
  api_url="https://api.openai.com/v1/chat/completions"
67
  )
68
 
@@ -74,8 +74,14 @@ pandas_agent = CodeAgent(
74
  description="This agent is responsible for converting data to a dataframe, performing pandas operations on such dataframe and converting the dataframe back to a json or a csv file."
75
  )
76
 
 
 
 
 
 
 
77
  multimodal_manager = CodeAgent(
78
- model=MODEL_CHOICES["code"][0],
79
  managed_agents=[audio_agent, vlm_agent],
80
  tools=[sort_list],
81
  max_steps=8,
@@ -85,7 +91,7 @@ multimodal_manager = CodeAgent(
85
  )
86
 
87
  operation_manager = CodeAgent(
88
- model=MODEL_CHOICES["code"][0],
89
  managed_agents=[arithmetic_agent, pandas_agent],
90
  tools=[sort_list],
91
  max_steps=8,
@@ -94,8 +100,14 @@ operation_manager = CodeAgent(
94
  description="This agent is responsible for managing the arithmetic and pandas agents."
95
  )
96
 
 
 
 
 
 
 
97
  master_agent = CodeAgent(
98
- model=MODEL_CHOICES["master"][0],
99
  managed_agents=[multimodal_manager, operation_manager],
100
  tools=[sort_list, *community_tools],
101
  max_steps=16,
 
19
  }
20
 
21
  audio_model = InferenceClientModel(
22
+ model_id=MODEL_CHOICES["audio"][0],
23
+ token=os.getenv("HUGGINGFACE_API_KEY"),
24
  api_url="https://api.openai.com/v1/audio/transcriptions"
25
  )
26
 
 
33
  )
34
 
35
  vlm_model = InferenceClientModel(
36
+ model_id=MODEL_CHOICES["vlm"][0],
37
+ token=os.getenv("HUGGINGFACE_API_KEY"),
38
  api_url="https://api.openai.com/v1/images/generations"
39
  )
40
 
 
47
  )
48
 
49
  arithmetic_model = InferenceClientModel(
50
+ model_id=MODEL_CHOICES["arithmetic"][0],
51
+ token=os.getenv("HUGGINGFACE_API_KEY"),
52
  api_url="https://api.openai.com/v1/chat/completions"
53
  )
54
 
 
61
  )
62
 
63
  pandas_model = InferenceClientModel(
64
+ model_id=MODEL_CHOICES["pandas"][0],
65
+ token=os.getenv("HUGGINGFACE_API_KEY"),
66
  api_url="https://api.openai.com/v1/chat/completions"
67
  )
68
 
 
74
  description="This agent is responsible for converting data to a dataframe, performing pandas operations on such dataframe and converting the dataframe back to a json or a csv file."
75
  )
76
 
77
+ code_model = InferenceClientModel(
78
+ model_id=MODEL_CHOICES["code"][0],
79
+ token=os.getenv("HUGGINGFACE_API_KEY"),
80
+ api_url="https://api.openai.com/v1/chat/completions"
81
+ )
82
+
83
  multimodal_manager = CodeAgent(
84
+ model=code_model,
85
  managed_agents=[audio_agent, vlm_agent],
86
  tools=[sort_list],
87
  max_steps=8,
 
91
  )
92
 
93
  operation_manager = CodeAgent(
94
+ model=code_model,
95
  managed_agents=[arithmetic_agent, pandas_agent],
96
  tools=[sort_list],
97
  max_steps=8,
 
100
  description="This agent is responsible for managing the arithmetic and pandas agents."
101
  )
102
 
103
+ master_model = InferenceClientModel(
104
+ model_id=MODEL_CHOICES["master"][0],
105
+ token=os.getenv("HUGGINGFACE_API_KEY"),
106
+ api_url="https://api.openai.com/v1/chat/completions"
107
+ )
108
+
109
  master_agent = CodeAgent(
110
+ model=master_model,
111
  managed_agents=[multimodal_manager, operation_manager],
112
  tools=[sort_list, *community_tools],
113
  max_steps=16,