Spaces:
Sleeping
Sleeping
Switch model backend from Claude to Gemini
Browse filesUses GEMINI_API_KEY (free tier) instead of ANTHROPIC_API_KEY, model_id gemini/gemini-3.6-flash via LiteLLMModel.
app.py
CHANGED
|
@@ -63,10 +63,10 @@ class RateLimiter:
|
|
| 63 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 64 |
class BasicAgent:
|
| 65 |
def __init__(self):
|
| 66 |
-
model_id = os.getenv("AGENT_MODEL_ID", "
|
| 67 |
-
api_key = os.getenv("
|
| 68 |
if not api_key:
|
| 69 |
-
print("Warning:
|
| 70 |
|
| 71 |
self.model = LiteLLMModel(model_id=model_id, api_key=api_key, temperature=0)
|
| 72 |
self.agent = CodeAgent(
|
|
@@ -251,7 +251,7 @@ with gr.Blocks() as demo:
|
|
| 251 |
Once clicking on the "submit button, it can take quite some time ( this is the time for the agent to go through all the questions).
|
| 252 |
This space provides a basic setup and is intentionally sub-optimal to encourage you to develop your own, more robust solution. For instance for the delay process of the submit button, a solution could be to cache the answers and submit in a seperate action or even to answer the questions in async.
|
| 253 |
|
| 254 |
-
**Setup:** This agent calls
|
| 255 |
"""
|
| 256 |
)
|
| 257 |
|
|
|
|
| 63 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 64 |
class BasicAgent:
|
| 65 |
def __init__(self):
|
| 66 |
+
model_id = os.getenv("AGENT_MODEL_ID", "gemini/gemini-3.6-flash")
|
| 67 |
+
api_key = os.getenv("GEMINI_API_KEY")
|
| 68 |
if not api_key:
|
| 69 |
+
print("Warning: GEMINI_API_KEY is not set - the agent will fail to call the model.")
|
| 70 |
|
| 71 |
self.model = LiteLLMModel(model_id=model_id, api_key=api_key, temperature=0)
|
| 72 |
self.agent = CodeAgent(
|
|
|
|
| 251 |
Once clicking on the "submit button, it can take quite some time ( this is the time for the agent to go through all the questions).
|
| 252 |
This space provides a basic setup and is intentionally sub-optimal to encourage you to develop your own, more robust solution. For instance for the delay process of the submit button, a solution could be to cache the answers and submit in a seperate action or even to answer the questions in async.
|
| 253 |
|
| 254 |
+
**Setup:** This agent calls Google's Gemini via `smolagents`. Get a free key at https://aistudio.google.com/apikey and set it as the `GEMINI_API_KEY` secret in this Space's settings before running.
|
| 255 |
"""
|
| 256 |
)
|
| 257 |
|