Update app.py
Browse filesUpdated the BasicAgent class
app.py
CHANGED
|
@@ -16,30 +16,27 @@ GEMINI_API_KEY = os.get("Gemini_API_key")
|
|
| 16 |
# Agent capabilities required: Search the web, listen to audio recordings, watch YouTube videos (process the footage, not the transcript), work with Excel spreadsheets
|
| 17 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 18 |
|
| 19 |
-
|
|
|
|
| 20 |
model_id="gemini/gemini-2.0-flash", # you can see other model names here: https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models. It is important to prefix the name with "gemini/"
|
| 21 |
api_key=GEMINI_API_KEY,
|
| 22 |
max_tokens=8192
|
| 23 |
-
)
|
| 24 |
-
google_search_tool = Tool(
|
| 25 |
-
|
| 26 |
-
)
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
| 29 |
def __init__(self):
|
| 30 |
print("BasicAgent initialized.")
|
| 31 |
def __call__(self, question: str) -> str:
|
| 32 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 33 |
fixed_answer = "This is a default answer."
|
| 34 |
-
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 35 |
-
return fixed_answer
|
| 36 |
-
|
| 37 |
-
agent = CodeAgent(
|
| 38 |
-
model = llm_model,
|
| 39 |
-
tool = [google_search_tool]
|
| 40 |
-
)
|
| 41 |
-
|
| 42 |
-
return agent.run(text)
|
| 43 |
|
| 44 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 45 |
"""
|
|
|
|
| 16 |
# Agent capabilities required: Search the web, listen to audio recordings, watch YouTube videos (process the footage, not the transcript), work with Excel spreadsheets
|
| 17 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 18 |
|
| 19 |
+
class BasicAgent:
|
| 20 |
+
llm_model = LiteLLMModel(
|
| 21 |
model_id="gemini/gemini-2.0-flash", # you can see other model names here: https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models. It is important to prefix the name with "gemini/"
|
| 22 |
api_key=GEMINI_API_KEY,
|
| 23 |
max_tokens=8192
|
| 24 |
+
)
|
| 25 |
+
google_search_tool = Tool(
|
| 26 |
+
google_search = GoogleSearch()
|
| 27 |
+
)
|
| 28 |
+
agent = CodeAgent(
|
| 29 |
+
model = llm_model,
|
| 30 |
+
tool = [google_search_tool]
|
| 31 |
+
)
|
| 32 |
def __init__(self):
|
| 33 |
print("BasicAgent initialized.")
|
| 34 |
def __call__(self, question: str) -> str:
|
| 35 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 36 |
fixed_answer = "This is a default answer."
|
| 37 |
+
# print(f"Agent returning fixed answer: {fixed_answer}")
|
| 38 |
+
# return fixed_answer
|
| 39 |
+
return agent.run(question)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 42 |
"""
|