Artsem Radzevich
commited on
Commit
·
a4c3cf0
1
Parent(s):
3796c5a
Fixed LiteLLMModel.
Browse files- agent_config.py +6 -4
- requirements.txt +2 -1
agent_config.py
CHANGED
|
@@ -37,7 +37,7 @@ def create_agent():
|
|
| 37 |
CodeAgent: The configured agent instance.
|
| 38 |
"""
|
| 39 |
# Load API key from environment variable (more secure)
|
| 40 |
-
token = os.getenv("
|
| 41 |
if not token:
|
| 42 |
raise RuntimeError("Missing Hugging Face API key. Set HF_API_KEY environment variable.")
|
| 43 |
|
|
@@ -45,9 +45,9 @@ def create_agent():
|
|
| 45 |
# model = HfApiModel(token=token, model_id="gpt-3.5-turbo", provider="openai")
|
| 46 |
|
| 47 |
model = LiteLLMModel(
|
|
|
|
| 48 |
model_id="gemini/gemini-2.0-flash",
|
| 49 |
-
|
| 50 |
-
api_key=os.getenv("GEMINI_API_KEY")
|
| 51 |
)
|
| 52 |
|
| 53 |
# Initialize tools
|
|
@@ -61,8 +61,10 @@ def create_agent():
|
|
| 61 |
agent = CodeAgent(
|
| 62 |
model=model,
|
| 63 |
tools=[wiki_tool, web_search_tool, excel_analysis_tool, visitWebpageTool, python_interpreter_tool, check_answer, reverse_sentence_tool],
|
|
|
|
| 64 |
max_steps=8,
|
| 65 |
-
verbosity_level=2
|
|
|
|
| 66 |
)
|
| 67 |
return agent
|
| 68 |
|
|
|
|
| 37 |
CodeAgent: The configured agent instance.
|
| 38 |
"""
|
| 39 |
# Load API key from environment variable (more secure)
|
| 40 |
+
token = os.getenv("HF_API_KEY")
|
| 41 |
if not token:
|
| 42 |
raise RuntimeError("Missing Hugging Face API key. Set HF_API_KEY environment variable.")
|
| 43 |
|
|
|
|
| 45 |
# model = HfApiModel(token=token, model_id="gpt-3.5-turbo", provider="openai")
|
| 46 |
|
| 47 |
model = LiteLLMModel(
|
| 48 |
+
token=token,
|
| 49 |
model_id="gemini/gemini-2.0-flash",
|
| 50 |
+
api_key=os.getenv("GEMINI_API_KEY"),
|
|
|
|
| 51 |
)
|
| 52 |
|
| 53 |
# Initialize tools
|
|
|
|
| 61 |
agent = CodeAgent(
|
| 62 |
model=model,
|
| 63 |
tools=[wiki_tool, web_search_tool, excel_analysis_tool, visitWebpageTool, python_interpreter_tool, check_answer, reverse_sentence_tool],
|
| 64 |
+
add_base_tools=True,
|
| 65 |
max_steps=8,
|
| 66 |
+
verbosity_level=2,
|
| 67 |
+
additional_authorized_imports=['pandas','numpy','csv','subprocess']
|
| 68 |
)
|
| 69 |
return agent
|
| 70 |
|
requirements.txt
CHANGED
|
@@ -3,4 +3,5 @@ smolagents
|
|
| 3 |
wikipedia
|
| 4 |
pandas
|
| 5 |
openpyxl
|
| 6 |
-
huggingface_hub
|
|
|
|
|
|
| 3 |
wikipedia
|
| 4 |
pandas
|
| 5 |
openpyxl
|
| 6 |
+
huggingface_hub
|
| 7 |
+
smolagents[litellm]
|