LucMarcelPellinger commited on
Commit
21f8e85
·
verified ·
1 Parent(s): 643473f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -6
app.py CHANGED
@@ -1,4 +1,4 @@
1
- from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
2
  import datetime
3
  import requests
4
  import pytz
@@ -7,6 +7,8 @@ from tools.final_answer import FinalAnswerTool
7
  from tools.visit_webpage import VisitWebpageTool
8
  from datetime import datetime
9
 
 
 
10
  from Gradio_UI import GradioUI
11
 
12
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
@@ -62,13 +64,25 @@ final_answer = FinalAnswerTool()
62
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
63
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
64
 
65
- model = HfApiModel(
66
- max_tokens=2096,
67
- temperature=0.5,
68
- model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
69
- custom_role_conversions=None,
 
 
 
 
 
70
  )
71
 
 
 
 
 
 
 
 
72
 
73
  # Import tool from Hub
74
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
 
1
+ from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool, LiteLLMModel
2
  import datetime
3
  import requests
4
  import pytz
 
7
  from tools.visit_webpage import VisitWebpageTool
8
  from datetime import datetime
9
 
10
+ import os
11
+
12
  from Gradio_UI import GradioUI
13
 
14
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
 
64
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
65
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
66
 
67
+ # --- Configure LLM Model ---
68
+ if not os.getenv("GEMINI_KEY"):
69
+ print("CRITICAL: GEMINI_KEY environment variable not set. LLM will not work.")
70
+ # exit(1) # Or handle gracefully
71
+
72
+ model = LiteLLMModel(
73
+ model_id="gemini/gemini-1.5-flash-latest",
74
+ api_key=os.getenv("GEMINI_KEY"),
75
+ max_tokens=4096,
76
+ temperature=0.6
77
  )
78
 
79
+ #model = HfApiModel(
80
+ #max_tokens=2096,
81
+ #temperature=0.5,
82
+ #model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
83
+ #custom_role_conversions=None,
84
+ #)
85
+
86
 
87
  # Import tool from Hub
88
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)